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'
18 echo >&2 'E: --name/-n needs hostname argument'
26 echo >&2 'E: --ipaddress/-i needs IP address/netmask'
32 echo >&2 'E: missing netmask'
41 echo >&2 'E: --dns/-d needs IP address'
49 echo >&2 'E: --gateway/-g needs IP address'
57 echo >&2 'E: --ram/-r needs number (megabytes)'
65 echo >&2 'E: --size/-s needs size argument'
74 if [ -z "${HOSTNAME:-}" ]; then
75 echo >&2 'E: hostname is required'
79 BASEDIR=$(cd ${0%/*}; pwd)
82 tar -C $BASEDIR/preseed/$SUITE -cf $tmpdir/commands.tar commands
84 extra_args="auto $CONSOLE \
85 hostname=${HOSTNAME%%.*} \
86 domain=${HOSTNAME#*.}"
88 if [ -n "$IPADDRESS" ]; then
89 if [ -z "$GATEWAY" ] && [ -x $(command -v ipcalc) ]; then
90 # default to the first IP in the network
91 GATEWAY=$(ipcalc $IPADDRESS | grep HostMin | awk '{print $2}')
93 NETMASK="${IPADDRESS#*/}"
94 IPADDRESS="${IPADDRESS%/*}"
95 : ${NAMESERVER:=$GATEWAY}
97 extra_args="$extra_args netcfg/disable_dhcp=true \
98 netcfg/get_ipaddress=$IPADDRESS \
99 netcfg/get_netmask=$NETMASK \
100 netcfg/get_gateway=$GATEWAY \
101 netcfg/get_nameservers=$NAMESERVER"
106 extra_args="$extra_args netcfg/disable_dhcp=false"
117 if [ -n "$IPADDRESS" ]; then
119 ipaddress: $IPADDRESS
122 nameserver: $NAMESERVER
132 virsh --connect=$QEMU_URI vol-create-as $STORAGE_POOL virt-$HOSTNAME ${DISK}G
134 virt-install --connect=$QEMU_URI \
137 --disk vol=$STORAGE_POOL/virt-$HOSTNAME \
141 --watchdog i6300esb,action=reset \
142 --os-variant=debian$SUITE \
143 -l $BASEDIR/installer-amd64 \
144 --initrd-inject=$BASEDIR/preseed/$SUITE/preseed.cfg \
145 --initrd-inject=$tmpdir/commands.tar \
146 --prompt --noautoconsole --autostart \
147 --extra-args="$extra_args" \
150 virsh --connect=$QEMU_URI console $HOSTNAME
151 virsh --connect=$QEMU_URI "start $HOSTNAME; console $HOSTNAME"