2413251519fbd61d907a1b77665fd221e2f16f49
[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 # Cleanup yum config entirely, waiting for the config files to populate this
11 rm -rf ${vdir}/etc/yum.conf ${vdir}/etc/yum.repos.d
12
13 # NOTE: we're enabling util-vserver to allow it to help shutdown all slices
14 # before rebooting.  This has been problematic in the past.
15 # Thierry : I'm enabling network since, for some reason, it ends up turned off on fedora9
16 for service in network util-vserver; do
17     chroot ${vdir} /sbin/chkconfig $service on
18 done
19
20 # Remove unneeded services
21 for service in vprocunhide vservers-default; do
22     chroot ${vdir} /sbin/chkconfig $service off
23 done
24
25 # Disable splaying of cron.
26 echo > ${vdir}/etc/sysconfig/crontab
27
28 # Add site_admin account
29 chroot ${vdir} /usr/sbin/useradd -p "" -u 502 -m site_admin
30
31 # NOTE:  This is added to relieve one site's Cisco router configuration that
32 # fails to recognize the host once the arping is sent out.
33 cat <<\EOF | patch -d ${vdir}/etc/sysconfig/network-scripts/
34 --- ifup-eth    2008-07-08 13:19:49.000000000 -0400
35 +++ ifup-eth-orig       2008-07-08 13:20:02.000000000 -0400
36 @@ -263,10 +263,10 @@
37      fi
38      
39      if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${IPADDR}/${PREFIX}" ; then
40 -        if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
41 -           echo $"Error, some other host already uses address ${IPADDR}."
42 -           exit 1
43 -        fi
44 +        #if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
45 +        #   echo $"Error, some other host already uses address ${IPADDR}."
46 +        #   exit 1
47 +        #fi
48          if ! ip addr add ${IPADDR}/${PREFIX} \
49             brd ${BROADCAST:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then
50             echo $"Error adding address ${IPADDR} for ${DEVICE}."
51 EOF