Add support for using second interfaces as primary interface when detected.
authorAndy Witter <awitter@georgialibraries.org>
Mon, 8 Apr 2019 20:01:56 +0000 (16:01 -0400)
committerAndy Witter <awitter@georgialibraries.org>
Mon, 8 Apr 2019 20:01:56 +0000 (16:01 -0400)
templates/setup-functions
templates/setup-head.sh

index ff66067..1229092 100755 (executable)
@@ -152,16 +152,23 @@ if [ -e /etc/apparmor.d/usr.sbin.ejabberdctl ]; then
 fi
 }
 
-ConfigNetwork () {
+ConfigNetwork () { ### for NON LVS servers.
 # PRIMARY_IF=$(ip route get 8.8.8.8 | awk '{print $5; exit}') #TODO remove this as its declared above in the GetNics Function - done
-if [ ! -z "$PRIMARY_INTERFACE" ]; then #TODO update variable - done
-        sed -i "s/Primary_IF/$PRIMARY_INTERFACE/g" /etc/network/interfaces #TODO update variable - done
+if [ ! -z "${SECOND_PHYSICAL_INTERFACE}" ] 
+then
+    PRIMARY_INTERFACE="${SECOND_PHYSICAL_INTERFACE}"
+fi
+
+if [ ! -z "$PRIMARY_INTERFACE" ]; #TODO update variable - done
+then 
+    sed -i "s/Primary_IF/$PRIMARY_INTERFACE/g" /etc/network/interfaces #TODO update variable - done
 else
-   echo "ERROR: Unable to set primary interface. You must edit /etc/network/interfaces manually."
+    echo "ERROR: Unable to set primary interface. You must edit /etc/network/interfaces manually."
 fi
 #TODO expand this function to handle all interfaces anywhere. aw-4/4/2019
 }
 
+
 ### Setup monitoring.
 SetupMonitoring () {
 ## Monitored hosts
index 98ef157..58095f2 100755 (executable)
@@ -148,8 +148,15 @@ fi
 
 GetNics ### Get the network interface #TODO change function called here from GetNic to GetNics - done
 
+
 ### Temporary create and alias interface for installation
+GetNics
+if [ ! -z "${SECOND_PHYSICAL_INTERFACE}" ]
+then
+    PRIMARY_INTERFACE="${SECOND_PHYSICAL_INTERFACE}"
+fi
 ip a add Priv_IP/My_CIDR dev $PRIMARY_INTERFACE label ${PRIMARY_INTERFACE}:0 #TODO update Variable to $3PRIMARY_INTERFACE - done
+ip link set $PRIMARY_INTERFACE up
 
 ### Install Opensrf and Evergreen debs.
 if [ -e debconf-settings ]