disable the 'halt' patch, and enable util-vserver init script that should help
[build.git] / config.planetlab / bootstrapfs.post
1 #!/bin/bash
2
3 vdir=$1
4 if [ -z "${vdir}" ] ; then
5         echo "ERROR: $0"
6         echo "Provide the directory of the root filesystem to operate on"
7         exit
8 fi
9
10 # NOTE: we're enabling util-vserver to allow it to help shutdown all slices
11 # before rebooting.  This has been problematic in the past.
12 for service in util-vserver; do
13     chroot ${vdir} /sbin/chkconfig $service on
14 done
15
16 # Remove unneeded services
17 for service in vprocunhide vservers-default; do
18     chroot ${vdir} /sbin/chkconfig $service off
19 done
20
21 # Disable splaying of cron.
22 echo > ${vdir}/etc/sysconfig/crontab
23
24 # Add site_admin account
25 chroot ${vdir} /usr/sbin/useradd -p "" -u 502 -m site_admin
26
27 # NOTE:  Removed due to incompatibility between fedora and centos, and b/c we
28 # expect that enabling util-vserver above will help with shutdown.
29 #
30 # : this is added to ensure that processes running within the slices that
31 # may have special permissions and other parts of the filesystem engated are
32 # killed before shutdown.  We experienced hangs when rebooting without this
33 # step.
34 #( cat <<EOF ) | patch -d ${vdir}/etc/init.d/
35 #--- halt        2007-10-08 19:18:54.000000000 +0000
36 #+++ halt2       2008-05-07 17:52:42.000000000 +0000
37 #@@ -65,8 +65,10 @@
38 # # Kill all processes.
39 # [ "\${BASH+bash}" = bash ] && enable kill
40 #
41 #+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
42 # action $"Sending all processes the TERM signal..." /sbin/killall5 -15
43 # sleep 2
44 #+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
45 # action $"Sending all processes the KILL signal..."  /sbin/killall5 -9
46 #
47 # # Write to wtmp file before unmounting /var
48 #EOF
49
50 # NOTE:  This is added to relieve one site's Cisco router configuration that
51 # fails to recognize the host once the arping is sent out.
52 cat <<\EOF | patch -d ${vdir}/etc/sysconfig/network-scripts/
53 --- ifup-eth    2008-07-08 13:19:49.000000000 -0400
54 +++ ifup-eth-orig       2008-07-08 13:20:02.000000000 -0400
55 @@ -263,10 +263,10 @@
56      fi
57      
58      if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${IPADDR}/${PREFIX}" ; then
59 -        if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
60 -           echo $"Error, some other host already uses address ${IPADDR}."
61 -           exit 1
62 -        fi
63 +        #if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
64 +        #   echo $"Error, some other host already uses address ${IPADDR}."
65 +        #   exit 1
66 +        #fi
67          if ! ip addr add ${IPADDR}/${PREFIX} \
68             brd ${BROADCAST:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then
69             echo $"Error adding address ${IPADDR} for ${DEVICE}."
70 EOF