Make specification of NETMASK and GATEWAY mandatory; they cannot be mitchb precise-dev precise-prod 0.0.37
authorMitchell E Berger <mitchb@mit.edu>
Thu, 17 May 2018 02:19:59 +0000 (22:19 -0400)
committerMitchell E Berger <mitchb@mit.edu>
Thu, 17 May 2018 02:19:59 +0000 (22:19 -0400)
assumed to have global values that are valid for all NICs.  This update
is largely to keep up appearances, as this package is no longer used.
But, since it is still installed, and we need to get rid of the
network section in master.yaml (which this package is the only consumer
of), here we are.

common/usr/sbin/invirt-create-image
debian/changelog
guest/etc/init.d/rcS.invirt
host/usr/sbin/invirt-install

index 17f9d03..a55c85e 100644 (file)
@@ -4,20 +4,10 @@
 #  TARGET a device filename
 #  FSSIZE the desired filesystem size in mebibytes (rest will be swap)
 #  ARCH, DIST, MIRROR
-#  HOSTNAME, IP
-#
-# Optional: GATEWAY, NETMASK.  These default to values in invirt-getconf, if installed
+#  HOSTNAME, IP, GATEWAY, NETMASK
 
 set -e
 
-if [ -z "$GATEWAY" ]; then
-    GATEWAY=$(invirt-getconf network.gateway)
-fi
-
-if [ -z "$NETMASK" ]; then
-    NETMASK=$(invirt-getconf network.netmask)
-fi
-
 echo ,"${FSSIZE}"$',L,*\n,,S\n;\n;' | sfdisk -uM -H 255 -S 63 "$TARGET"
 
 dmsetup info "$TARGET" 2>/dev/null && kpartx -a "$TARGET"
index ddfd768..42f402e 100644 (file)
@@ -1,3 +1,10 @@
+invirt-autoinstaller (0.0.37) precise; urgency=low
+
+  * Make specification of GATEWAY and NETMASK mandatory; they cannot
+    be assumed to be the same globally.
+
+ -- Mitchell Berger <mitchb@mit.edu>  Wed, 16 May 2018 22:20:00 -0400
+
 invirt-autoinstaller (0.0.36) precise; urgency=low
 
   * Updating version for precise.
index 84cfedb..f796bf2 100755 (executable)
@@ -29,6 +29,8 @@ mount -t tmpfs none /tmp
 export TARGET=/dev/hda
 export ARCH=${ARCH-amd64}
 export IP=$(ifconfig eth0 | sed -n 's/.*inet addr:\([0-9\.]*\).*/\1/p')
+export NETMASK=$(ifconfig eth0 | sed -n 's/.*inet addr:.*Mask:\([0-9\.]*\).*/\1/p')
+export GATEWAY=$(ip route list | sed -n 's/default via \([0-9\.]*\).*/\1/p')
 export HOSTNAME=$(hostname)
 
 /etc/init.d/udev start
index eaa3e58..d415c97 100644 (file)
@@ -15,16 +15,14 @@ export MIRROR="$4"
 export FSSIZE="$5"    # in mebibytes
 SWAPSIZE="$6"  # in mebibytes
 export IP="$7"
+export NETMASK="$8"
+export GATEWAY="$9"
 
 export ARCH=amd64
 VGNAME=xenvg
 
 #LVSIZE=`lvs --noheadings --units m --nosuffix -o Size /dev/xenvg/d_foobar_hda | sed 's/\..*//'`
 
-if [ -z "$IP" ]; then
-    IP=`host $HOSTNAME.xvm.mit.edu | sed 's/.* //' | head -n 1`
-fi
-
 /sbin/lvcreate -L $(($FSSIZE+$SWAPSIZE))m -n "${NAME}_hda" $VGNAME
 
 export TARGET=/dev/mapper/xenvg-"$(echo "${NAME}_hda" | sed -e 's/-/--/g')"