diff --git a/manifest.json b/manifest.json index c86f9da..dd32066 100644 --- a/manifest.json +++ b/manifest.json @@ -71,6 +71,24 @@ }, "choices": ["Stable","Latest"], "default": "Stable" + }, + { + "name": "admin", + "type": "user", + "ask": { + "en": "Choose an admin user for BoZoN", + "fr": "Choisissez un administrateur pour BoZoN" + }, + "example": "homer" + }, + { + "name": "password", + "type": "password", + "ask": { + "en": "Choose an admin password for BoZoN", + "fr": "Choisissez un mot de passe administrateur pour BoZoN" + }, + "example": "super_secret_password" } ] } diff --git a/scripts/install b/scripts/install index 11944c9..ced092d 100644 --- a/scripts/install +++ b/scripts/install @@ -10,6 +10,8 @@ is_public=$3 default_lang=$4 filesize=$5 version=$6 +admin=$7 +password=$8 # definie useful vars app=bozon @@ -81,6 +83,21 @@ sudo sed -i "s@YNH_EXAMPLE_FOLDER@$folder_path@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf +# create the superadmin +## set temporary public access +sudo yunohost app setting $app unprotected_uris -v "/" +## start app +sudo service nginx reload +sudo yunohost app ssowatconf +## fill the superadmin creation form +curl_path=$([ "$path" == "/" ] || echo $path) +curl -k -X POST \ + -d creation="1" \ + -d login=$admin \ + -d pass=$password \ + -d confirm=$password \ + https://$domain$curl_path/index.php?p=admin > /dev/null 2>&1 + # if app is private, remove url to SSOWat conf from skipped_uris if [ "$is_public" = "No" ]; then