tweak autoinstall scripts
authorGreg Price <price@mit.edu>
Sun, 28 Sep 2008 23:34:10 +0000 (19:34 -0400)
committerGreg Price <price@mit.edu>
Sun, 28 Sep 2008 23:34:10 +0000 (19:34 -0400)
svn path=/trunk/packages/sipb-xen-autoinstaller/; revision=937

common/usr/sbin/sipb-xen-create-image
host/usr/sbin/sipb-xen-install

index ffba79d..997e12a 100644 (file)
@@ -1,10 +1,13 @@
 #!/bin/bash
 # Usage: no command-line args.
 # "arguments" come in environment:
 #!/bin/bash
 # Usage: no command-line args.
 # "arguments" come in environment:
-#  TARGET a device filename, IMAGESIZE its size in XXXX what unit?
+#  TARGET a device filename
+#  IMAGESIZE the desired filesystem size in megabytes (rest will be swap)
 #  ARCH, DIST, MIRROR
 #  HOSTNAME, IP
 
 #  ARCH, DIST, MIRROR
 #  HOSTNAME, IP
 
+set -e
+
 echo ,"${IMAGESIZE}"$',L,*\n,,S\n;\n;' | sfdisk -uM -H 255 -S 63 "$TARGET"
 
 kpartx -a "$TARGET"    # should be no-op in guest
 echo ,"${IMAGESIZE}"$',L,*\n,,S\n;\n;' | sfdisk -uM -H 255 -S 63 "$TARGET"
 
 kpartx -a "$TARGET"    # should be no-op in guest
index b7d9c66..81cea3f 100644 (file)
@@ -6,10 +6,11 @@
 
 export PATH #WTF?
 
 
 export PATH #WTF?
 
+LVNAME="$1"
 export HOSTNAME="$2"
 export DIST="$3"
 export MIRROR="$4"
 export HOSTNAME="$2"
 export DIST="$3"
 export MIRROR="$4"
-export IMAGESIZE="$5"
+export IMAGESIZE="$5"  # in megabytes
 export IP="$6"
 
 export ARCH=amd64
 export IP="$6"
 
 export ARCH=amd64
@@ -20,7 +21,7 @@ if [ -z "$IP" ]; then
     IP=`host $HOSTNAME.xvm.mit.edu | sed 's/.* //' | head -n 1`
 fi
 
     IP=`host $HOSTNAME.xvm.mit.edu | sed 's/.* //' | head -n 1`
 fi
 
-export TARGET=/dev/mapper/xenvg-d_$(echo "$HOSTNAME" | sed -e 's/-/--/g')_hda
+export TARGET=/dev/mapper/xenvg-$(echo "$LVNAME" | sed -e 's/-/--/g')_hda
 
 /usr/sbin/sipb-xen-create-image
 
 
 /usr/sbin/sipb-xen-create-image