first stab at a systemd-compliant nodeimage post script - should turn on openvswitch
[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 enable network.service || :
18 # and turn off NetworkManager if present, as it quite obviously messes with network
19 chroot ${vdir} systemctl disable NetworkManager || :
20
21 # Disable splaying of cron.
22 echo > ${vdir}/etc/sysconfig/crontab
23
24 # Add site_admin account
25 chroot ${vdir} /usr/sbin/useradd -p "" -u 502 -m site_admin
26
27 # Add a logrotate script for btmp, which logs failed ssh logins, which can
28 # grow unbounded on public plnodes and fill the root fs.
29 cat <<EOF > ${vdir}/etc/logrotate.d/btmp
30 /var/log/btmp {
31     weekly
32     minsize 1M
33     create 0600 root utmp
34     rotate 2
35     compress
36     notifempty
37 }
38 EOF
39
40 #################### historical notes - see config.planetlab/nodeimage.post
41 # xxx turning OFF selinux
42 # there used to be some code for that in the historical/vserver version
43 # none of that code seems applicable in f16 anylonger
44
45 # also a horrible hack to the network initscripts has been removed