/usr/share/xen-tools/common/40-setup-networking-rpm is in xen-tools 4.6.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | #!/bin/sh
#
# This script sets up the networking files for the new image.
#
# Steve
# --
# http://www.steve.org.uk/
prefix=$1
#
# Source our common functions
#
if [ -e /usr/share/xen-tools/common.sh ]; then
. /usr/share/xen-tools/common.sh
else
. ./hooks/common.sh
fi
#
# Log our start
#
logMessage Script $0 starting
#
# Make sure we have an /etc/sysconfig/network-scripts directory.
#
mkdir -p ${prefix}/etc/sysconfig/network-scripts/
#
# Test for static vs. DHCP
#
if [ -z "${dhcp}" ]; then
#
# Setup the initial interface
#
cat <<E_O_STATIC >${prefix}/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=${ip1}
NETMASK=${netmask}
GATEWAY=${gateway}
E_O_STATIC
#
# Now setup any other ones.
#
interface=1
count=2
while [ "${count}" -le "${ip_count}" ]; do
value=\$ip${count}
value=`eval echo $value`
logMessage Adding etho:${interface}
cat <<E_O_STATIC >${prefix}/etc/sysconfig/network-scripts/ifcfg-eth0:${interface}
DEVICE=eth0:${interface}
ONBOOT=yes
BOOTPROTO=static
IPADDR=${value}
NETMASK=${netmask}
E_O_STATIC
count=`expr $count + 1`
interface=`expr $interface + 1`
done
#
# Hooks are run chrooted, hence the resolv.conf is moved
# temporarily to /etc/resolv.conf.old. Use that file, it
# will be restored after hooks are run.
#
if [ '' != "$nameserver" ]; then
rm -f ${prefix}/etc/resolv.conf.old
for ns in $nameserver; do
echo "nameserver $ns" >>${prefix}/etc/resolv.conf.old
done
else
cp /etc/resolv.conf ${prefix}/etc/resolv.conf.old
fi
else
cat <<E_O_DHCP >${prefix}/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
E_O_DHCP
chroot ${prefix} /usr/bin/yum -y install dhclient
fi
#
# Don't forget to setup the default route.
#
cat <<EOF >${prefix}/etc/sysconfig/network
NETWORKING=yes
GATEWAY=${gateway}
HOSTNAME=${hostname}
EOF
#
# Log our finish
#
logMessage Script $0 finished
|