From b9c4d559e30e16669fa10337b988b61958071394 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexandre=20Delano=C3=AB?= <alexandre.delanoe@iscpif.fr>
Date: Wed, 31 Aug 2016 09:38:00 +0200
Subject: [PATCH] [DEBIAN INSTALL] Fixes and warnings for safety.

---
 install/gargamelle/Debian.sh | 82 +++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 43 deletions(-)

diff --git a/install/gargamelle/Debian.sh b/install/gargamelle/Debian.sh
index b49f7909..e5c7b4f8 100755
--- a/install/gargamelle/Debian.sh
+++ b/install/gargamelle/Debian.sh
@@ -14,6 +14,7 @@ nginx rabbitmq-server
 ### Configure timezone and locale
 echo "###########  LOCALES & TZ #################"
 echo "Europe/Paris" > /etc/timezone
+dpkg-reconfigure --frontend=noninteractive tzdata
 #ENV TZ "Europe/Paris"
 
 sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen && \
@@ -26,50 +27,45 @@ update-locale LC_ALL=fr_FR.UTF-8
 # see warning: https://wiki.debian.org/Locale
 
 ### Install main dependencies and python packages based on Debian distrib
-echo "############# PYTHON DEPENDENCIES ###############"
-apt-get update && apt-get install -y \
- libxml2-dev xml-core libgfortran-5-dev \
- libpq-dev \
- python3.5 \
- python3-dev \
- # for numpy, pandas and numpyperf
- python3-six python3-numpy python3-setuptools \
- python3-numexpr \
- # python dependencies
- python3-pip \
- # for lxml
- libxml2-dev libxslt-dev
- #libxslt1-dev zlib1g-dev
+ echo "############# PYTHON DEPENDENCIES ###############"
+ apt-get update && apt-get install -y \
+  libxml2-dev xml-core libgfortran-5-dev \
+  libpq-dev \
+  python3.5 \
+  python3-dev \
+  python3-six python3-numpy python3-setuptools \
+  python3-numexpr \
+  python3-pip \
+  libxml2-dev libxslt-dev
+  #libxslt1-dev zlib1g-dev
+ 
+ UPDATE AND CLEAN
+ apt-get update && apt-get autoclean
+ #NB: removing /var/lib will avoid to significantly fill up your /var/ folder on your native system
+ 
+ ########################################################################
+ ### PYTHON ENVIRONNEMENT (as ROOT)
+ ########################################################################
+ 
+ #adduser --disabled-password --gecos "" gargantua
+ 
+ cd /srv/
+ pip3 install virtualenv
+ virtualenv /srv/env_3-5
+ echo 'alias venv="source /srv/env_3-5/bin/activate"' >> ~/.bashrc
+ # CONFIG FILES
 
-# UPDATE AND CLEAN
-apt-get update && apt-get autoclean &&\
-rm -rf /var/lib/apt/lists/*
-#NB: removing /var/lib will avoid to significantly fill up your /var/ folder on your native system
-
-########################################################################
-### PYTHON ENVIRONNEMENT (as ROOT)
-########################################################################
-
-#adduser --disabled-password --gecos "" gargantua
-
-cd /srv/
-pip3 install virtualenv
-virtualenv /srv/env_3-5
-echo 'alias venv="source /srv/env_3-5/bin/activate"' >> ~/.bashrc
-# CONFIG FILES
-#ADD requirements.txt /
-#ADD psql_configure.sh /
-#ADD django_configure.sh /
-
-/srv/env_3-5/bin/activate && pip3 install -r requirements.txt && \
-pip3  install git+https://github.com/zzzeek/sqlalchemy.git@rel_1_1 && \
-python3 -m nltk.downloader averaged_perceptron_tagger -d /usr/local/share/nltk_data
-
-chown gargantua:gargantua -R /srv/env_3-5
-
-########################################################################
-### POSTGRESQL DATA (as ROOT)
-########################################################################
+# su gargantua -c 'all commands below'
+# but nltk needs right access (so done in root, not really good for safety)
+ source /srv/env_3-5/bin/activate && pip3 install -r requirements.txt && \
+ pip3  install git+https://github.com/zzzeek/sqlalchemy.git@rel_1_1 && \
+ python3 -m nltk.downloader averaged_perceptron_tagger -d /usr/local/share/nltk_data
+ 
+ chown gargantua:gargantua -R /srv/env_3-5
+ 
+#######################################################################
+## POSTGRESQL DATA (as ROOT)
+#######################################################################
 
 sed -iP "s%^data_directory.*%data_directory = \'\/srv\/gargandata\'%" /etc/postgresql/9.5/main/postgresql.conf
 echo "host all  all    0.0.0.0/0  md5" >> /etc/postgresql/9.5/main/pg_hba.conf
-- 
2.21.0