Updated so that DHCP also sets :
vif = [ '' ]
This is mandatory for DHCP instances nowadays .. I think.
67 lines
1023 B
Bash
Executable File
67 lines
1023 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# This script is responsible for setting up the Xen Configuration file
|
|
#
|
|
# Steve
|
|
# --
|
|
# http://www.steve.org.uk/
|
|
|
|
|
|
prefix=$1
|
|
dist=$2
|
|
|
|
|
|
#
|
|
# This script doesn't do anything different on a per-distribution basis
|
|
#
|
|
|
|
|
|
#
|
|
# Useful hook for testing.
|
|
#
|
|
output_dir=/etc/xen
|
|
|
|
if [ "${testing}" ]; then
|
|
if [ -d ${testing_dir} ]; then
|
|
output_dir=${testing_dir}
|
|
fi
|
|
fi
|
|
|
|
|
|
#
|
|
# Make sure we use ide style device names if required
|
|
#
|
|
device=sda
|
|
if [ "${ide}" ]; then
|
|
device=hda
|
|
fi
|
|
|
|
|
|
echo "Creating Xen configuration file in /etc/xen .. "
|
|
|
|
#
|
|
# Default stuff
|
|
#
|
|
cat <<E_O_CFG > ${output_dir}/${hostname}.cfg
|
|
kernel = '${kernel}'
|
|
ramdisk = '${initrd}'
|
|
memory = ${memory}
|
|
name = '${hostname}'
|
|
root = '/dev/${device}1 ro'
|
|
disk = [ '${imagevbd},${device}1,w', '${swapvbd},${device}2,w' ]
|
|
E_O_CFG
|
|
|
|
|
|
#
|
|
# DHCP vs. Static
|
|
#
|
|
if [ "${dhcp}" ]; then
|
|
cat <<E_O_CFG >> ${output_dir}/${hostname}.cfg
|
|
dhcp = "dhcp"
|
|
vif = [ '' ]
|
|
E_O_CFG
|
|
else
|
|
echo "vif = ['ip=${ip}']" >> ${output_dir}/${hostname}.cfg
|
|
fi
|
|
|