diff --git a/manifest.json b/manifest.json index 1d08f05..30c509d 100755 --- a/manifest.json +++ b/manifest.json @@ -33,6 +33,11 @@ }, "example": "podcast.example.com" }, + { + "name": "admin", + "type": "user", + "example": "johndoe" + }, { "name": "is_public", "type": "boolean", @@ -41,6 +46,15 @@ "fr": "Si cette case est cochée, Castopod sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." }, "default": true + }, + { + "name": "password", + "type": "password", + "help": { + "en": "Use the help field to add an information for the admin about this question.", + "fr": "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question." + }, + "example": "Choose a password" } ] } diff --git a/scripts/install b/scripts/install index c1dd1b8..9d352db 100755 --- a/scripts/install +++ b/scripts/install @@ -23,6 +23,9 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" is_public=$YNH_APP_ARG_IS_PUBLIC +admin=$YNH_APP_ARG_ADMIN +password=$YNH_APP_ARG_PASSWORD +email=$(ynh_user_get_info --username=$admin --key=mail) app=$YNH_APP_INSTANCE_NAME @@ -44,6 +47,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= # CREATE A MYSQL DATABASE @@ -105,6 +109,21 @@ ynh_script_progression --message="Setuping a cron..." ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +#================================================= +# SETUP APPLICATION WITH CURL +#================================================= + +# Set the app as temporarily public for curl call +ynh_script_progression --message="Configuring SSOwat..." --weight=1 +# Making the app public for curl +ynh_permission_update --permission="main" --add="visitors" + +installUrl="/cp-install" + +# Installation with curl +ynh_script_progression --message="Finalizing installation..." --weight=1 +ynh_local_curl $installUrl "email=$email" "username=$admin" "password=$password" + #================================================= # GENERIC FINALIZATION #================================================= @@ -123,7 +142,7 @@ ynh_script_progression --message="Configuring permissions..." --weight=10 # Make app public if necessary or protect it if [ $is_public -eq 1 ] then - ynh_permission_update --permission="main" --add="visitors" + ynh_permission_update --permission="main" --remove="visitors" fi #=================================================