From ba1c60598428c29bc247a3768627fdf39657e59f Mon Sep 17 00:00:00 2001 From: Mitchell E Berger Date: Wed, 16 May 2018 22:19:59 -0400 Subject: [PATCH] Make specification of NETMASK and GATEWAY mandatory; they cannot be 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 | 12 +----------- debian/changelog | 7 +++++++ guest/etc/init.d/rcS.invirt | 2 ++ host/usr/sbin/invirt-install | 6 ++---- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/common/usr/sbin/invirt-create-image b/common/usr/sbin/invirt-create-image index 17f9d03..a55c85e 100644 --- a/common/usr/sbin/invirt-create-image +++ b/common/usr/sbin/invirt-create-image @@ -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" diff --git a/debian/changelog b/debian/changelog index ddfd768..42f402e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Wed, 16 May 2018 22:20:00 -0400 + invirt-autoinstaller (0.0.36) precise; urgency=low * Updating version for precise. diff --git a/guest/etc/init.d/rcS.invirt b/guest/etc/init.d/rcS.invirt index 84cfedb..f796bf2 100755 --- a/guest/etc/init.d/rcS.invirt +++ b/guest/etc/init.d/rcS.invirt @@ -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 diff --git a/host/usr/sbin/invirt-install b/host/usr/sbin/invirt-install index eaa3e58..d415c97 100644 --- a/host/usr/sbin/invirt-install +++ b/host/usr/sbin/invirt-install @@ -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')" -- 1.7.9.5