From 32d3690e906c7173a8a147bdec6ffbfd08812f76 Mon Sep 17 00:00:00 2001 From: Moul Date: Fri, 24 Jun 2016 11:57:31 +0200 Subject: [PATCH] [enh] retrieve admin argument and store it. --- manifest.json | 11 ++++++++++- scripts/install | 5 +++++ scripts/upgrade | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 16c5925..2f0a308 100644 --- a/manifest.json +++ b/manifest.json @@ -92,7 +92,16 @@ }, "example": "50", "default": "50" - } + }, + { + "name": "admin", + "type": "user", + "ask": { + "en": "Administrator. Must a YunoHost user.", + "fr": "Administrateur. Ce doit être un utilisateur YunoHost" + }, + "example": "jon doe" + } ] } } diff --git a/scripts/install b/scripts/install index e0fde07..f7383bc 100755 --- a/scripts/install +++ b/scripts/install @@ -12,6 +12,7 @@ sync_node=$YNH_APP_ARG_SYNC_NODE sync_port=$YNH_APP_ARG_SYNC_PORT salt=$YNH_APP_ARG_SALT password=$YNH_APP_ARG_PASSWORD +admin=$YNH_APP_ARG_ADMIN cpu=`bc -l <<< "scale=2; $YNH_APP_ARG_CPU/100"` version=$(cat ../conf/upstream_version) @@ -35,6 +36,9 @@ else ynh_die "Node $sync_node:$sync_port is not available" 2 fi +# Check the admin exists in YunoHost users +ynh_user_exists $admin + # Get CPU architecture and check it arch=$(uname -m) if [ $arch == "x86_64" ]; then @@ -50,6 +54,7 @@ sudo yunohost firewall allow TCP $port > /dev/null 2>&1 # Store config on YunoHost instance ynh_app_setting_set $app port $port ynh_app_setting_set $app arch $arch +ynh_app_setting_set "$app" admin "$admin" # Retrieve debian package and install it wget -nc --quiet https://github.com/duniter/duniter/releases/download/$version/duniter-$version-linux-$arch.deb -P /tmp diff --git a/scripts/upgrade b/scripts/upgrade index a8fb251..ffe8edd 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -13,6 +13,7 @@ domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) port=$(ynh_app_setting_get "$app" port) arch=$(ynh_app_setting_get "$app" arch) +admin=$(ynh_app_setting_get "$app" admin) version=$(cat ../conf/upstream_version) # Check CPU arch