From b5fe228e65a5a1c66028386748a758c1fc0df998 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 16 Aug 2021 20:33:57 +0200 Subject: [PATCH] Fix old issue in 2017, settings.conf was in the data directory --- check_process | 5 +++++ conf/systemd.service | 2 +- scripts/install | 6 +++--- scripts/upgrade | 17 +++++++++++++---- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/check_process b/check_process index e04a105..b29dfe6 100644 --- a/check_process +++ b/check_process @@ -10,7 +10,10 @@ setup_private=0 setup_public=0 upgrade=1 + # From GIT upgrade=1 from_commit=2a7461345d70ae231cc81a580189934626ed8c58 + # 3.0.1~ynh2 + upgrade=1 from_commit=06e0d129fef72c1c43063f81ae2bef97576f7fa7 backup_restore=1 multi_instance=0 # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. @@ -26,4 +29,6 @@ Notification=none ;;; Upgrade options ; commit=2a7461345d70ae231cc81a580189934626ed8c58 name=From GIT + ; commit=06e0d129fef72c1c43063f81ae2bef97576f7fa7 + name=3.0.1~ynh2 diff --git a/conf/systemd.service b/conf/systemd.service index c9c657e..dfa9826 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ -ExecStart=/opt/pyenv/versions/__PYTHON_VERSION__/bin/python __FINALPATH__/CouchPotato.py --quiet --pid_file=/var/run/__APP__/__APP__.pid --data_dir=__DATADIR__ --config_file=__FINALPATH__/settings.conf +ExecStart=/opt/pyenv/versions/__PYTHON_VERSION__/bin/python __FINALPATH__/CouchPotato.py --quiet --pid_file=/var/run/__APP__/__APP__.pid --data_dir=__DATADIR__ --config_file=__DATADIR__/settings.conf [Install] diff --git a/scripts/install b/scripts/install index 7e9a8af..240217c 100644 --- a/scripts/install +++ b/scripts/install @@ -204,10 +204,10 @@ fi #================================================= ynh_script_progression --message="Adding a configuration file..." -ynh_add_config --template="../conf/couchpotato.conf" --destination="$final_path/settings.conf" +ynh_add_config --template="../conf/couchpotato.conf" --destination="$datadir/settings.conf" -chmod 600 "$final_path/settings.conf" -chown $app:$app "$final_path/settings.conf" +chmod 600 "$datadir/settings.conf" +chown $app:$app "$datadir/settings.conf" #================================================= # SETUP SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 6e40bae..4568c4f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -71,6 +71,16 @@ if [ -z "$datadir" ]; then ynh_app_setting_delete --app=$app --key=app_data_dir fi +# If settings.conf is not at the right place, move it +if [ -f "$datadir/settings.conf" ]; then + ynh_delete_file_checksum --file="$final_path/settings.conf" + mv "$final_path/settings.conf" "$datadir/settings.conf" + ynh_store_file_checksum --file="$datadir/settings.conf" + + chmod 600 "$datadir/settings.conf" + chown $app:$app "$datadir/settings.conf" +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -211,11 +221,10 @@ fi #================================================= ynh_script_progression --message="Updating a configuration file..." -ynh_backup_if_checksum_is_different --file="$final_path/settings.conf" -#ynh_add_config --template="../conf/couchpotato.conf" --destination="$final_path/settings.conf" +ynh_backup_if_checksum_is_different --file="$datadir/settings.conf" -chmod 600 "$final_path/settings.conf" -chown $app:$app "$final_path/settings.conf" +chmod 600 "$datadir/settings.conf" +chown $app:$app "$datadir/settings.conf" #================================================= # CONFIGURE LOGS