1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/phpbb_ynh.git synced 2024-09-03 19:56:36 +02:00

Automatic configuration

This commit is contained in:
polytan02 2015-03-07 23:30:38 +00:00
parent d27f39f2de
commit 78b7a2a6aa
2 changed files with 57 additions and 13 deletions

View file

@ -42,22 +42,41 @@
"default": "Yes" "default": "Yes"
}, },
{ {
"name": "dp_pwd", "name": "admin",
"type": "password", "type": "name",
"ask": { "ask": {
"en": "Choose a password for phpBB MySQL database. Please note that the table and the user will be phpBB (case sensitive !)", "en": "Indicate phpBB admin username",
"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)" "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": { "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.", "en": "Indicate phpBB admin password",
"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" "fr": "Renseignez un mot de passe pour l'admin phpBB"
}, },
"choices": ["Yes", "Yes (You don't have a choice !)"], "example": "super_strong_admin_password"
"default": "Yes" },
{
"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"
} }
] ]
} }

View file

@ -6,6 +6,10 @@ app=phpBB
domain=$1 domain=$1
path=$2 path=$2
is_public=$3 is_public=$3
admin=$4
admin_pwd=$5
admin_email=$6
lang=$7
# Check domain/path availability # Check domain/path availability
sudo yunohost app checkurl $domain$path -a $app sudo yunohost app checkurl $domain$path -a $app
@ -14,11 +18,9 @@ if [[ ! $? -eq 0 ]]; then
fi fi
db_user=$app 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=$(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
# Initialize database and store mysql password for upgrade # 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 initdb $db_user -p $db_pwd
sudo yunohost app setting $app mysqlpwd -v $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 # Set permissions to rainloop directory
sudo chown -R www-data:www-data $final_path 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 # Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf