2006-06-09 10:59:51 by steve
Added.
This commit is contained in:
parent
2ca809eba4
commit
5111d31d68
91
hooks/centos4/50-setup-hostname
Executable file
91
hooks/centos4/50-setup-hostname
Executable file
@ -0,0 +1,91 @@
|
||||
#!/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 ../common.sh ]; then
|
||||
. ../common.sh
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Log our start
|
||||
#
|
||||
logMessage Script $0 starting
|
||||
|
||||
|
||||
#
|
||||
# Setup the mailname + hostname files.
|
||||
#
|
||||
echo ${hostname} > ${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.
|
||||
grep -v '\(::\|IPv6\)' /etc/hosts > ${prefix}/etc/hosts
|
||||
|
||||
# New entry.
|
||||
echo "${ip1} ${hostname}" >> ${prefix}/etc/hosts
|
||||
echo " " >> ${prefix}/etc/hosts
|
||||
|
||||
# IPv6 stuff.
|
||||
grep '\(::\|IPv6\)' /etc/hosts >> ${prefix}/etc/hosts
|
||||
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
|
||||
|
||||
logMessage Adding ${hostname} to /etc/hosts on the host
|
||||
|
||||
echo "${ip1} ${hostname}" >> /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 ] ;
|
||||
if [ -e /var/run/dnsmasq.pid ]; then
|
||||
|
||||
logMessage Allowing DNSMasq to restart.
|
||||
|
||||
kill -HUP `cat /var/run/dnsmasq.pid`
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Log our finish
|
||||
#
|
||||
logMessage Script $0 finished
|
||||
40
hooks/centos4/55-create-dev
Executable file
40
hooks/centos4/55-create-dev
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This script ensures that the new guest images have a nicely
|
||||
# populated /dev directory.
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# http://www.steve.org.uk/
|
||||
|
||||
|
||||
prefix=$1
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Source our common functions
|
||||
#
|
||||
if [ -e ../common.sh ]; then
|
||||
. ../common.sh
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Log our start
|
||||
#
|
||||
logMessage Script $0 starting
|
||||
|
||||
|
||||
#
|
||||
# Make the device nodes.
|
||||
#
|
||||
chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV console'
|
||||
chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV null'
|
||||
chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV zero'
|
||||
|
||||
|
||||
#
|
||||
# Log our finish
|
||||
#
|
||||
logMessage Script $0 finished
|
||||
Loading…
x
Reference in New Issue
Block a user