diff --git a/scripts/.fonctions b/scripts/.fonctions index 629e49e..7cfcd41 100644 --- a/scripts/.fonctions +++ b/scripts/.fonctions @@ -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" diff --git a/scripts/install b/scripts/install index d8e29dd..68f933f 100644 --- a/scripts/install +++ b/scripts/install @@ -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.