Alter how we check for OS distro and add check for release.
authorChris Sharp <csharp@georgialibraries.org>
Tue, 27 Jun 2017 13:23:53 +0000 (09:23 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Tue, 27 Jun 2017 13:23:53 +0000 (09:23 -0400)
Assume systemd when setting hostname except when we're on Ubuntu
14.04.

templates/setup-head.sh
templates/setup-vars

index df0ef47..a17df36 100755 (executable)
@@ -86,17 +86,19 @@ fi
 
 echo "Setting Hostname"
 sleep 2
-echo "head_file" > /etc/hostname
+# supported Debian releases and Ubuntu 16.04 are on systemd
+# so check to see if we're running 14.04, otherwise, we're 
+# on a systemd-based system
+#Get_OS_Distro
+if [ "$OSDISTRO" == "Ubuntu" && "$OSRELEASE" == "14.04" ]; then
+       echo "head_file" > /etc/hostname
+    start hostname
+else
+       hostnamectl set-hostname "head_file"
+fi
 tar zxvf head_file_etc-hosts.tar.gz -C /
 sed -i 's/^domain.*/domain CLUSTER_DOMAINNAME/g' /etc/resolv.conf
 sed -i 's/^search.*/search CLUSTER_DOMAINNAME/g' /etc/resolv.conf
-#Get_OS_Distro
-if [ "$OSDISTRO" == "Ubuntu" ]
-        then
-        start hostname
-                else
-                /etc/init.d/hostname.sh
-fi
 
 ### Add backports if debian 6.x
 if grep -q 'Debian GNU/Linux 6' /etc/issue
index 32bd0bc..7c9a306 100644 (file)
@@ -31,7 +31,8 @@ COL_BR_CYAN=$ESC_SEQ"1;36m"
 ### Set install log
 INSTALL_LOG="/var/log/genasys_install.log"
 
-OSDISTRO=$(cat /etc/issue|head -1|awk '{ print $1 }')
+OSDISTRO=$(lsb_release -i | awk '{ print $1 }')
+OSRELEASE=$(lsb_release -r | awk '{print $2}')
 
 #Get_OS_Distro
 if [ "$OSDISTRO" == "Debian" ]