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: --gateway/-g needs IP address'
49 echo >&2 'E: --ram/-r needs number (megabytes)'
57 echo >&2 'E: --size/-s needs size argument'
66 if [ -z "${HOSTNAME:-}" ]; then
67 echo >&2 'E: hostname is required'
71 BASEDIR=$(cd ${0%/*}; pwd)
74 tar -C $BASEDIR/preseed/$SUITE -cf $tmpdir/commands.tar commands
76 extra_args="auto $CONSOLE \
77 hostname=${HOSTNAME%%.*} \
78 domain=${HOSTNAME#*.}"
80 if [ -n "$IPADDRESS" ]; then
81 if [ -z "$GATEWAY" ] && [ -x $(command -v ipcalc) ]; then
82 # default to the first IP in the network
83 GATEWAY=$(ipcalc $IPADDRESS | grep HostMin | awk '{print $2}')
85 NETMASK="${IPADDRESS#*/}"
86 IPADDRESS="${IPADDRESS%/*}"
87 : ${NAMESERVER:=$GATEWAY}
89 extra_args="$extra_args netcfg/disable_dhcp=true \
90 netcfg/get_ipaddress=$IPADDRESS \
91 netcfg/get_netmask=$NETMASK \
92 netcfg/get_gateway=$GATEWAY \
93 netcfg/get_nameservers=$NAMESERVER"
96 extra_args="$extra_args netcfg/disable_dhcp=false"
105 if [ -n "$IPADDRESS" ]; then
107 ipaddress: $IPADDRESS
110 nameserver: $NAMESERVER
120 exec virt-install --connect=$QEMU_URI \
123 --disk pool=default,size=$SIZE \
127 --watchdog i6300esb,action=reset \
128 --os-variant=debian$SUITE \
129 -l $BASEDIR/installer-amd64 \
130 --initrd-inject=$BASEDIR/preseed/$SUITE/preseed.cfg \
131 --initrd-inject=$tmpdir/commands.tar \
132 --extra-args="$extra_args" \