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:
parent
dd78dad684
commit
e8ea9f2bb2
2 changed files with 7 additions and 0 deletions
|
@ -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)
|
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
|
CHECK_USER () { # Vérifie la validité de l'user admin
|
||||||
# $1 = Variable de l'user admin.
|
# $1 = Variable de l'user admin.
|
||||||
ynh_user_exists "$1" || ynh_die "Wrong user"
|
ynh_user_exists "$1" || ynh_die "Wrong user"
|
||||||
|
|
|
@ -39,6 +39,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
# 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
|
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.
|
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.
|
CHECK_DOMAINPATH # Vérifie la disponibilité du path et du domaine.
|
||||||
|
|
Loading…
Add table
Reference in a new issue