diff --git a/scripts/backup b/scripts/backup index 117b790..50269b2 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,5 +1,8 @@ #!/bin/bash +# causes the shell to exit if any subcommand or pipeline returns a non-zero status +set -e + # The parameter $1 is the backup directory location dedicated to the app backup_dir=$1 @@ -11,12 +14,12 @@ path=$(sudo yunohost app setting $app path) # Copy the app files final_path="/var/www/$app" -sudo cp -a "$final_path" ./www +ynh_backup "$final_path" "./www" # Copy the conf files sudo mkdir -p ./conf -sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf ./conf/nginx.conf -sudo cp -a /etc/cron.d/$app ./conf/cron +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "./conf/nginx.conf" +ynh_backup "/etc/cron.d/$app" "./conf/cron" # Backup db root_pwd=$(sudo cat /etc/yunohost/mysql) diff --git a/scripts/install b/scripts/install index 51a1765..e778bf8 100644 --- a/scripts/install +++ b/scripts/install @@ -1,5 +1,8 @@ #!/bin/bash +# causes the shell to exit if any subcommand or pipeline returns a non-zero status +set -e + # Retrieve arguments domain=$1 path=$2 diff --git a/scripts/remove b/scripts/remove index 8dab262..7223deb 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,5 +1,4 @@ #!/bin/bash -set -e app=${!#} diff --git a/scripts/restore b/scripts/restore index ca1b8a0..4e0a85e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,5 +1,7 @@ #!/bin/bash -# This restore script is adapted to Yunohost >=2.4 + +# causes the shell to exit if any subcommand or pipeline returns a non-zero status +set -e # The parameter $1 is the backup directory location dedicated to the app backup_dir=$1 diff --git a/scripts/upgrade b/scripts/upgrade index cd5f10d..613a578 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,4 +1,6 @@ #!/bin/bash + +# causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e app=${!#}