From 4c2910719aeddff9ea04aab71c1f81e088adf599 Mon Sep 17 00:00:00 2001 From: sys4-fr Date: Sat, 24 Mar 2018 20:10:33 +0100 Subject: [PATCH] Add postgresql option at installation time --- install.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 89ac702..f4988bf 100755 --- a/install.sh +++ b/install.sh @@ -26,6 +26,7 @@ usage() { echo "--ssh : Identifiants ssh." echo "--url : URL distante personnalisée." echo "--irrlicht | -i : Chemin personnalisé des sources irrlicht." + echo "--postgresql | -p : Si vous voulez que le serveur soit configuré avec postgresql" echo -e "\tSi l'option --ssh est passée en option, il s'agira du chemin distant." echo "Commandes :" echo -e "\t0.5 : Installation du serveur avec minetest-0.5.x. Suivez les instructions..." @@ -59,6 +60,19 @@ clean() { echo "clean install..." } +postgresql() { + echo "Les indications à fournir ci-après nécessite d'avoir configuré un serveur postgresql au préalable. (Ctrl-C) pour annuler." + read -p "Indiquez l'adresse de la base de données : " pg_url + read -p "Indiquez l'utilisateur de la BDD : " pg_user + read -p "Indiquez le mot de passe : " pg_password + read -p "Indiquez le nom de la BDD à créer : " pg_dbname + + echo "gameid = minetest_game" > worldmt.conf + echo "backend = postgresql" >> worldmt.conf + echo "psql_connection = \"host=$pg_url user=$pg_user password=$pg_password dbname=$pg_dbname\"" >> worldmt.conf + echo "psql_player_connection = \"host=$pg_url user=$pg_user password=$pg_password dbname=players-$pg_dbname\"" >> worldmt.conf +} + install_0.4() { if [[ -d server-0.4 ]]; then echo "Installation précédente détecté. Voulez-vous faire la mise à jour ?" @@ -349,7 +363,7 @@ irrlicht() { # -o : Options courtes # -l : options longues -OPT=$(getopt -o h,j:,i: -l help,url:,ssh:,makeopt:,irrlicht: -- "$@") +OPT=$(getopt -o h,p,j:,i: -l help,postgresql,url:,ssh:,makeopt:,irrlicht: -- "$@") # éclatement de $options en $1, $2... set -- $OPT @@ -361,6 +375,9 @@ while true; do -i|--irrlicht) irrlicht $2 shift 2;; + -p|--postgresql) + postgresql + shift;; --ssh) ssh $2 shift 2;;