From dc45c47e852e27105dfd574dea0f5ec82756070b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Tue, 17 May 2016 22:13:59 +0200 Subject: [PATCH] [fix] Retrieve app settings at upgrade and harden set options --- scripts/backup | 6 +++--- scripts/install | 4 ++-- scripts/remove | 3 +-- scripts/restore | 4 ++-- scripts/upgrade | 11 +++++------ 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/scripts/backup b/scripts/backup index 4e16b53..e9f0027 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,7 +1,7 @@ #!/bin/bash -# causes the shell to exit if any subcommand or pipeline returns a non-zero status -set -e +# Exit on command errors and treat unset variables as an error +set -eu # Source YNH helpers . /usr/share/yunohost/helpers @@ -22,4 +22,4 @@ ynh_backup "/usr/share/transmission" "sources" # Copy configuration files ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf" -ynh_backup "/etc/transmission-daemon/settings.json" "conf/transmission.json" \ No newline at end of file +ynh_backup "/etc/transmission-daemon/settings.json" "conf/transmission.json" diff --git a/scripts/install b/scripts/install index 0c028ce..23ca6e3 100644 --- a/scripts/install +++ b/scripts/install @@ -1,7 +1,7 @@ #!/bin/bash -# causes the shell to exit if any subcommand or pipeline returns a non-zero status -set -e +# Exit on command errors and treat unset variables as an error +set -eu # Get app instance name app=$YNH_APP_INSTANCE_NAME diff --git a/scripts/remove b/scripts/remove index 7df99c9..3db43c4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,6 +22,5 @@ sudo apt-get remove -y -qq transmission-daemon # sudo rm -rf /usr/share/transmission # sudo rm -rf /etc/transmission-daemon/settings.json -# Reload nginx and ssowatconf +# Reload nginx sudo service nginx reload -sudo yunohost app ssowatconf diff --git a/scripts/restore b/scripts/restore index 7122f3b..a940637 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,7 +1,7 @@ #!/bin/bash -# causes the shell to exit if any subcommand or pipeline returns a non-zero status -set -e +# Exit on command errors and treat unset variables as an error +set -eu # Source YNH helpers . /usr/share/yunohost/helpers diff --git a/scripts/upgrade b/scripts/upgrade index 56d008a..6f26b67 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,13 +1,14 @@ +#!/bin/bash -# causes the shell to exit if any subcommand or pipeline returns a non-zero status -set -e +# Exit on command errors and treat unset variables as an error +set -eu # Get app instance name app=$YNH_APP_INSTANCE_NAME # Retrieve arguments -domain=$YNH_APP_ARG_DOMAIN -path=$YNH_APP_ARG_PATH +domain=$(sudo yunohost app setting "$app" domain) +path=$(sudo yunohost app setting "$app" path) # Remove trailing "/" for next commands path=${path%/} @@ -38,8 +39,6 @@ if ! grep 'toolbar-downloads' /usr/share/transmission/web/index.html --quiet; th sudo sed -i "s@
@
@g" /usr/share/transmission/web/index.html fi - - # Configure Nginx and reload sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf