diff --git a/scripts/install b/scripts/install index 6db8707..d22a2bb 100644 --- a/scripts/install +++ b/scripts/install @@ -1,12 +1,16 @@ #!/bin/bash # Exit on command errors and treat unset variables as an error - set -eu +# It also activate set -eu + source .fonctions + TRAP_ON + +# Initial data app=$YNH_APP_INSTANCE_NAME - rainloop_version='1.10.5.192' + rainloop_version=$(cat ../sources/rainloop_version) # Source app helpers - . /usr/share/yunohost/helpers + source /usr/share/yunohost/helpers # Retrieve arguments domain=$YNH_APP_ARG_DOMAIN @@ -16,17 +20,11 @@ ldap=$YNH_APP_ARG_LDAP lang=$YNH_APP_ARG_LANG -# Correct path - if [ "${path:0:1}" != "/" ]; then - path="/$path" - fi - if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then - path="${path:0:${#path}-1}" - fi +# Correct path using .fonctions +CHECK_PATH -# Check domain/path availability - sudo yunohost app checkurl "${domain}${path}" -a "$app" \ - || ynh_die "Path not available: ${domain}${path}" +# Check domain/path availability using .fonctions +CHECK_DOMAINPATH # Use 'rainloop' as database name and user dbuser=$app @@ -38,7 +36,9 @@ ynh_app_setting_set "$app" mysqlpwd "$dbpass" # Create the final path and copy sources + CHECK_FINALPATH final_path=/var/www/$app + rainloop_path=${final_path}/app sudo rm -rf $final_path diff --git a/scripts/upgrade b/scripts/upgrade index 678ea6d..9f8a3c4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,6 +22,7 @@ # Source app helpers source /usr/share/yunohost/helpers + source .fonctions # Retrieve arguments domain=$(ynh_app_setting_get "$app" domain) @@ -34,13 +35,8 @@ db_user=$app plugins=$(ynh_app_setting_get "$app" plugins) -# Correct path - if [ "${path:0:1}" != "/" ]; then - path="/$path" - fi - if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then - path="${path:0:${#path}-1}" - fi +# Correct path using .fonctions +CHECK_PATH # no update for db now...