From b7febc7ec21bcca94bf42c966ce624b9c3857974 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu>
Date: Mon, 24 Oct 2016 15:57:31 +0200
Subject: [PATCH] Fixed ev init step (refs #19005).

---
 1.Utilities/0_setup.py               |  2 +-
 21.Initialize_environment/0_setup.sh | 31 +++++++++++++++-------------
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/1.Utilities/0_setup.py b/1.Utilities/0_setup.py
index 0aebac15..f86ce4a9 100644
--- a/1.Utilities/0_setup.py
+++ b/1.Utilities/0_setup.py
@@ -8,7 +8,7 @@ import utils
 def setup(interactive=True):
     cmds = [
         'apt-get update',
-        'apt-get install --yes make ipython ipython3 vim netcat git htop iotop bmon host lm-sensors munin munin-node pciutils ntp nfs-client smartmontools',
+        'apt-get install --yes make ipython ipython3 vim netcat git htop iotop bmon host lm-sensors munin munin-node pciutils ntp nfs-client smartmontools pwgen ntpdate',
         '[ -f ~/.vimrc ] || echo "color ron" > ~/.vimrc',
     ]
     utils.run_commands(cmds)
diff --git a/21.Initialize_environment/0_setup.sh b/21.Initialize_environment/0_setup.sh
index 87e6bc00..28f34202 100755
--- a/21.Initialize_environment/0_setup.sh
+++ b/21.Initialize_environment/0_setup.sh
@@ -19,33 +19,36 @@ if ( ! test -z ${SHELL_UBICAST_PWD} ); then
 fi
 
 # create admin account
-useradd -m admin --shell /bin/bash 
+useradd -m admin --shell /bin/bash
 usermod -aG sudo admin
 if ( ! test -z ${SHELL_ADMIN_PWD} ); then
 	echo -e "${SHELL_ADMIN_PWD}\n${SHELL_ADMIN_PWD}" | passwd -q admin
 fi
 
 # migrate to Ubuntu 16.04 / apply sources.list
-if [ $(cat /etc/lsb-release | grep DISTRIB_RELEASE | awk -F "=" '{print$2}') = "16.04" ]
-then
-cp sources16.list /etc/apt/sources.list
-# Ubuntu 14.04
+if ( cat /etc/lsb-release | grep '14.04' ); then
+	# upgrade to Ubuntu 16.04
+	apt-get update
+	apt-get dist-upgrade -y
+	cp sources16.list /etc/apt/sources.list
+	apt-get update
+	DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get dist-upgrade -o Dpkg::Options::="--force-confold" --force-yes -y
+	apt-get install -f -y
 else
-apt-get update && apt-get upgrade -y
-cp sources16.list /etc/apt/sources.list
-apt-get update
-DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get dist-upgrade -o Dpkg::Options::="--force-confold" --force-yes -y
+	# Ubuntu 16.04
+	cp sources16.list /etc/apt/sources.list
 fi
 
-# màj
-apt-get update && apt-get install -y aptitude && aptitude upgrade -y
+# update
+apt-get update
+apt-get install -y aptitude
+aptitude upgrade -y
 aptitude install -y apt-transport-https pwgen ntpdate
 
 # modify sources.list to use ubicast cache
 grep ${APT_CACHE_HOST} /etc/apt/sources.list
-if [ $? = 1 ]
-then
-sed -i "s@http://@http://${APT_CACHE_HOST}/@" /etc/apt/sources.list
+if [ $? = 1 ]; then
+	sed -i "s@http://@http://${APT_CACHE_HOST}/@" /etc/apt/sources.list
 fi
 
 # APT panel
-- 
GitLab