70-install-ssh: "ssh" package doesn't fully resolve on atleast the newer distros, changed the package "ssh" to "openssh-server" 80-install-kernel: new script to install a kernel for the pygrub flag 80-install-modules: added support for pygrub, this script is essentially ignored if pygrub is set. The kernel script will install modules in that case.
125 lines
2.7 KiB
Bash
Executable File
125 lines
2.7 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# This script places the new systems hostname into a couple of files within
|
|
# the new image.
|
|
#
|
|
# Steve
|
|
# --
|
|
# http://www.steve.org.uk/
|
|
|
|
|
|
|
|
prefix=$1
|
|
|
|
|
|
#
|
|
# Source our common functions
|
|
#
|
|
if [ -e /usr/lib/xen-tools/common.sh ]; then
|
|
. /usr/lib/xen-tools/common.sh
|
|
else
|
|
. ./hooks/common.sh
|
|
fi
|
|
|
|
|
|
#
|
|
# Log our start
|
|
#
|
|
logMessage Script $0 starting
|
|
|
|
|
|
#
|
|
# Setup the mailname + hostname files.
|
|
#
|
|
echo ${hostname} | sed 's/^\([^\.]*\)\..*/\1/' > ${prefix}/etc/hostname
|
|
echo ${hostname} > ${prefix}/etc/mailname
|
|
|
|
|
|
#
|
|
# Fixup the /etc/hosts file upon the new image for
|
|
# machines with static IPs
|
|
#
|
|
if [ -z "${dhcp}" ]; then
|
|
|
|
# Non-IPv6 stuff.
|
|
# TODO: Think of a better way of doing this, this may have a lot of trash
|
|
# depending on the dom0 (i.e. 127.0.0.1 dom0.example.com)
|
|
grep -v '\(::\|IPv6\)' /etc/hosts > ${prefix}/etc/hosts
|
|
|
|
# New entry.
|
|
# echo "127.0.0.1 localhost" >> ${prefix}/etc/hosts
|
|
echo "127.0.1.1 $(echo ${hostname} | awk -F '.' '{ print $1 }')" >> ${prefix}/etc/hosts
|
|
echo "${ip1} ${hostname}" >> ${prefix}/etc/hosts
|
|
echo " " >> ${prefix}/etc/hosts
|
|
|
|
# IPv6 stuff.
|
|
grep '\(::\|IPv6\)' /etc/hosts >> ${prefix}/etc/hosts
|
|
|
|
else
|
|
|
|
#
|
|
# Stub /etc/hosts for DHCP clients.
|
|
#
|
|
cat >> ${prefix}/etc/hosts <<EOF
|
|
127.0.0.1 localhost
|
|
127.0.1.1 $(echo ${hostname} | awk -F '.' '{ print $1 }') ${hostname}
|
|
|
|
# The following lines are desirable for IPv6 capable hosts
|
|
::1 ip6-localhost ip6-loopback
|
|
fe00::0 ip6-localnet
|
|
ff00::0 ip6-mcastprefix
|
|
ff02::1 ip6-allnodes
|
|
ff02::2 ip6-allrouters
|
|
ff02::3 ip6-allhosts
|
|
|
|
EOF
|
|
|
|
|
|
fi
|
|
|
|
|
|
#
|
|
# Allow the host system to know the IP address of our new guest.
|
|
#
|
|
if [ -z "${dhcp}" ]; then
|
|
|
|
if ( grep ${hostname} /etc/hosts > /dev/null ) ; then
|
|
|
|
logMessage Host already has IP address for the host ${hostname}.
|
|
|
|
else
|
|
|
|
#
|
|
# Short host name.
|
|
#
|
|
name=`echo ${hostname} | awk -F. '{print $1}'`
|
|
|
|
if [ -z "${nohosts}" ]; then
|
|
|
|
logMessage Adding ${hostname} and ${name} to /etc/hosts on the host
|
|
echo "${ip1} ${hostname} ${name}" >> /etc/hosts
|
|
|
|
#
|
|
# If we've updated the /etc/hosts file on the host machine
|
|
# and there is an installation of dnsmasq installed then
|
|
# reload it.
|
|
#
|
|
# This will let the local LAN clients lookup the new address.
|
|
#
|
|
if [ -x /usr/sbin/dnsmasq ] ; then
|
|
if [ -e /var/run/dnsmasq.pid ]; then
|
|
|
|
logMessage Allowing DNSMasq to restart.
|
|
kill -s HUP `cat /var/run/dnsmasq.pid`
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
|
|
#
|
|
# Log our finish
|
|
#
|
|
logMessage Script $0 finished
|