Use minimal selinux configuration and add modules selectively
[ovirt-node-image.git] / ovirt-node-image.ks
blob96e019370379f099cb045009d97f6fdc36ef9dbc
1 %include common-install.ks
3 %include repos.ks
5 %packages --excludedocs --nobase
6 %include common-pkgs.ks
8 %end
10 %post
11 # cleanup rpmdb to allow non-matching host and chroot RPM versions
12 rm -f /var/lib/rpm/__db*
13 %include common-post.ks
15 touch /.autorelabel
17 # enable newrole for initscripts
18 augtool <<EOF
19 ins 0 before /files/etc/pam.d/newrole/1
20 set /files/etc/pam.d/newrole/0/type auth
21 set /files/etc/pam.d/newrole/0/control sufficient
22 set /files/etc/pam.d/newrole/0/module pam_rootok.so
23 save
24 EOF
26 %end
28 %post
29 # Create initial manifests
30 manifests=/tmp/manifests
31 mkdir -p $manifests
32 rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \
33     > $manifests/rpm-manifest.txt
34 rpm -qa --qf '%{sourcerpm}\n' | sort -u > $manifests/srpm-manifest.txt
35 du -akx --exclude=/var/cache/yum / > $manifests/file-manifest.txt
36 du -x --exclude=/var/cache/yum / > $manifests/dir-manifest.txt
37 %end
39 %include common-blacklist.ks
41 %post --nochroot
42 if [ -f "ovirt-authorized_keys" ]; then
43   echo "Adding authorized_keys to Image"
44   mkdir -p $INSTALL_ROOT/root/.ssh
45   cp -v ovirt-authorized_keys $INSTALL_ROOT/root/.ssh/authorized_keys
46   chown -R root:root $INSTALL_ROOT/root/.ssh
47   chmod 755 $INSTALL_ROOT/root/.ssh
48   chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys
51 echo "Fixing boot menu"
52 # remove quiet from Node bootparams, added by livecd-creator
53 sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg
55 # add standalone boot entry
56 awk '
57 /label linux0/ { linux0=1 }
58 linux0=1 && /append / { append0=$0 }
59 /label check0/ {
60   print "label standalone0"
61   print "  menu label Boot in standalone mode"
62   print "  kernel vmlinuz0"
63   print append0" ovirt_standalone"
65 { print }
66 ' $LIVE_ROOT/isolinux/isolinux.cfg > $LIVE_ROOT/isolinux/isolinux.cfg.standalone
67 mv $LIVE_ROOT/isolinux/isolinux.cfg.standalone $LIVE_ROOT/isolinux/isolinux.cfg
69 %end
71 %post
72 # Create post-image processing manifests
73 manifests=/tmp/manifests
74 mkdir -p $manifests
75 rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \
76     > $manifests/rpm-manifest-post.txt
77 rpm -qa --qf '%{sourcerpm}\n' | sort -u > $manifests/srpm-manifest-post.txt
78 du -akx --exclude=/var/cache/yum / > $manifests/file-manifest-post.txt
79 du -x --exclude=/var/cache/yum / > $manifests/dir-manifest-post.txt
81 ver=$(rpm -q --qf '%{version}' ovirt-node)
82 rel=$(rpm -q --qf '%{release}' ovirt-node)
83 arch=$(rpm -q --qf '%{arch}' ovirt-node)
84 echo "oVirt Node release $ver-$rel-$arch" > $manifests/ovirt-release
85 tar -cvf ovirt-node-image-manifests-$ver-$rel.$arch.tar -C /tmp manifests
86 rm -Rf $manifests
87 %end
89 %post --nochroot
90 # Move manifest tar to build directory
91 mv $INSTALL_ROOT/ovirt-node-image-manifests-*.tar .
92 %end