psycopg2 dependency for sfa
[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 # turn off firstboot if present, might cause the node to hang
22 for service in vprocunhide vservers-default firstboot; do
23     chroot ${vdir} /sbin/chkconfig $service off || :
24 done
25
26 # Disable splaying of cron.
27 echo > ${vdir}/etc/sysconfig/crontab
28
29 # Add site_admin account
30 chroot ${vdir} /usr/sbin/useradd -p "" -u 502 -m site_admin
31
32 # NOTE:  This is added to relieve one site's Cisco router configuration that
33 # fails to recognize the host once the arping is sent out.
34 # NOTE: this is pretty fragile, and fails on fedora 10 that as of today (oct. 20 2009) 
35 # has initscripts-8.86.3-1.i386 which reads almost identical but with /sbin/arping instead
36 cat <<\EOF | patch -d ${vdir}/etc/sysconfig/network-scripts/
37 --- ifup-eth    2008-07-08 13:19:49.000000000 -0400
38 +++ ifup-eth-orig       2008-07-08 13:20:02.000000000 -0400
39 @@ -263,10 +263,10 @@
40      fi
41      
42      if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${IPADDR}/${PREFIX}" ; then
43 -        if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
44 -           echo $"Error, some other host already uses address ${IPADDR}."
45 -           exit 1
46 -        fi
47 +        #if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
48 +        #   echo $"Error, some other host already uses address ${IPADDR}."
49 +        #   exit 1
50 +        #fi
51          if ! ip addr add ${IPADDR}/${PREFIX} \
52             brd ${BROADCAST:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then
53             echo $"Error adding address ${IPADDR} for ${DEVICE}."
54 EOF