From 380c42d1bda8cb58dbca4f352aff9dd86b4c2ccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 12 Mar 2021 22:39:31 +0100 Subject: [PATCH] Testing (#22) * Change default storage path (#21) --- conf/config.default.json | 4 ++-- manifest.json | 2 +- scripts/backup | 2 +- scripts/change_url | 2 +- scripts/install | 9 +++++---- scripts/restore | 6 +++--- scripts/upgrade | 22 ++++++++++++++++++++-- 7 files changed, 33 insertions(+), 14 deletions(-) diff --git a/conf/config.default.json b/conf/config.default.json index fe73148..20be7cc 100644 --- a/conf/config.default.json +++ b/conf/config.default.json @@ -6,8 +6,8 @@ "SeedRatio": "", "uploadrate": "", "donecmdthreshold": "30s", - "watchdirectory": "/home/yunohost.__APP__/torrents", - "downloaddirectory": "/home/yunohost.__APP__/downloads", + "watchdirectory": "/home/yunohost.app/__APP__/torrents", + "downloaddirectory": "/home/yunohost.app/__APP__/downloads", "enableseeding": true, "enableupload": true, "incomingport": "__PEER_PORT__", diff --git a/manifest.json b/manifest.json index 74b6383..829e007 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Self-hosted remote torrent client", "fr": "Client torrent distant auto-hébergé" }, - "version": "1.2.15~ynh2", + "version": "1.2.15~ynh3", "url": "https://github.com/boypt/simple-torrent", "license": "AGPL-3.0-only", "maintainer": { diff --git a/scripts/backup b/scripts/backup index 50cf3c9..00bf0d9 100644 --- a/scripts/backup +++ b/scripts/backup @@ -41,7 +41,7 @@ ynh_backup --src_path="$final_path" # BACKUP DATA #================================================= -ynh_backup --src_path="/home/yunohost.$app" --is_big +ynh_backup --src_path="/home/yunohost.app/$app" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index f843b20..391f4b0 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -70,7 +70,7 @@ fi #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" #================================================= # MODIFY URL IN NGINX CONF diff --git a/scripts/install b/scripts/install index e5730cd..7e7a3ff 100644 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Configuring firewall..." --weight=0 +ynh_script_progression --message="Finding an available port..." --weight=0 # Find an available port port=$(ynh_find_port --port=3000) @@ -60,6 +60,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port # Find incoming port peers connect to peer_port=$(ynh_find_port --port=50007) # Open this port +ynh_script_progression --message="Configuring firewall..." --weight=1 ynh_exec_warn_less yunohost firewall allow Both $peer_port ynh_app_setting_set --app=$app --key=peer_port --value=$peer_port @@ -98,7 +99,7 @@ ynh_add_nginx_config # CREATE DIRECTORIES #================================================= -mkdir -p /home/yunohost.${app}/{torrents,downloads} +mkdir -p /home/yunohost.app/$app/{torrents,downloads} #================================================= # MODIFY A CONFIG FILE @@ -131,9 +132,9 @@ ynh_script_progression --message="Securing files and directories..." --weight=1 # Set permissions to app files chown -R $app: $final_path -chown -R $app: /home/yunohost.$app +chown -R $app: /home/yunohost.app chmod +x $final_path/$app -chmod -R 755 /home/yunohost.$app/{torrents,downloads} +chmod -R 755 /home/yunohost.app/$app/{torrents,downloads} #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/restore b/scripts/restore index fb13577..0c07e67 100644 --- a/scripts/restore +++ b/scripts/restore @@ -67,7 +67,7 @@ ynh_restore_file --origin_path="$final_path" #================================================= ynh_script_progression --message="Restoring $app data..." --weight=10 -ynh_restore_file --origin_path="/home/yunohost.$app" --not_mandatory +ynh_restore_file --origin_path="/home/yunohost.app/$app" --not_mandatory #================================================= # RECREATE THE DEDICATED USER @@ -84,9 +84,9 @@ ynh_script_progression --message="Restoring user rights..." # Set permissions to app files chown -R $app: $final_path -chown -R $app: /home/yunohost.$app +chown -R $app: /home/yunohost.app/$app chmod +x $final_path/$app -chmod -R 755 /home/yunohost.$app/{torrents,downloads} +chmod -R 755 /home/yunohost.app/$app/{torrents,downloads} #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 546983a..fe09aa9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -30,6 +30,18 @@ ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -91,6 +103,12 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config +#================================================= +# CREATE DIRECTORIES +#================================================= + +mkdir -p /home/yunohost.app/$app/{torrents,downloads} + #================================================= # CREATE DEDICATED USER #================================================= @@ -116,9 +134,9 @@ ynh_add_systemd_config ynh_script_progression --message="Securing files and directories..." chown -R $app: $final_path -chown -R $app: /home/yunohost.$app +chown -R $app: /home/yunohost.app/$app chmod +x $final_path/$app -chmod -R 755 /home/yunohost.$app/{torrents,downloads} +chmod -R 755 /home/yunohost.app/$app/{torrents,downloads} #================================================= # INTEGRATE SERVICE IN YUNOHOST