mirror of
https://github.com/YunoHost-Apps/bozon_ynh.git
synced 2024-09-03 18:16:09 +02:00
Clean & refractoring
This commit is contained in:
parent
a5661f86e9
commit
057daa700a
5 changed files with 10 additions and 13 deletions
|
@ -6,8 +6,8 @@
|
||||||
set -eu
|
set -eu
|
||||||
if [ ! -e _common.sh ]; then
|
if [ ! -e _common.sh ]; then
|
||||||
# Get the _common.sh file if it's not in the current directory
|
# Get the _common.sh file if it's not in the current directory
|
||||||
sudo cp ../settings/scripts/_common.sh ./_common.sh
|
cp ../settings/scripts/_common.sh ./_common.sh
|
||||||
sudo chmod a+rx _common.sh
|
chmod a+rx _common.sh
|
||||||
fi
|
fi
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
|
@ -93,7 +93,6 @@ myynh_add_fpm_config
|
||||||
|
|
||||||
# set temporary public access for curl call
|
# set temporary public access for curl call
|
||||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
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 ?)
|
# 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
|
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')
|
pathluaregex=$([ "$path_url" == "/" ] || echo "$path_url" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g')
|
||||||
regexList="${domainluaregex}${pathluaregex}/index%.php$","${domainluaregex}${pathluaregex}/index%.php%?p=.*$"
|
regexList="${domainluaregex}${pathluaregex}/index%.php$","${domainluaregex}${pathluaregex}/index%.php%?p=.*$"
|
||||||
ynh_app_setting_set "$app" protected_regex "$regexList"
|
ynh_app_setting_set "$app" protected_regex "$regexList"
|
||||||
yunohost app ssowatconf
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
set -u
|
set -u
|
||||||
if [ ! -e _common.sh ]; then
|
if [ ! -e _common.sh ]; then
|
||||||
# Get the _common.sh file if it's not in the current directory
|
# Get the _common.sh file if it's not in the current directory
|
||||||
sudo cp ../settings/scripts/_common.sh ./_common.sh
|
cp ../settings/scripts/_common.sh ./_common.sh
|
||||||
sudo chmod a+rx _common.sh
|
chmod a+rx _common.sh
|
||||||
fi
|
fi
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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"
|
phpfpm_conf="/etc/php5/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
# create a full backup (core+datas) if app installed
|
# 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
|
ynh_app_setting_set "$app" backup_core_only 0
|
||||||
app_bck=${app//_/-}
|
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
|
echo "BoZon fully backuped." >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
set -eu
|
set -eu
|
||||||
if [ ! -e _common.sh ]; then
|
if [ ! -e _common.sh ]; then
|
||||||
# Fetch helpers file if not in current directory
|
# Fetch helpers file if not in current directory
|
||||||
sudo cp ../settings/scripts/_common.sh ./_common.sh
|
cp ../settings/scripts/_common.sh ./_common.sh
|
||||||
sudo chmod a+rx _common.sh
|
chmod a+rx _common.sh
|
||||||
fi
|
fi
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
@ -61,5 +61,5 @@ fi
|
||||||
myynh_set_permissions
|
myynh_set_permissions
|
||||||
|
|
||||||
# restart services
|
# restart services
|
||||||
sudo systemctl reload php5-fpm
|
systemctl reload php5-fpm
|
||||||
sudo systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
|
@ -81,7 +81,6 @@ then
|
||||||
else
|
else
|
||||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||||
fi
|
fi
|
||||||
yunohost app ssowatconf
|
|
||||||
|
|
||||||
# Purge php sessions stored in /var/lib/php5/sessions
|
# Purge php sessions stored in /var/lib/php5/sessions
|
||||||
[ -x /usr/lib/php5/sessionclean ] && /usr/lib/php5/sessionclean
|
[ -x /usr/lib/php5/sessionclean ] && /usr/lib/php5/sessionclean
|
||||||
|
|
Loading…
Reference in a new issue