An attempt to overcome the lack of job control WRT pinging.
[ovirt-node-image.git] / ovirt-node-image.ks
blob39eed51385389c2d2494143acd191283d0903d25
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 # prepare for STATE_MOUNT in rc.sysinit
18 augtool <<EOF
19 set /files/etc/sysconfig/readonly-root/TEMPORARY_STATE yes
20 set /files/etc/sysconfig/readonly-root/STATE_LABEL CONFIG
21 set /files/etc/sysconfig/readonly-root/STATE_MOUNT /config
22 save
23 EOF
25 # prepare mount points for local storage
26 mkdir -p /boot
27 mkdir -p /config
28 mkdir -p /data
29 mkdir -p /liveos
30 echo "/dev/HostVG/Config /config ext3 defaults,noauto 0 0" >> /etc/fstab
31 %end
33 %post
34 # Create initial manifests
35 manifests=/tmp/manifests
36 mkdir -p $manifests
37 rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \
38     > $manifests/rpm-manifest.txt
39 rpm -qa --qf '%{sourcerpm}\n' | sort -u > $manifests/srpm-manifest.txt
40 du -akx --exclude=/var/cache/yum / > $manifests/file-manifest.txt
41 du -x --exclude=/var/cache/yum / > $manifests/dir-manifest.txt
42 %end
44 %include common-blacklist.ks
46 %post --nochroot
47 if [ -f "ovirt-authorized_keys" ]; then
48   echo "Adding authorized_keys to Image"
49   mkdir -p $INSTALL_ROOT/root/.ssh
50   cp -v ovirt-authorized_keys $INSTALL_ROOT/root/.ssh/authorized_keys
51   chown -R root:root $INSTALL_ROOT/root/.ssh
52   chmod 755 $INSTALL_ROOT/root/.ssh
53   chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys
56 echo "Fixing boot menu"
57 # remove quiet from Node bootparams, added by livecd-creator
58 sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg
60 # add stand-alone boot entry
61 awk '
62 BEGIN {
63   # append additional default boot parameters
64   add_boot_params="check rootfstype=iso9660"
66 /^label linux0/ { linux0=1 }
67 linux0==1 && $1=="append" {
68   $0=$0 " " add_boot_params
69   append0=$0
71 linux0==1 && $1=="label" && $2!="linux0" {
72   linux0=2
73   print "label stand-alone"
74   print "  menu label Boot in stand-alone mode"
75   print "  kernel vmlinuz0"
76   gsub("console=tty0", "", append0)
77   print append0" ovirt_standalone console=tty0"
79 { print }
80 ' $LIVE_ROOT/isolinux/isolinux.cfg > $LIVE_ROOT/isolinux/isolinux.cfg.standalone
81 mv $LIVE_ROOT/isolinux/isolinux.cfg.standalone $LIVE_ROOT/isolinux/isolinux.cfg
83 %end
85 %post
86 # Create post-image processing manifests
87 manifests=/tmp/manifests
88 mkdir -p $manifests
89 rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \
90     > $manifests/rpm-manifest-post.txt
91 rpm -qa --qf '%{sourcerpm}\n' | sort -u > $manifests/srpm-manifest-post.txt
92 du -akx --exclude=/var/cache/yum / > $manifests/file-manifest-post.txt
93 du -x --exclude=/var/cache/yum / > $manifests/dir-manifest-post.txt
95 ver=$(rpm -q --qf '%{version}' ovirt-node)
96 rel=$(rpm -q --qf '%{release}' ovirt-node)
97 arch=$(rpm -q --qf '%{arch}' ovirt-node)
98 echo "oVirt Node release $ver-$rel-$arch" > $manifests/ovirt-release
99 tar -cvf ovirt-node-image-manifests-$ver-$rel.$arch.tar -C /tmp manifests
100 ln -nf ovirt-node-image-manifests-$ver-$rel.$arch.tar ovirt-node-image-manifests.tar
101 rm -Rf $manifests
102 %end
104 %post --nochroot
105 # Move manifest tar to build directory
106 mv $INSTALL_ROOT/ovirt-node-image-manifests*.tar .
107 %end