1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/z-push_ynh.git synced 2024-09-03 18:05:58 +02:00

Clarification on path variable

This commit is contained in:
polytan02 2017-01-18 01:10:48 +00:00
parent eccf48420a
commit a0a017dcb8

View file

@ -34,7 +34,7 @@ source /usr/share/yunohost/helpers
# Retrieve arguments
app=$YNH_APP_INSTANCE_NAME
domain=$YNH_APP_ARG_DOMAIN
path="/Microsoft-Server-ActiveSync"
path=$YNH_APP_ARG_PATH
# We check variables are not empty
CHECK_VAR () { # Vérifie que la variable n'est pas vide.
@ -45,6 +45,18 @@ CHECK_VAR () { # Vérifie que la variable n'est pas vide.
CHECK_VAR "$app" "app name not set"
# Check the path value and correct it (adds / at begining and removes it at the end)
CHECK_PATH () { # Vérifie la présence du / en début de path. Et son absence à la fin.
if [ "${path:0:1}" != "/" ]; then # Si le premier caractère n'est pas un /
path="/$path" # Ajoute un / en début de path
fi
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then # Si le dernier caractère est un / et que ce n'est pas l$
path="${path:0:${#path}-1}" # Supprime le dernier caractère
fi
}
CHECK_PATH;
# Check domain and path availibility
CHECK_DOMAINPATH () { # Vérifie la disponibilité du path et du domaine.
sudo yunohost app checkurl $domain$path -a $app