1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/piwigo_ynh.git synced 2024-09-03 20:06:03 +02:00

Fix upgrade when installed on domain root

This commit is contained in:
Jimmy Monin 2017-01-28 12:42:43 +01:00
parent 3cbb80be30
commit 4adda14d45
3 changed files with 18 additions and 7 deletions

View file

@ -27,3 +27,16 @@ extract_application() {
rm "$archive" rm "$archive"
sudo rsync -a "$TMPDIR"/*/* "$DESTDIR" sudo rsync -a "$TMPDIR"/*/* "$DESTDIR"
} }
# Fix path if needed
# usage: fix_patch PATH_TO_FIX
fix_path() {
local path=$1
if [ "${path:0:1}" != "/" ] && [ ${#path} -gt 0 ]; then
path="/$path"
fi
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then
path="${path:0:${#path}-1}"
fi
echo "$path"
}

View file

@ -32,12 +32,7 @@ ynh_app_setting_set "$app" is_public "$is_public"
ynh_app_setting_set "$app" language "$language" ynh_app_setting_set "$app" language "$language"
# Fix path if needed # Fix path if needed
if [ "${path:0:1}" != "/" ] && [ ${#path} -gt 0 ]; then path=$(fix_path $path)
path="/$path"
fi
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then
path="${path:0:${#path}-1}"
fi
# Check domain/path availability # Check domain/path availability
sudo yunohost app checkurl "${domain}${path}" -a "$app" \ sudo yunohost app checkurl "${domain}${path}" -a "$app" \

View file

@ -20,6 +20,9 @@ admin=$(ynh_app_setting_get "$app" admin)
is_public=$(ynh_app_setting_get "$app" is_public) is_public=$(ynh_app_setting_get "$app" is_public)
language=$(ynh_app_setting_get "$app" language) language=$(ynh_app_setting_get "$app" language)
# Fix path if needed
path=$(fix_path $path)
# Download and extract application # Download and extract application
extract_application .. extract_application ..
@ -39,7 +42,7 @@ sudo chmod 755 -R $src_path/galleries
# Modify Nginx configuration file and copy it to Nginx conf directory # Modify Nginx configuration file and copy it to Nginx conf directory
nginx_conf=../conf/nginx.conf nginx_conf=../conf/nginx.conf
sed -i "s@YNH_WWW_PATH@${path%/}@g" $nginx_conf sed -i "s@YNH_WWW_PATH@${path}@g" $nginx_conf
sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf