From 057daa700abc16bb5583bdee703a92d10990aead Mon Sep 17 00:00:00 2001 From: ewilly Date: Fri, 22 Sep 2017 19:55:09 +0200 Subject: [PATCH] Clean & refractoring --- scripts/backup | 4 ++-- scripts/install | 2 -- scripts/remove | 8 ++++---- scripts/restore | 8 ++++---- scripts/upgrade | 1 - 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/scripts/backup b/scripts/backup index bcb2b3a..142b445 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,8 +6,8 @@ set -eu if [ ! -e _common.sh ]; then # Get the _common.sh file if it's not in the current directory - sudo cp ../settings/scripts/_common.sh ./_common.sh - sudo chmod a+rx _common.sh + cp ../settings/scripts/_common.sh ./_common.sh + chmod a+rx _common.sh fi source _common.sh source /usr/share/yunohost/helpers diff --git a/scripts/install b/scripts/install index e3bc4bf..9ffd6ba 100644 --- a/scripts/install +++ b/scripts/install @@ -93,7 +93,6 @@ myynh_add_fpm_config # set temporary public access for curl call ynh_app_setting_set "$app" unprotected_uris "/" -yunohost app ssowatconf # fill the superadmin creation form (helper ynh_local_curl doesn't work due to --data vs --data-urlencode ?) curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 https://localhost"$path_url"/ > /dev/null 2>&1 @@ -113,5 +112,4 @@ then pathluaregex=$([ "$path_url" == "/" ] || echo "$path_url" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g') regexList="${domainluaregex}${pathluaregex}/index%.php$","${domainluaregex}${pathluaregex}/index%.php%?p=.*$" ynh_app_setting_set "$app" protected_regex "$regexList" - yunohost app ssowatconf fi diff --git a/scripts/remove b/scripts/remove index 97d0de9..db99523 100644 --- a/scripts/remove +++ b/scripts/remove @@ -5,8 +5,8 @@ set -u if [ ! -e _common.sh ]; then # Get the _common.sh file if it's not in the current directory - sudo cp ../settings/scripts/_common.sh ./_common.sh - sudo chmod a+rx _common.sh + cp ../settings/scripts/_common.sh ./_common.sh + chmod a+rx _common.sh fi source _common.sh source /usr/share/yunohost/helpers @@ -25,10 +25,10 @@ nginx_conf="/etc/nginx/conf.d/$domain.d/$app.conf" phpfpm_conf="/etc/php5/fpm/pool.d/$app.conf" # create a full backup (core+datas) if app installed -if [ $(sudo yunohost app list -i -f "$app" | wc -l) -gt 1 ]; then +if [ $(yunohost app list -i -f "$app" | wc -l) -gt 1 ]; then ynh_app_setting_set "$app" backup_core_only 0 app_bck=${app//_/-} - sudo yunohost backup create --ignore-system --apps "$app" --name "${app_bck}_$(date '+%Y%m%d-%H%M%S')" + yunohost backup create --ignore-system --apps "$app" --name "${app_bck}_$(date '+%Y%m%d-%H%M%S')" echo "BoZon fully backuped." >&2 fi diff --git a/scripts/restore b/scripts/restore index f51791e..fd155eb 100644 --- a/scripts/restore +++ b/scripts/restore @@ -7,8 +7,8 @@ set -eu if [ ! -e _common.sh ]; then # Fetch helpers file if not in current directory - sudo cp ../settings/scripts/_common.sh ./_common.sh - sudo chmod a+rx _common.sh + cp ../settings/scripts/_common.sh ./_common.sh + chmod a+rx _common.sh fi source _common.sh source /usr/share/yunohost/helpers @@ -61,5 +61,5 @@ fi myynh_set_permissions # restart services -sudo systemctl reload php5-fpm -sudo systemctl reload nginx +systemctl reload php5-fpm +systemctl reload nginx diff --git a/scripts/upgrade b/scripts/upgrade index ab93ebb..3ea07e7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -81,7 +81,6 @@ then else ynh_app_setting_set "$app" unprotected_uris "/" fi -yunohost app ssowatconf # Purge php sessions stored in /var/lib/php5/sessions [ -x /usr/lib/php5/sessionclean ] && /usr/lib/php5/sessionclean