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

Ajouter la fonction CHECK_VAR

This commit is contained in:
magikcypress 2017-03-16 14:49:30 +01:00
parent dd78dad684
commit e8ea9f2bb2
2 changed files with 7 additions and 0 deletions

View file

@ -10,6 +10,12 @@ YNH_VERSION () { # Renvoi le numéro de version de la moulinette Yunohost
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
}
CHECK_VAR () { # Verifies that the variable is not empty.
# $1 = Variable to be checked
# $2 = Display text on error
test -n "$1" || (echo "$2" >&2 && false)
}
CHECK_USER () { # Vérifie la validité de l'user admin
# $1 = Variable de l'user admin.
ynh_user_exists "$1" || ynh_die "Wrong user"

View file

@ -39,6 +39,7 @@ app=$YNH_APP_INSTANCE_NAME
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
#=================================================
CHECK_VAR "$app" "app name not set"
CHECK_USER "$admin_prestashop" # Vérifie la validité de l'user admin
path=$(ynh_normalize_url_path $path) # Vérifie et corrige la syntaxe du path.
CHECK_DOMAINPATH # Vérifie la disponibilité du path et du domaine.