1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/couchpotato_ynh.git synced 2024-09-03 18:16:22 +02:00

Fix old issue

in 2017, settings.conf was in the data directory
This commit is contained in:
yalh76 2021-08-16 20:33:57 +02:00
parent 61554dd42c
commit b5fe228e65
4 changed files with 22 additions and 8 deletions

View file

@ -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

View file

@ -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]

View file

@ -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

View file

@ -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