8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 11:23:10 +00:00

More blabla on install_re2o.sh

This commit is contained in:
Maël Kervella 2018-05-15 21:27:06 +00:00
parent 54e378394f
commit 81588686f5

View file

@ -55,8 +55,8 @@ init=$(dialog --clear \
BACKTITLE="Re2o preconfiguration of the database" BACKTITLE="Re2o preconfiguration of the database"
MENU="Choose an option"
TITLE="Database engine" TITLE="Database engine"
MENU="Which engine should be used as the database ?"
OPTIONS=(1 "mysql" OPTIONS=(1 "mysql"
2 "postgresql") 2 "postgresql")
sql_bdd_type=$(dialog --clear \ sql_bdd_type=$(dialog --clear \
@ -73,11 +73,11 @@ clear
TITLE="Local extension to use (ex : example.net)" TITLE="Local extension"
INPUTBOX="The local extension to use (e.g. 'example.net'). This is used in the LDAP configuration."
extension_locale=$(dialog --title "$TITLE" \ extension_locale=$(dialog --title "$TITLE" \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
--inputbox "$TITLE" \ --inputbox "$INPUTBOX" \
$HEIGHT $WIDTH \ $HEIGHT $WIDTH \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
clear clear
@ -96,10 +96,12 @@ echo $ldap_dn
TITLE="SQL database location" TITLE="SQL location"
MENU="Where to install the SQL database ?
* 'Local' will setup everything automatically but is not recommended for production
* 'Remote' will ask you to manually perform some setup commands on the remote server)"
OPTIONS=(1 "Local" OPTIONS=(1 "Local"
2 "Remote") 2 "Remote")
sql_is_local=$(dialog --clear \ sql_is_local=$(dialog --clear \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
--title "$TITLE" \ --title "$TITLE" \
@ -110,39 +112,42 @@ sql_is_local=$(dialog --clear \
clear clear
TITLE="SQL database password" TITLE="SQL password"
INPUTBOX="The password to access the SQL database"
sql_password=$(dialog --title "$TITLE" \ sql_password=$(dialog --title "$TITLE" \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
--inputbox "$TITLE" $HEIGHT $WIDTH \ --inputbox "$INPUTBOX" $HEIGHT $WIDTH \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
clear clear
if [ $sql_is_local == 2 ] if [ $sql_is_local == 2 ]
then then
TITLE="Username to access the remote SQL database" TITLE="SQL username"
sql_login=$(dialog --title "$TITLE" \ INPUTBOX="The username to access the remote SQL database"
--backtitle "$BACKTITLE" \ sql_login=$(dialog --title "$TITLE" \
--inputbox "$TITLE" $HEIGHT $WIDTH \ --backtitle "$BACKTITLE" \
2>&1 >/dev/tty) --inputbox "$INPUTBOX" $HEIGHT $WIDTH \
clear 2>&1 >/dev/tty)
TITLE="Name of the SQL database" clear
sql_name=$(dialog --title "$TITLE" \ TITLE="SQL database name"
--backtitle "$BACKTITLE" \ INPUTBOX="The name of the remote SQL database"
--inputbox "$TITLE" $HEIGHT $WIDTH \ sql_name=$(dialog --title "$TITLE" \
2>&1 >/dev/tty) --backtitle "$BACKTITLE" \
clear --inputbox "$INPUTBOX" $HEIGHT $WIDTH \
TITLE="Host of the remote SQL database" 2>&1 >/dev/tty)
sql_host=$(dialog --title "$TITLE" \ clear
--backtitle "$BACKTITLE" \ TITLE="SQL host"
--inputbox "$TITLE" $HEIGHT $WIDTH \ INPUTBOX="The host of the remote SQL database"
2>&1 >/dev/tty) sql_host=$(dialog --title "$TITLE" \
clear --backtitle "$BACKTITLE" \
--inputbox "$INPUTBOX" $HEIGHT $WIDTH \
2>&1 >/dev/tty)
clear
else else
sql_name="re2o" sql_name="re2o"
sql_login="re2o" sql_login="re2o"
sql_host="localhost" sql_host="localhost"
fi fi
@ -151,10 +156,13 @@ fi
BACKTITLE="Re2o preconfiguration of the active directory" BACKTITLE="Re2o preconfiguration of the active directory"
TITLE="LDAP location" TITLE="LDAP location"
MENU="Where to install the LDAP ?
* 'Local' will setup everything automatically but is not recommended for production
* 'Remote' will ask you to manually perform some setup commands on the remote server)"
OPTIONS=(1 "Local" OPTIONS=(1 "Local"
2 "Remote") 2 "Remote")
ldap_is_local=$(dialog --clear \ ldap_is_local=$(dialog --clear \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
--title "$TITLE" \ --title "$TITLE" \
@ -164,26 +172,29 @@ ldap_is_local=$(dialog --clear \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
TITLE="LDAP password" TITLE="LDAP password"
INPUTBOX="The password to access the LDAP"
ldap_password=$(dialog --title "$TITLE" \ ldap_password=$(dialog --title "$TITLE" \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
--inputbox "$TITLE" $HEIGHT $WIDTH \ --inputbox "$INPUTBOX" $HEIGHT $WIDTH \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
clear clear
if [ $ldap_is_local == 2 ] if [ $ldap_is_local == 2 ]
then then
TITLE="CN entry for the admin user of the remote LDAP" TITLE="CN of amdin user"
INPUTBOX="The CN entry for the admin user of the remote LDAP"
ldap_cn=$(dialog --title "$TITLE" \ ldap_cn=$(dialog --title "$TITLE" \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
--inputbox "$TITLE" $HEIGHT $WIDTH \ --inputbox "$INPUTBOX" $HEIGHT $WIDTH \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
clear clear
TITLE="Host of the remote LDAP" TITLE="LDAP host"
INPUTBOX="The host of the remote LDAP"
ldap_host=$(dialog --title "$TITLE" \ ldap_host=$(dialog --title "$TITLE" \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
--inputbox "$TITLE" $HEIGHT $WIDTH \ --inputbox "$INPUTBOX" $HEIGHT $WIDTH \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
clear clear
TITLE="Is the TLS activated ?" TITLE="Activate TLS for remote LDAP ?"
OPTIONS=(1 "Yes" OPTIONS=(1 "Yes"
2 "No") 2 "No")
ldap_tls=$(dialog --title "$TITLE" \ ldap_tls=$(dialog --title "$TITLE" \
@ -205,18 +216,20 @@ fi
BACKTITLE="Re2o preconfiguration of the mail server" BACKTITLE="Re2o preconfiguration of the mail server"
TITLE="Host of the mail server to use"
TITLE="Mail server host"
INPUTBOX="The host of the mail server to use"
email_host=$(dialog --title "$TITLE" \ email_host=$(dialog --title "$TITLE" \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
--inputbox "$TITLE" \ --inputbox "$TITLE" \
$HEIGHT $WIDTH \ $HEIGHT $WIDTH \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
TITLE="Port of the mail server" TITLE="Mail server Port"
MENU="Which port (thus which protocol) to use to contact the mail server"
OPTIONS=(25 "SMTP" OPTIONS=(25 "SMTP"
465 "SMTPS" 465 "SMTPS"
587 "Submission") 587 "Submission")
email_port=$(dialog --clear \ email_port=$(dialog --clear \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
--title "$TITLE" \ --title "$TITLE" \
@ -226,16 +239,18 @@ email_port=$(dialog --clear \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
clear clear
TITLE="Re2o setup !"
MSGBOX="Setup of the required packages"
install_base=$(dialog --clear \ install_base=$(dialog --clear \
--title "Re2o setup!" \ --title "$TITLE" \
--msgbox "Installation des paquets de base" \ --msgbox "$MSGBOX" \
$HEIGHT $WIDTH \ $HEIGHT $WIDTH \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
echo "Setup of the required packages"
echo "Installation des paquets de base"
apt-get -y install python3-django python3-dateutil texlive-latex-base texlive-fonts-recommended python3-djangorestframework python3-django-reversion python3-pip libsasl2-dev libldap2-dev libssl-dev python3-crypto python3-git libjs-jquery libjs-jquery-uil libjs-jquery-timepicker libjs-bootstrap apt-get -y install python3-django python3-dateutil texlive-latex-base texlive-fonts-recommended python3-djangorestframework python3-django-reversion python3-pip libsasl2-dev libldap2-dev libssl-dev python3-crypto python3-git libjs-jquery libjs-jquery-uil libjs-jquery-timepicker libjs-bootstrap
pip3 install django-bootstrap3 django-ldapdb==0.9.0 django-macaddress pip3 install django-bootstrap3 django-ldapdb==0.9.0 django-macaddress
@ -380,10 +395,11 @@ python3 manage.py collectstatic
BACKTITLE="Web server" BACKTITLE="Web server"
TITLE="Web server to use" TITLE="Web server to use"
MENU="Which web server to install for accessing Re2o web frontend (automatic setup of nginx is not supported) ?"
OPTIONS=(1 "apache2" OPTIONS=(1 "apache2"
2 "nginx") 2 "nginx")
web_serveur=$(dialog --clear \ web_serveur=$(dialog --clear \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
--title "$TITLE" \ --title "$TITLE" \
@ -394,18 +410,19 @@ web_serveur=$(dialog --clear \
clear clear
TITLE="URL for accessing the web server (e.g. re2o.example.net). Be sure that this URL is accessible and correspond to a DNS entry if applicable." TITLE="Web URL"
INPUTBOX="URL for accessing the web server (e.g. re2o.example.net). Be sure that this URL is accessible and correspond to a DNS entry if applicable."
url_server=$(dialog --title "$TITLE" \ url_server=$(dialog --title "$TITLE" \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
--inputbox "$TITLE" \ --inputbox "$INPUTBOX" \
$HEIGHT $WIDTH \ $HEIGHT $WIDTH \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
clear clear
TITLE="Activate TLS with Let'Encrypt on the web server ?" TITLE="TLS on web server"
OPTIONS=(1 "Oui" MENU="Would you like to activate the TLS (with Let'Encrypt) on the web server ?"
2 "Non") OPTIONS=(1 "Yes"
2 "No")
is_tls=$(dialog --clear \ is_tls=$(dialog --clear \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
--title "$TITLE" \ --title "$TITLE" \
@ -441,7 +458,7 @@ then
service apache2 reload service apache2 reload
else else
TITLE="Web server setup" TITLE="Web server setup"
MSGBOX="Nginx non supporté, vous devrez installer manuellement" MSGBOX="Nginx automatic setup is not supported. Please configure it manually."
web_server=$(dialog --clear \ web_server=$(dialog --clear \
--title "$TITLE" \ --title "$TITLE" \
--msgbox "$MSGBOX" \ --msgbox "$MSGBOX" \
@ -472,10 +489,10 @@ main_function() {
then then
if [ ! -z "$2" ] if [ ! -z "$2" ]
then then
echo Installation du ldap echo "Installation du ldap"
setup_ldap $2 $3 setup_ldap $2 $3
else else
echo Arguments invalides ! echo "Arguments invalides !"
exit exit
fi fi
fi fi