From: Chris Sharp Date: Tue, 27 Jun 2017 13:23:53 +0000 (-0400) Subject: Alter how we check for OS distro and add check for release. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1b92f24faab74c0e90e3ba2ff2b638eeb1d5d87f;p=contrib%2Fpines%2Fgenasys.git Alter how we check for OS distro and add check for release. Assume systemd when setting hostname except when we're on Ubuntu 14.04. --- diff --git a/templates/setup-head.sh b/templates/setup-head.sh index df0ef47..a17df36 100755 --- a/templates/setup-head.sh +++ b/templates/setup-head.sh @@ -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 diff --git a/templates/setup-vars b/templates/setup-vars index 32bd0bc..7c9a306 100644 --- a/templates/setup-vars +++ b/templates/setup-vars @@ -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" ]