From 3990314fa4c07fd464d7fed7e32db1afea74fb09 Mon Sep 17 00:00:00 2001
From: David Beniamine <david.beniamine@tetras-libre.fr>
Date: Tue, 6 Mar 2018 15:09:16 +0100
Subject: [PATCH] Fix network in a separate script

---
 fix_network.sh | 10 ++++++++++
 postInstall.sh | 12 ++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)
 create mode 100755 fix_network.sh

diff --git a/fix_network.sh b/fix_network.sh
new file mode 100755
index 0000000..dd7bb71
--- /dev/null
+++ b/fix_network.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+# Fix ethernet issues
+echo "# The primary eth0 interface" | sudo tee --append /etc/network/interfaces
+echo "auto eth0" | sudo tee --append /etc/network/interfaces
+echo "allow-hotplug eth0" | sudo tee --append /etc/network/interfaces
+echo "iface eth0 inet dhcp" | sudo tee --append /etc/network/interfaces
+sudo sed -i 's/^\(GRUB_CMDLINE_LINUX_DEFAULT="quiet\)"/\1 pcie_aspm=off"/' /etc/default/grub
+sudo update-grub
+ 
+
diff --git a/postInstall.sh b/postInstall.sh
index 41f8d67..48d893c 100755
--- a/postInstall.sh
+++ b/postInstall.sh
@@ -20,6 +20,7 @@ while [ -z "$SRV_NAME" ]
 do
 	read -p "Merci d'entrer le code RNE de l'école (ex: DSIT or 0382693W)" SRV_NAME
 done
+DIR=`dirname $0`
 # Prepare LDAP config
 for f in dist/*
 do
@@ -30,14 +31,8 @@ do
     sudo sed -i.orig "s/DSIT/$SRV_NAME/g" ${f/dist/}
 done
 
-# Fix ethernet issues
-echo "# The primary eth0 interface" | sudo tee --append /etc/network/interfaces
-echo "auto eth0" | sudo tee --append /etc/network/interfaces
-echo "allow-hotplug eth0" | sudo tee --append /etc/network/interfaces
-echo "iface eth0 inet dhcp" | sudo tee --append /etc/network/interfaces
-sudo sed -i 's/^\(GRUB_CMDLINE_LINUX_DEFAULT="quiet\)"/\1 pcie_aspm=off"/' /etc/default/grub
-sudo update-grub
- 
+$DIR/fix_network.sh
+
 # Add proxy for administrateur
 for proto in http https ftp
 do
@@ -46,4 +41,5 @@ do
 done
 sudo apt-get -y purge xpdf
 sudo apt-get -y install evince
+
 read -p "Configuration faite, appuyez sur n'importe quelle touche pour continuer"
-- 
GitLab