mirror of
https://github.com/YunoHost-Apps/cops_ynh.git
synced 2024-09-03 18:25:57 +02:00
Add YnH admin user
This commit is contained in:
parent
ad76841388
commit
fa9e9cec91
2 changed files with 16 additions and 0 deletions
|
@ -41,6 +41,14 @@
|
|||
"example": "/cops",
|
||||
"default": "/cops"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose the COPS administrator (must be an existing YunoHost user)",
|
||||
"fr": "Choisissez l'administrateur de COPS (doit être un utilisateur YunoHost existant)"
|
||||
},
|
||||
"example": "homer"
|
||||
{
|
||||
"name": "calibre",
|
||||
"ask": {
|
||||
|
|
|
@ -14,6 +14,7 @@ source /usr/share/yunohost/helpers
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
runninguser=$YNH_APP_ARG_RUNNINGUSER
|
||||
calibre=$YNH_APP_ARG_CALIBRE
|
||||
|
@ -30,6 +31,13 @@ CHECK_VAR () { # Vérifie que la variable n'est pas vide.
|
|||
|
||||
CHECK_VAR "$app" "app name not set"
|
||||
|
||||
# Check admin user
|
||||
CHECK_USER () { # Vérifie la validité de l'user admin
|
||||
# $1 = Variable de l'user admin.
|
||||
ynh_user_exists "$1" || (echo "Wrong admin" >&2 && false)
|
||||
}
|
||||
CHECK_USER "$admin"
|
||||
|
||||
# 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 /
|
||||
|
|
Loading…
Reference in a new issue