From fa9e9cec9147d9ca2d13714494008db73fd83deb Mon Sep 17 00:00:00 2001 From: polytan02 Date: Sat, 24 Dec 2016 00:11:13 +0000 Subject: [PATCH] Add YnH admin user --- manifest.json | 8 ++++++++ scripts/install | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/manifest.json b/manifest.json index 7a208f6..e11672a 100644 --- a/manifest.json +++ b/manifest.json @@ -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": { diff --git a/scripts/install b/scripts/install index 2e60fac..25e1610 100755 --- a/scripts/install +++ b/scripts/install @@ -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 /