diff --git a/conf/systemd.service b/conf/systemd.service index d65ee92..b07bde1 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,10 +6,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ -ExecStart=__INSTALL_DIR__/venv/bin/python3 __INSTALL_DIR__/Headphones.py --config /etc/__APP__/headphones.ini --datadir __DATA_DIR__ --nolaunch - -# Allow headphones to write to its configuration directory despite ProtectSystem -ReadWritePaths=/etc/__APP__ +ExecStart=__INSTALL_DIR__/venv/bin/python3 __INSTALL_DIR__/Headphones.py --config __INSTALL_DIR__/headphones.ini --datadir __DATA_DIR__ --nolaunch # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these diff --git a/scripts/backup b/scripts/backup index 6b73e3a..d4006e2 100644 --- a/scripts/backup +++ b/scripts/backup @@ -47,12 +47,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# BACKUP VARIOUS FILES -#================================================= - -ynh_backup --src_path="/etc/$app/" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index c559e20..af84db2 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -32,7 +32,7 @@ ynh_change_url_nginx_config #================================================= ynh_script_progression --message="Updating a configuration file..." -ynh_replace_string --match_string="^http_root = .*" --replace_string="http_root = $new_path" --target_file="/etc/$app/headphones.ini" +ynh_replace_string --match_string="^http_root = .*" --replace_string="http_root = $new_path" --target_file="$install_dir/headphones.ini" #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index 3b38988..15b9bf3 100644 --- a/scripts/install +++ b/scripts/install @@ -43,11 +43,11 @@ python3 -m venv $install_dir/venv #================================================= ynh_script_progression --message="Adding a configuration file..." -mkdir -p "/etc/$app" -ynh_add_config --template="../conf/headphones.ini" --destination="/etc/$app/headphones.ini" +ynh_add_config --template="../conf/headphones.ini" --destination="$install_dir/headphones.ini" +ynh_delete_file_checksum --file="$install_dir/headphones.ini" -chmod 650 "/etc/$app/headphones.ini" -chown $app:$app "/etc/$app/headphones.ini" +chmod 650 "$install_dir/headphones.ini" +chown $app:$app "$install_dir/headphones.ini" #================================================= # SETUP SYSTEMD diff --git a/scripts/remove b/scripts/remove index 2f8ec3b..768f74d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -46,16 +46,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." - -# Remove a directory securely -ynh_secure_remove --file="/etc/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 981394c..8ac2238 100644 --- a/scripts/restore +++ b/scripts/restore @@ -40,16 +40,6 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory chown -R $app:$app "$data_dir" -#================================================= -# RESTORE VARIOUS FILES -#================================================= -ynh_script_progression --message="Restoring various files..." - -ynh_restore_file --origin_path="/etc/$app/" - -chmod 600 "/etc/$app/headphones.ini" -chown $app:$app "/etc/$app/headphones.ini" - #================================================= # RESTORE SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index f31f59f..8f64dce 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -63,7 +63,7 @@ python3 -m venv $install_dir/venv #================================================= ynh_script_progression --message="Updating a configuration file..." -ynh_replace_string --match_string="^http_root = .*" --replace_string="http_root = $path" --target_file="/etc/$app/headphones.ini" +ynh_replace_string --match_string="^http_root = .*" --replace_string="http_root = $path" --target_file="$install_dir/headphones.ini" #================================================= # SETUP SYSTEMD