4 if [ -z "${vdir}" ] ; then
6 echo "Provide the directory of the root filesystem to operate on"
10 # Remove unneeded services
11 for service in util-vserver vprocunhide vservers-default; do
12 chroot ${vdir} /sbin/chkconfig $service off
15 # Disable splaying of cron.
16 echo > ${vdir}/etc/sysconfig/crontab
19 # update /etc/sysconfig/network-scripts/ifup
20 # #if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
21 #echo $"Error, some other host already uses address ${IPADDR}."
25 # Add site_admin account
26 chroot ${vdir} /usr/sbin/useradd -p "" -u 502 -m site_admin
28 # NOTE: this is added to ensure that processes running within the slices that
29 # may have special permissions and other parts of the filesystem engated are
30 # killed before shutdown. We experienced hangs when rebooting without this
32 ( cat <<EOF ) | patch -d ${vdir}/etc/init.d/
33 --- halt 2007-10-08 19:18:54.000000000 +0000
34 +++ halt2 2008-05-07 17:52:42.000000000 +0000
37 [ "\${BASH+bash}" = bash ] && enable kill
39 +action $"Sending all VServers the TERM signal..." ls -d /proc/virtual/[0-9]* | awk -F '/' '{print \$4}' | xargs -I{} /usr/sbin/vkill -s 15 --xid {} -- 0
40 action $"Sending all processes the TERM signal..." /sbin/killall5 -15
42 +action $"Sending all VServers the KILL signal..." ls -d /proc/virtual/[0-9]* | awk -F '/' '{print \$4}' | xargs -I{} /usr/sbin/vkill -s 9 --xid {} -- 0
43 action $"Sending all processes the KILL signal..." /sbin/killall5 -9
45 # Write to wtmp file before unmounting /var
48 # NOTE: This is added to relieve one site's Cisco router configuration that
49 # fails to recognize the host once the arping is sent out.
50 cat <<\EOF | patch -d ${vdir}/etc/sysconfig/network-scripts/
51 --- ifup-eth 2008-07-08 13:19:49.000000000 -0400
52 +++ ifup-eth-orig 2008-07-08 13:20:02.000000000 -0400
56 if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${IPADDR}/${PREFIX}" ; then
57 - if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
58 - echo $"Error, some other host already uses address ${IPADDR}."
61 + #if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
62 + # echo $"Error, some other host already uses address ${IPADDR}."
65 if ! ip addr add ${IPADDR}/${PREFIX} \
66 brd ${BROADCAST:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then
67 echo $"Error adding address ${IPADDR} for ${DEVICE}."