diff --git a/scripts/install b/scripts/install index 120046b..98d5708 100644 --- a/scripts/install +++ b/scripts/install @@ -1,8 +1,14 @@ #!/bin/bash +# Exit on command errors and treat unset variables as an error +set -eu + # Define app app=phpsysinfo +# Source YunoHost helpers +. /usr/share/yunohost/helpers + # Retrieve arguments domain=$1 path=$2 @@ -22,7 +28,7 @@ if [[ ! $? -eq 0 ]]; then fi # Copy files to the right place -final_path=/var/www/phpsysinfo +final_path=/var/www/$app sudo mkdir -p $final_path sudo cp -a ../sources/* $final_path diff --git a/scripts/remove b/scripts/remove index 448944e..0e0402e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,5 +1,11 @@ #!/bin/bash +# Exit on command errors and treat unset variables as an error +set -eu + +# Source YunoHost helpers +. /usr/share/yunohost/helpers + # Define app app=phpsysinfo @@ -10,7 +16,7 @@ admin=$(ynh_app_setting_get "$app" admin) is_public=$(ynh_app_setting_get "$app" is_public) # Remove sources -sudo rm -rf /var/www/phpsysinfo +sudo rm -rf /var/www/$app # Remove configuration files sudo rm -f /etc/nginx/conf.d/$domain.d/phpsysinfo.conf diff --git a/scripts/upgrade b/scripts/upgrade index cc1f786..266aad5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1 +1,7 @@ -#!/bin/bash \ No newline at end of file +#!/bin/bash + +# Exit on command errors and treat unset variables as an error +set -eu + +# Source YunoHost helpers +. /usr/share/yunohost/helpers \ No newline at end of file