refine strategy to spot ip address, keep on calling guest_ipv4
[build.git] / config.lxc / nodeimage.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 # Tweaking services
14 # turn ON openvswitch as it is required for the privatebridge nm plugin
15 chroot ${vdir} systemctl enable openvswitch.service || :
16 # enabling network as it ends up turned off on systems that come with NetworkManager, starting with fedora9
17 chroot ${vdir} systemctl disable network.service || :
18 # and turn off NetworkManager if present, as it quite obviously messes with network
19 chroot ${vdir} systemctl enable NetworkManager.service || :
20 # turn on ntpd
21 chroot ${vdir} systemctl enable ntpd.service || :
22 # tentatively turn on getty on tty1
23 chroot ${vdir} systemctl enable getty@tty1.service || :
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 # Add a logrotate script for btmp, which logs failed ssh logins, which can
32 # grow unbounded on public plnodes and fill the root fs.
33 cat <<EOF > ${vdir}/etc/logrotate.d/btmp
34 /var/log/btmp {
35     weekly
36     minsize 1M
37     create 0600 root utmp
38     rotate 2
39     compress
40     notifempty
41 }
42 EOF
43
44 #################### historical notes - see config.planetlab/nodeimage.post
45 # xxx turning OFF selinux
46 # there used to be some code for that in the historical/vserver version
47 # none of that code seems applicable in f16 any longer
48 #
49 # also a horrible hack to the network initscripts has been removed