Use getop for helpers

This commit is contained in:
Josué Tille
2019-08-01 14:01:59 +02:00
parent 7f57b92170
commit c09462555a
6 changed files with 19 additions and 20 deletions

View File

@ -20,16 +20,15 @@ path_url=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
# Check domain/path availability
ynh_webpath_available $domain $path_url || ynh_die "$domain is not available as domain, please use an other domain."
ynh_webpath_register $app $domain $path_url
# Register (book) web path
ynh_webpath_register --app $app --domain $domain --path_url $path_url
# Check user parameter
ynh_user_exists "$admin" \
|| ynh_die "The chosen admin user does not exist."
|| ynh_die --message "The chosen admin user does not exist."
# Check Final Path availability
test ! -e "$final_path" || ynh_die "This path already contains a folder"
test ! -e "$final_path" || ynh_die --message "This path already contains a folder"
# Generate random password and key
dbpass=$(ynh_string_random)
@ -63,7 +62,7 @@ ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
# We can't use the official helper (for now) because we need to set the shell for the login
test getent passwd "$app" &>/dev/null || \
useradd -d "$DATADIR" --system --user-group "$app" --shell /bin/bash || \
ynh_die "Unable to create $app system account"
ynh_die --message "Unable to create $app system account"
# Should be replaced by this when getops is available in the helper ynh_system_user_create (probably in Yunohost 3.5)
# ynh_system_user_create --username= $app --home_dir=/opt/yunohost/$app --use_shell