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