5echo "#==== Tiledviz installation script. ==="
6echo "If you want to use graphical installation, you need to install zenity package on your system,"
7echo "and set installX11=true in envTiledViz on your TiledViz source root, OK ?"
12# if asked installX11 in ./envTiledViz rerun with graphical progress bar.
13if ( $installX11 ) && [ X"$GraphicalInstall" != Xtrue ]; then
14 export GraphicalInstall=true
15 echo "Restart with graphical progression bar."
17 ( ./install.sh $UseLastEnv ) | zenity --progress --title="Progress Status" --text="First Task" --percentage=0 --auto-kill
24echo "# Test Docker rights"
28# Build Virtualenv for TVSecure
29# if UseLastEnv is null, build a new environement
30if [ X"$UseLastEnv" == X"" ]; then
31 echo "#==== Build new Virtualenv for TVSecure ===="
32 export DATE=$(date +%F_%H-%M-%S)
35 mkdir TiledVizEnv_${DATE}
36 python3 -m venv TiledVizEnv_${DATE}
37 source TiledVizEnv_${DATE}/bin/activate
40 echo "#==== Copy TiledViz env in .cache ===="
41 [ ! -d $HOME/.cache ] && mkdir $HOME/.cache
42 sed -e "s&DATE=.*&DATE=$DATE&" envTiledViz > $HOME/.cache/envTiledViz
43 chmod 600 $HOME/.cache/envTiledViz
46 ls -la $HOME/.cache/envTiledViz
47 source $HOME/.cache/envTiledViz
48 echo "# Build Env OK."
51 echo "#==== Retreive old configuration ===="
52 OLDENV=$(find . -maxdepth 1 -type d -name "TiledVizEnv_*" |tail -1)
53 export DATE_ENV=$(echo $OLDENV |sed -e 's&\./TiledVizEnv_&&')
54 source $OLDENV/bin/activate
57 ls -la $HOME/.cache/envTiledViz
58 source $HOME/.cache/envTiledViz
59 if [ ${DATE_ENV} != ${DATE} ]; then
60 echo "#Error restart install : DATEs not equal ${DATE_ENV} != ${DATE}."
64 echo "# Retrieve Env OK."
69echo "#===== Enable FirewallT Tiledviz ====="
71if ( $installX11 ); then
72 zenity --question --title "TiledViz firewall" --text " Activate firewallT for Tiledviz ?"
74 [[ $firewallT == 0 ]] && firewallT=y || firewallT=n
76 echo "Activate firewallT for Tiledviz ? : ('n' or 'y')"
78 [[ $firewallT == y || $firewallT == n ]] && echo "Valid Input" || echo "Invalid Input"
81echo "#==== Install environment ===="
82TiledVizEnv_$DATE/bin/python3 -m pip install --upgrade pip
84pip3 install -r requirements.txt
89echo "#==== Get noVNC ===="
96echo "#==== Get websockify ===="
98git clone https://github.com/novnc/websockify
103# Launch postgresql docker
104echo "#==== Prepare postgresql docker ===="
105if ( $installX11 ); then
106 Outz=$(zenity --width=600 --forms --title="Postgres DB" \
107 --text="Create Postgres Docker."\
108 --add-entry="Docker name (default: ${postgresNAME})" --add-entry="External PORT (default: ${POSTGRES_PORT})" --add-password="Password (forbiden '@', '&', '/', '|')")
109 $(echo $Outz | sed -e 's&\([^|]*\)|\([^|]*\)|\([^|]*\)&export POSTG_NAME="\1" export POSTG_PORT="\2" export password="\3"&')
111 echo "Please give the Docker name of PostGresQL DB (default: ${postgresNAME})."
113 echo "Please give its external PORT (default: ${POSTGRES_PORT})."
116 echo "Please give a password for your postgresql DB : (forbiden '@', '/', '|' !)"
119[ X"$POSTG_NAME" == X ] && export POSTG_NAME=$postgresNAME
120[ X"$POSTG_PORT" == X ] && export POSTG_PORT=$POSTGRES_PORT
121replpass=$( echo $password | sed -e "s|\&|\\\&|g" -e 's|"||g' )
123sed -e "s&${postgresNAME}&$POSTG_NAME&" \
124 -e "s&${POSTGRES_PORT}&$POSTG_PORT&" \
125 -e "s|your_postgres_password|$replpass|" \
126 -i $HOME/.cache/envTiledViz
129echo "#==== Copy tiledViz.conf in $HOME/.tiledviz cache dir ===="
131cp tiledviz.conf $HOME/.tiledviz
132[[ $firewallT == y ]] && sed -e "s|FirewallT=False|FirewallT=True|" -i $HOME/.tiledviz/tiledviz.conf
135echo "#=== Web Server URL ==="
136if ( $installX11 ); then
137 webserver=$(zenity --forms --title="Web server informations" --text="SSL web server.domain name" --add-entry="Server name" --add-entry="Domain extension" )
138 $(echo $webserver |sed -e 's&\([^|]*\)|\([^|]*\)&export SERVER_NAME="\1" export DOMAIN="\2"&')
140 echo "Please give a SERVER.DOMAIN for your SSL web server"
142 IFS='.' read -r -a webline <<<$myweb
145 serv="${webline[@]: 0:$((${#webline[*]}-2))}"
146 SERVER_NAME=$(echo $serv |sed -e "s/ /./g")
147 DOMAIN=${webline[${#webline[*]}-2]}.${webline[${#webline[*]}-1]}
153if ( $installX11 ); then
154 Outz=$(zenity --width=600 --forms --title="Web connections informations" \
155 --text="SSL, SMTP, MAIL ( outgoing mail server for 2FA )."\
156 --add-entry="SSL PUBLIC key path" --add-entry="SSL PRIVATE key path" --add-entry="TiledViz email.")
157 $(echo $Outz | sed -e 's&\([^|]*\)|\([^|]*\)|\([^|]*\)&export SSLpublic="\1" export SSLprivate="\2" export FROM_EMAIL="\3"&')
159 Outz=$(zenity --width=600 --forms --title="SMTP server for some TiledSet cases" \
160 --add-entry="SMTP server address (optionnal)" \
161 --add-entry="SMTP server PORT" \
162 --add-entry="SMTP server username" \
163 --add-password="SMTP server password" )
164 $(echo $Outz | sed -e 's&\([^|]*\)|\([^|]*\)|\([^|]*\)|\([^|]*\)&export SMTP_SERVER="\1" export SMTP_PORT="\2" export SMTP_USERNAME="\3" export SMTP_PASSWORD="\4"&')
166 Outz=$(zenity --question --title "SMTP server" --text "SSL option ?" )
167 SMTP_USE_SSL=$( [[ $? == 0 ]] && echo true || echo false )
168 Outz=$(zenity --question --title "SMTP server" --text "TLS option ?" )
169 SMTP_USE_TLS=$( [[ $? == 0 ]] && echo true || echo false )
171 Outz=$(zenity --width=600 --forms --title="IMAP and NTP (optionnal)" \
172 --text="IMAP server ( the ingoing mail server ) | NTP server ( time server )" \
173 --add-entry="IMAP server address" \
174 --add-entry="IMAP server PORT " \
175 --add-entry="NTP server address" )
176 $(echo $Outz | sed -e 's&\([^|]*\)|\([^|]*\)|\([^|]*\)&export IMAP_SERVER="\1" export IMAP_PORT="\2" export NTP="\3"&')
178 echo "#$SSLpublic $SSLprivate $SMTP_SERVER $SMTP_PORT $SMTP_USE_SSL $SMTP_USE_TLS $SMTP_USERNAME $SMTP_PASSWORD $FROM_EMAIL $IMAP_SERVER $IMAP_PORT $NTP"
180 echo "Please give the PUBLIC SSL key PATH."
182 echo "Please give the PRIVATE SSL key PATH."
185 echo "Please give your SMTP server address - the outgoing mail server."
187 echo "Please give your SMTP PORT address - for the outgoing mail server."
189 echo "Please give your SMTP SSL option - for the outgoing mail server."
191 echo "Please give your SMTP TLS option - for the outgoing mail server."
193 echo "Please give your SMTP user name - for the outgoing mail server."
195 echo "Please give your SMTP password - for the outgoing mail server."
197 echo "Please give this TiledViz email - for the outgoing mail server."
199 echo "Please give your IMAP server address - the ingoing mail server."
201 echo "Please give your IMAP PORT address - for the ingoing mail server."
204 echo "Please give your NTP server address - the time server."
207SMTP_PASSWORD=$( echo $SMTP_PASSWORD | sed -e "s|\&|\\\&|g" -e 's|"||g' )
209sed -e "s&_SERVER_NAME_&$SERVER_NAME&" \
210 -e "s&_DOMAIN_&$DOMAIN&" \
211 -e "s&_SSLpublic_&$SSLpublic&" \
212 -e "s&_SSLprivate_&$SSLprivate&" \
214 -e "s&_SMTP_SERVER_&$SMTP_SERVER&" \
215 -e "s&_SMTP_PORT_&$SMTP_PORT&" \
216 -e "s&_SMTP_USE_TLS_&$SMTP_USE_TLS&" \
217 -e "s&_SMTP_USE_SSL_&$SMTP_USE_SSL&" \
218 -e "s&_SMTP_USERNAME_&$SMTP_USERNAME&" \
219 -e "s&_SMTP_PASSWORD_&$SMTP_PASSWORD&" \
220 -e "s&_FROM_EMAIL_&$FROM_EMAIL&" \
221 -e "s&_IMAP_SERVER_&$IMAP_SERVER&" \
222 -e "s&_IMAP_PORT_&$IMAP_PORT&" \
223 -i $HOME/.cache/envTiledViz
227# ==========================================================
228echo "==== Start PostgreSQL ===="
234echo "#==== Build Docker images ===="
235echo "#===== build connection Docker ====="
236TVConnections/build_connect
240echo "#===== build Flask Docker ====="
241TVWeb/FlaskDocker/build_flaskdock
245echo "#===== build HPC images : ====="
246echo "#====== Magiea connection client ======"
248TVConnections/build_mageia_latest
249TVConnections/build_mageia8
253echo "#====== Ubuntu connection client ======"
254TVConnections/build_tileubuntu
258echo "#====== End build dockers ======"
259#mv ${HOME}/tmp/postgresql_$DATE TVDatabase/postgresql
261if [[ $firewallT == y ]]; then
262 echo "#====== Activate FirewallT ======"
263 # Capabilites pour executer python sans sudo (setcap -r pour l'enlever)
264 echo "Set capabilites on python"
265 sudo setcap cap_net_admin=eip $(realpath $(which python))
269# TODO : git clone Countdown 360:
270#cd TVWeb/apps/static/dist/js
271#git clone https://github.com/johnschult/jquery.countdown360.git
274echo "# All finished."