All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
9 QEMU_URI=qemu:///system
11 CONSOLE='console=tty0 console=ttyS0,115200n8'
19 echo >&2 'E: --name/-n needs hostname argument'
27 echo >&2 'E: --ipaddress/-i needs IP address/netmask'
33 echo >&2 'E: missing netmask'
42 echo >&2 'E: --dns/-d needs IP address'
50 echo >&2 'E: --gateway/-g needs IP address'
58 echo >&2 'E: --ram/-r needs number (megabytes)'
66 echo >&2 'E: --size/-s needs size argument'
74 echo >&2 'E: --arch/-a needs size argument'
86 if [ -z "${HOSTNAME:-}" ]; then
87 echo >&2 'E: hostname is required'
91 BASEDIR=$(cd ${0%/*}; pwd)
94 tar -C $BASEDIR/preseed/$SUITE -cf $tmpdir/commands.tar commands
96 extra_args="auto $CONSOLE \
97 hostname=${HOSTNAME%%.*} \
98 domain=${HOSTNAME#*.}"
100 if [ -n "$IPADDRESS" ]; then
101 if [ -z "$GATEWAY" ] && [ -x $(command -v ipcalc) ]; then
102 # default to the first IP in the network
103 GATEWAY=$(ipcalc $IPADDRESS | grep HostMin | awk '{print $2}')
105 NETMASK="${IPADDRESS#*/}"
106 IPADDRESS="${IPADDRESS%/*}"
107 : ${NAMESERVER:=$GATEWAY}
109 extra_args="$extra_args netcfg/disable_dhcp=true \
110 netcfg/get_ipaddress=$IPADDRESS \
111 netcfg/get_netmask=$NETMASK \
112 netcfg/get_gateway=$GATEWAY \
113 netcfg/get_nameservers=$NAMESERVER"
118 extra_args="$extra_args netcfg/disable_dhcp=false"
122 if [ -z "$ARCH" ]; then
123 ARCH=$(dpkg --print-architecture)
134 if [ -n "$IPADDRESS" ]; then
136 ipaddress: $IPADDRESS
139 nameserver: $NAMESERVER
150 virsh --connect=$QEMU_URI vol-create-as $STORAGE_POOL virt-$HOSTNAME ${DISK}G
152 [ $DEBUG = 1 ] && DEBUGFLAG=--debug
154 virt-install --connect=$QEMU_URI \
158 --disk vol=$STORAGE_POOL/virt-$HOSTNAME \
162 --watchdog i6300esb,action=reset \
163 --os-variant=debian$SUITE \
164 -l $BASEDIR/installer-amd64 \
165 --initrd-inject=$BASEDIR/preseed/$SUITE/preseed.cfg \
166 --initrd-inject=$tmpdir/commands.tar \
167 --noautoconsole --autostart \
168 --extra-args="$extra_args" \
171 virsh --connect=$QEMU_URI console $HOSTNAME
172 virsh --connect=$QEMU_URI "start $HOSTNAME; console $HOSTNAME"