From 009466999dfaa7e7769b046d938035fa4bcb4aad Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Mon, 29 Jan 2018 21:58:35 +0100 Subject: [PATCH 1/2] Fix cron config file rights (fixes #88) --- scripts/install | 2 ++ scripts/upgrade | 2 ++ 2 files changed, 4 insertions(+) diff --git a/scripts/install b/scripts/install index 2eb6baa..ee80e92 100755 --- a/scripts/install +++ b/scripts/install @@ -216,6 +216,8 @@ ynh_store_file_checksum "${final_path}/config/config.php" cron_path="/etc/cron.d/$app" cp -a ../conf/nextcloud.cron "$cron_path" +chown root: "$cron_path" +chmod 644 "$cron_path" ynh_replace_string "#USER#" "$app" "$cron_path" ynh_replace_string "#DESTDIR#" "$final_path" "$cron_path" diff --git a/scripts/upgrade b/scripts/upgrade index a0ae504..a156b9f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -286,6 +286,8 @@ ynh_store_file_checksum "${final_path}/config/config.php" cron_path="/etc/cron.d/$app" cp -a ../conf/nextcloud.cron "$cron_path" +chown root: "$cron_path" +chmod 644 "$cron_path" ynh_replace_string "#USER#" "$app" "$cron_path" ynh_replace_string "#DESTDIR#" "$final_path" "$cron_path" From 40526739d21d93820a745a9367edaafff0c3ac2c Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Mon, 29 Jan 2018 21:59:28 +0100 Subject: [PATCH 2/2] Don't overwrite all settings during upgrade --- conf/config.json | 5 ----- conf/config_install.json | 9 +++++++++ scripts/install | 18 ++++++++++++------ 3 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 conf/config_install.json diff --git a/conf/config.json b/conf/config.json index 3de9379..2e7aca8 100644 --- a/conf/config.json +++ b/conf/config.json @@ -1,10 +1,5 @@ { "system": { - "datadirectory": "#DATADIR#", - "trusted_domains": [ - "localhost", - "#DOMAIN#" - ], "updatechecker": false, "memcache.local": "\\OC\\Memcache\\APCu", "integrity.check.disabled": true, diff --git a/conf/config_install.json b/conf/config_install.json new file mode 100644 index 0000000..52bff54 --- /dev/null +++ b/conf/config_install.json @@ -0,0 +1,9 @@ +{ + "system": { + "datadirectory": "#DATADIR#", + "trusted_domains": [ + "localhost", + "#DOMAIN#" + ] + } +} diff --git a/scripts/install b/scripts/install index ee80e92..cf22534 100755 --- a/scripts/install +++ b/scripts/install @@ -144,11 +144,6 @@ exec_occ maintenance:install \ # CONFIGURE NEXTCLOUD #================================================= -nc_conf="${final_path}/config.json" -cp ../conf/config.json "$nc_conf" -ynh_replace_string "#DOMAIN#" "$domain" "$nc_conf" -ynh_replace_string "#DATADIR#" "$datadir" "$nc_conf" - # Ensure that UpdateNotification app is disabled exec_occ app:disable updatenotification @@ -156,7 +151,18 @@ exec_occ app:disable updatenotification exec_occ app:enable user_ldap exec_occ ldap:create-empty-config -# Load the config file in nextcloud +# Load the installation config file in nextcloud +nc_conf="${final_path}/config_install.json" +cp ../conf/config_install.json "$nc_conf" +ynh_replace_string "#DOMAIN#" "$domain" "$nc_conf" +ynh_replace_string "#DATADIR#" "$datadir" "$nc_conf" +exec_occ config:import "$nc_conf" +# Then remove it +rm -f "$nc_conf" + +# Load the additional config file (used also for upgrade) +nc_conf="${final_path}/config_install.json" +cp ../conf/config.json "$nc_conf" exec_occ config:import "$nc_conf" # Then remove it rm -f "$nc_conf"