From 78b7a2a6aa6b2d493109dc1fe0b04382535d7dbb Mon Sep 17 00:00:00 2001 From: polytan02 Date: Sat, 7 Mar 2015 23:30:38 +0000 Subject: [PATCH] Automatic configuration --- manifest.json | 39 +++++++++++++++++++++++++++++---------- scripts/install | 31 ++++++++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 13 deletions(-) diff --git a/manifest.json b/manifest.json index 960d314..9adacd5 100644 --- a/manifest.json +++ b/manifest.json @@ -42,22 +42,41 @@ "default": "Yes" }, { - "name": "dp_pwd", - "type": "password", + "name": "admin", + "type": "name", "ask": { - "en": "Choose a password for phpBB MySQL database. Please note that the table and the user will be phpBB (case sensitive !)", - "fr": "Choisissez un mot de passe pour la base MySQL de phpBB. Veuillez noter que la table et l'utilisateur créé seront phpBB (sensible à la casse)" + "en": "Indicate phpBB admin username", + "fr": "Renseignez un nom pour l'admin phpBB" }, - "example": "my_strong_password" + "example": "phpBB_admin", + "default": "phpBB_admin" }, { - "name": "manual_config", + "name": "admin_pwd", + "type": "password", "ask": { - "en": "IMPORTANT : Manual configuration after installation by going the the phpBB path web addrees. Don't forget to rename or delete phpBB/install folder once the initial configuration is finished.", - "fr": "IMPORTANT : Configuration manuelle après installation en se rendant au chemin web de phpBB. N'oubliez pas de renommer ou supprimer le repertoire phpBB/install une fois que la configuration initiale est terminée" + "en": "Indicate phpBB admin password", + "fr": "Renseignez un mot de passe pour l'admin phpBB" }, - "choices": ["Yes", "Yes (You don't have a choice !)"], - "default": "Yes" + "example": "super_strong_admin_password" + }, + { + "name": "admin_email", + "type": "email", + "ask": { + "en": "Indicate phpBB admin email - Please make sure it exists on this server !", + "fr": "Renseignez un e-mail pour l'admin phpBB" + }, + "example": "admin@DOMAIN.TLD" + }, + { + "name": "lang", + "ask": { + "en": "Configure phpBB to use English ?", + "fr": "Configurer phpBB en Français ?" + }, + "choices": ["en", "fr"], + "default": "en" } ] } diff --git a/scripts/install b/scripts/install index 01dd3da..2fae02c 100644 --- a/scripts/install +++ b/scripts/install @@ -6,6 +6,10 @@ app=phpBB domain=$1 path=$2 is_public=$3 +admin=$4 +admin_pwd=$5 +admin_email=$6 +lang=$7 # Check domain/path availability sudo yunohost app checkurl $domain$path -a $app @@ -14,11 +18,9 @@ if [[ ! $? -eq 0 ]]; then fi db_user=$app -#db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p') -db_pwd=$4 +db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p') # Initialize database and store mysql password for upgrade -#sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e ../sources/SQL/mysql.initial.sql) sudo yunohost app initdb $db_user -p $db_pwd sudo yunohost app setting $app mysqlpwd -v $db_pwd @@ -34,6 +36,29 @@ sudo cp -a ../sources/french_language/* $final_path/ # Set permissions to rainloop directory sudo chown -R www-data:www-data $final_path +# Configuration of phpBB +sudo curl -k -X POST \ + -H "Host: $domain" \ + --data-urlencode "dbms=mysqli" \ + --data-urlencode "dbhost=localhost" \ + --data-urlencode "dbname=$db_user" \ + --data-urlencode "dbuser=$db_user" \ + --data-urlencode "dbpasswd=$db_pwd" \ + --data-urlencode "default_lang=$lang" \ + --data-urlencode "admin_name=$admin" \ + --data-urlencode "admin_pass1=$admin_pwd" \ + --data-urlencode "admin_pass2=$admin_pwd" \ + --data-urlencode "board_email=$admin_email" \ + --data-urlencode "server_protocol=https://" \ + --data-urlencode "server_name=$domain" \ + --data-urlencode "server_port=443" \ + --data-urlencode "script_path=$path" \ + --data-urlencode "submit=next" \ + "https://127.0.0.1/forum/install/index.php?mode=install&sub=final" > /dev/null 2>&1 + +# We need to rename the install folder +sudo mv $final_path/install $final_path/install_old + # Modify Nginx configuration file and copy it to Nginx conf directory sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf