4 if [ -z "${vdir}" ] ; then
6 echo "Provide the directory of the root filesystem to operate on"
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
14 # NOTE: we're enabling util-vserver to allow it to help shutdown all slices
15 # before rebooting. This has been problematic in the past
16 chroot ${vdir} /sbin/chkconfig util-vserver on
17 # enabling network; it ends up turned off starting with fedora9, probably related to NetworkManager
18 chroot ${vdir} /sbin/chkconfig network on
20 # turn OFF firstboot if present, might cause the node to hang
21 chroot ${vdir} /sbin/chkconfig firstboot off || :
22 # turn OFF vservers-default ; this is to automatically restart vservers, let nm do that
23 chroot ${vdir} /sbin/chkconfig vservers-default off || :
24 # turn ON vprocunhide ; is required with kernels that have CONFIG_VSERVER_PROC_SECURE enabled
25 # which is the case for our k32 kernel
26 chroot ${vdir} /sbin/chkconfig vprocunhide on || :
28 # turn OFF selinux if set
29 # this may happen accidentally if you mention too much stuff in bootstrapfs.pkgs
30 for file in /etc/sysconfig/selinux /sbin/load_policy; do
31 [ -f ${vdir}/${file} ] || { echo "$file not found in $vdir - fine" ; continue; }
32 selinuxrpm=$(chroot ${vdir} rpm -qf ${file})
33 if [ -z "$selinuxrpm" ] ; then
34 echo "SElinux: warning : could not rpm for file $file"
36 echo "Force-removing package ${selinuxrpm}"
37 chroot ${vdir} rpm -e --nodeps ${selinuxrpm}
41 # Disable splaying of cron.
42 echo > ${vdir}/etc/sysconfig/crontab
44 # Add site_admin account
45 chroot ${vdir} /usr/sbin/useradd -p "" -u 502 -m site_admin
47 # Remove 32bit packages from 64bit system (http://wiki.centos.org/FAQ/General#head-357346ff0bf7c14b0849c3bcce39677aaca528e9)
48 # use rpm instead of yum as /proc is not mounted at that poing
49 if echo ${vdir} | grep -q x86_64 ; then
50 chroot ${vdir} rpm -qa --qf '%{name}.%{arch}\n' | grep 'i[36]86$' | xargs chroot ${vdir} rpm -e
53 # NOTE: This is added to relieve one site's Cisco router configuration that
54 # fails to recognize the host once the arping is sent out.
55 # NOTE: this is pretty fragile, and fails on fedora 10 that as of today (oct. 20 2009)
56 # has initscripts-8.86.3-1.i386 which reads almost identical but with /sbin/arping instead
57 # NOTE: this might work with fedora8 and centos5
58 # the other distros will probably just fail to add this patch
59 cat <<\EOF | patch -d ${vdir}/etc/sysconfig/network-scripts/
60 --- ifup-eth 2008-07-08 13:19:49.000000000 -0400
61 +++ ifup-eth-orig 2008-07-08 13:20:02.000000000 -0400
65 if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${IPADDR}/${PREFIX}" ; then
66 - if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
67 - echo $"Error, some other host already uses address ${IPADDR}."
70 + #if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
71 + # echo $"Error, some other host already uses address ${IPADDR}."
74 if ! ip addr add ${IPADDR}/${PREFIX} \
75 brd ${BROADCAST:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then
76 echo $"Error adding address ${IPADDR} for ${DEVICE}."