diff --git a/scripts/_common.sh b/scripts/_common.sh index c2656dd..0b96083 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -31,7 +31,7 @@ exec_as() { eval $@ else # use sudo twice to be root and be allowed to use another user - sudo sudo -u "$USER" "$@" + sudo -u "$USER" "$@" fi } @@ -65,8 +65,8 @@ WARNING () { # Print on error output CHECK_SIZE () { # Check if enough disk space available on backup storage file_to_analyse=$1 - backup_size=$(sudo du --summarize "$file_to_analyse" | cut -f1) - free_space=$(sudo df --output=avail "/home/yunohost.backup" | sed 1d) + backup_size=$(du --summarize "$file_to_analyse" | cut -f1) + free_space=$(df --output=avail "/home/yunohost.backup" | sed 1d) if [ $free_space -le $backup_size ] then diff --git a/scripts/backup b/scripts/backup index 272454e..76fd1be 100644 --- a/scripts/backup +++ b/scripts/backup @@ -4,12 +4,7 @@ # IMPORT GENERIC HELPERS #================================================= -if [ ! -e _common.sh ]; then - # Fetch helpers file if not in current directory - cp ../settings/scripts/_common.sh ./_common.sh - chmod a+rx _common.sh -fi -source _common.sh +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/change_url b/scripts/change_url index 7499f2b..452bbdb 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -79,7 +79,7 @@ fi if [ $change_domain -eq 1 ] then ynh_delete_file_checksum "$nginx_conf_path" - sudo mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" fi @@ -90,4 +90,4 @@ fi # RELOAD NGINX #================================================= -sudo systemctl reload nginx +systemctl reload nginx diff --git a/scripts/remove b/scripts/remove index 4f370d4..a996d89 100644 --- a/scripts/remove +++ b/scripts/remove @@ -19,7 +19,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) db_name=$(ynh_app_setting_get $app db_name) -domain=$(ynh_app_setting_get "$app" domain) #================================================= # STANDARD REMOVE @@ -34,10 +33,9 @@ ynh_secure_remove "/var/www/$app" #================================================= # REMOVE NGINX AND PHP-FPM CONFIGURATION #================================================= -# Delete app directory and configurations -ynh_secure_remove --file="/var/www/${app}" + ynh_secure_remove --file="/etc/php5/fpm/pool.d/${app}.conf" -[[ -n $domain ]] && sudo ynh_secure_remove --file="/etc/nginx/conf.d/${domain}.d/${app}.conf" +ynh_secure_remove --file="/etc/nginx/conf.d/${domain}.d/${app}.conf" # Reload services systemctl restart php5-fpm diff --git a/scripts/restore b/scripts/restore index 839c269..fb9dda4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -4,12 +4,7 @@ # IMPORT GENERIC HELPERS #================================================= -if [ ! -e _common.sh ]; then - # Fetch helpers file if not in current directory - cp ../settings/scripts/_common.sh ./_common.sh - chmod a+rx _common.sh -fi -source _common.sh +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #=================================================