Make specification of NETMASK and GATEWAY mandatory; they cannot be
[invirt/packages/invirt-autoinstaller.git] / host / usr / sbin / invirt-install
1 #!/bin/sh
2
3 # If this script is interrupted, it may not clean up after itself.
4 # In particular, it may leave ${TARGET}1 mounted somewhere in tmp.
5 # Unmount it, then kpartx -d $TARGET to clean up.
6
7 set -e
8
9 export PATH #WTF?
10
11 NAME="$1"
12 export HOSTNAME="$2"
13 export DIST="$3"
14 export MIRROR="$4"
15 export FSSIZE="$5"    # in mebibytes
16 SWAPSIZE="$6"  # in mebibytes
17 export IP="$7"
18 export NETMASK="$8"
19 export GATEWAY="$9"
20
21 export ARCH=amd64
22 VGNAME=xenvg
23
24 #LVSIZE=`lvs --noheadings --units m --nosuffix -o Size /dev/xenvg/d_foobar_hda | sed 's/\..*//'`
25
26 /sbin/lvcreate -L $(($FSSIZE+$SWAPSIZE))m -n "${NAME}_hda" $VGNAME
27
28 export TARGET=/dev/mapper/xenvg-"$(echo "${NAME}_hda" | sed -e 's/-/--/g')"
29
30 /usr/sbin/invirt-create-image
31
32 echo "disk = ['phy:$VGNAME/${NAME}_xvda,xvda,w']" >>/etc/xen/$HOSTNAME.cfg
33 echo "root = '/dev/xvda1 ro'" >>/etc/xen/$HOSTNAME.cfg