From 6151022119ac2ff03577b6a13dcd1d98e2223f94 Mon Sep 17 00:00:00 2001 From: scith Date: Tue, 6 Dec 2016 15:11:20 +0100 Subject: [PATCH] Fix for package_check --- scripts/install | 16 +++++++++++----- scripts/restore | 12 ++++++------ scripts/upgrade | 11 ++--------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/scripts/install b/scripts/install index 4b48382..dfd10b6 100644 --- a/scripts/install +++ b/scripts/install @@ -13,10 +13,17 @@ app=$YNH_APP_INSTANCE_NAME path=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC -# Remove trailing "/" for next commands - path=${path%/} +# Correct path + if [ "${path:0:1}" != "/" ]; then + path="/$path" + fi + if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then + path="${path:0:${#path}-1}" + fi # Save app settings + ynh_app_setting_set "$domain" domain "$domain" + ynh_app_setting_set "$path" path "$path" ynh_app_setting_set "$app" is_public "$is_public" # Check domain/path availability @@ -24,8 +31,8 @@ app=$YNH_APP_INSTANCE_NAME || ynh_die "Path not available: ${domain}${path}" # Download source - sudo wget https://raw.githubusercontent.com/keeweb/keeweb/gh-pages/index.html - sudo wget https://raw.githubusercontent.com/keeweb/keeweb/gh-pages/manifest.appcache + sudo wget -q https://raw.githubusercontent.com/keeweb/keeweb/gh-pages/index.html + sudo wget -q https://raw.githubusercontent.com/keeweb/keeweb/gh-pages/manifest.appcache sudo sed -i.bak 's/(no-config)/config.json/g' index.html # Copy source files @@ -43,7 +50,6 @@ app=$YNH_APP_INSTANCE_NAME # If app is public, add url to SSOWat conf as skipped_uris if [[ $is_public -eq 1 ]]; then - # unprotected_uris allows SSO credentials to be passed anyway. ynh_app_setting_set "$app" unprotected_uris "/" fi diff --git a/scripts/restore b/scripts/restore index 4b7247b..4ff887f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -12,9 +12,12 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) -# Check domain/path availability - sudo yunohost app checkurl "${domain}${path}" -a "$app" \ - || ynh_die "Path not available: ${domain}${path}" +# Restore NGINX configuration + conf=/etc/nginx/conf.d/$domain.d/$app.conf + if [ -f $conf ]; then + ynh_die "There is already a nginx conf file at this path: $conf" + fi + sudo cp -a $backup_dir/nginx.conf $conf # Restore sources & data src_path="/var/www/${app}" @@ -23,8 +26,5 @@ app=$YNH_APP_INSTANCE_NAME # Restore permissions to app files sudo chown -R root: "$src_path" -# Restore NGINX configuration - sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf" - # Restart webserver sudo service nginx reload diff --git a/scripts/upgrade b/scripts/upgrade index c1fe3ef..fbeae83 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,17 +12,10 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) is_public=$(ynh_app_setting_get "$app" is_public) - -# Remove trailing "/" for next commands - path=${path%/} - -# Check domain/path availability - sudo yunohost app checkurl "${domain}${path}" -a "$app" \ - || ynh_die "Path not available: ${domain}${path}" # Download source - sudo wget https://raw.githubusercontent.com/keeweb/keeweb/gh-pages/index.html - sudo wget https://raw.githubusercontent.com/keeweb/keeweb/gh-pages/manifest.appcache + sudo wget -q https://raw.githubusercontent.com/keeweb/keeweb/gh-pages/index.html + sudo wget -q https://raw.githubusercontent.com/keeweb/keeweb/gh-pages/manifest.appcache sudo sed -i.bak 's/(no-config)/config.json/g' index.html # Copy source files