From 9b3d6ef7efae1bb9e63c9d2cc793212bbcbec914 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Tue, 30 Jan 2018 11:11:38 +0100 Subject: [PATCH] detect installation in a better way --- rootfs/etc/confd/conf.d/config.php.toml | 6 --- rootfs/etc/confd/templates/config.php.tmpl | 57 ---------------------- rootfs/etc/cont-init.d/00-nextcloud | 6 ++- 3 files changed, 4 insertions(+), 65 deletions(-) delete mode 100644 rootfs/etc/confd/conf.d/config.php.toml delete mode 100644 rootfs/etc/confd/templates/config.php.tmpl diff --git a/rootfs/etc/confd/conf.d/config.php.toml b/rootfs/etc/confd/conf.d/config.php.toml deleted file mode 100644 index d18ecfe..0000000 --- a/rootfs/etc/confd/conf.d/config.php.toml +++ /dev/null @@ -1,6 +0,0 @@ -[template] -src = "config.php.tmpl" -dest = "/var/lib/nextcloud/config/config.php.sample" -gid = 101 -uid = 100 -mode = "0660" diff --git a/rootfs/etc/confd/templates/config.php.tmpl b/rootfs/etc/confd/templates/config.php.tmpl deleted file mode 100644 index 918aebd..0000000 --- a/rootfs/etc/confd/templates/config.php.tmpl +++ /dev/null @@ -1,57 +0,0 @@ - - array ( - '{{getenv "DOMAIN"}}' - ), - -'datadirectory' => '/var/lib/nextcloud/data', - -'dbtype' => 'pgsql', -'dbhost' => '{{getenv "DB_HOST"}}', -'dbname' => '{{getenv "DB_NAME"}}', -'dbuser' => '{{getenv "DB_USER"}}', -'dbpassword' => '{{getenv "DB_PASSWORD"}}', -'dbtableprefix' => '{{getenv "DB_TABLE_PREFIX"}}', - -'skeletondirectory' => '', - -'mail_domain' => '{{getenv "MAIL_DOMAIN"}}', -'mail_from_address' => '{{getenv "MAIL_FROM"}}', -'mail_smtpdebug' => false, -'mail_smtpmode' => 'smtp', -'mail_smtphost' => '{{getenv "MAIL_SMTP_HOST"}}', -'mail_smtpport' => {{getenv "MAIL_SMTP_PORT" "587"}}, -'mail_smtptimeout' => 10, -'mail_smtpsecure' => '{{getenv "MAIL_SMTP_SECURITY" "tls"}}', -'mail_smtpauth' => {{getenv "MAIL_SMTP_AUTH" "true"}}, -'mail_smtpauthtype' => '{{getenv "MAIL_SMTP_AUTH_TYPE" "PLAIN"}}', -'mail_smtpname' => '{{getenv "MAIL_SMTP_NAME"}}', -'mail_smtppassword' => '{{getenv "MAIL_SMTP_PASSWORD"}}', - -'overwritehost' => '{{getenv "DOMAIN"}}', -'overwriteprotocol' => 'https', -'overwritewebroot' => '', -'overwrite.cli.url' => 'https://{{getenv "DOMAIN"}}', - -'apps_paths' => array( - array( - 'path'=> '/var/lib/nextcloud/apps', - 'url' => '/apps', - 'writable' => true, - ), -), - -'supportedDatabases' => array( - 'pgsql', -), - -'memcache.local' => '\OC\Memcache\APCu', - -'assetdirectory' => '/var/lib/nextcloud', -'mount_file' => '/var/lib/nextcloud/data/mount.json', -'installed' => true, -'version' => '12.0.0.29', -); diff --git a/rootfs/etc/cont-init.d/00-nextcloud b/rootfs/etc/cont-init.d/00-nextcloud index 6f1d5eb..1640205 100644 --- a/rootfs/etc/cont-init.d/00-nextcloud +++ b/rootfs/etc/cont-init.d/00-nextcloud @@ -3,9 +3,9 @@ set -ex cd /usr/share/webapps/nextcloud -PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -U $DB_USER -d $DB_NAME -c "SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = '${DB_TABLE_PREFIX}appconfig')" | grep f +#PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -U $DB_USER -d $DB_NAME -c "SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = '${DB_TABLE_PREFIX}appconfig')" | grep f -if [ $? -ne 1 ]; then +if [ ! -f /var/lib/nextcloud/data/.installed ]; then s6-setuidgid nginx ./occ maintenance:install \ --database=pgsql \ --database-host=$DB_HOST \ @@ -24,6 +24,8 @@ if [ $? -ne 1 ]; then s6-setuidgid nginx ./occ app:enable files_texteditor s6-setuidgid nginx ./occ app:enable files_pdfviewer s6-setuidgid nginx ./occ app:enable theming + + touch /var/lib/nextcloud/data/.installed fi s6-setuidgid nginx ./occ config:system:set --value "https://$DOMAIN" overwrite.cli.url