alias vi to vi + restorecon
[ovirt-node-image.git] / ovirt-node-image.ks
blob802b6a5b8b18d61028a09e8ab4a04177690d25cb
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 NOT_OVIRT_FIRSTBOOT
20 set /files/etc/sysconfig/readonly-root/STATE_LABEL CONFIG
21 set /files/etc/sysconfig/readonly-root/STATE_MOUNT /config
22 save
23 EOF
24 # use persistent state unless firstboot is forced
25 # XXX auges shellvars lens does not accept this value
26 sed -i 's@NOT_OVIRT_FIRSTBOOT@$(if cat /proc/cmdline|grep -qv ovirt_firstboot; then printf "yes"; else printf "no"; fi)@' /etc/sysconfig/readonly-root
27 # prepare mount points for local storage
28 mkdir -p /boot
29 mkdir -p /config
30 mkdir -p /data
31 mkdir -p /liveos
32 echo "/dev/HostVG/Config /config ext3 defaults,noauto 0 0" >> /etc/fstab
33 %end
35 %post
36 # Create initial manifests
37 manifests=/tmp/manifests
38 mkdir -p $manifests
39 rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \
40     > $manifests/rpm-manifest.txt
41 rpm -qa --qf '%{sourcerpm}\n' | sort -u > $manifests/srpm-manifest.txt
42 du -akx --exclude=/var/cache/yum / > $manifests/file-manifest.txt
43 du -x --exclude=/var/cache/yum / > $manifests/dir-manifest.txt
44 %end
46 %include common-blacklist.ks
48 %post --nochroot
49 if [ -f "ovirt-authorized_keys" ]; then
50   echo "Adding authorized_keys to Image"
51   mkdir -p $INSTALL_ROOT/root/.ssh
52   cp -v ovirt-authorized_keys $INSTALL_ROOT/root/.ssh/authorized_keys
53   chown -R root:root $INSTALL_ROOT/root/.ssh
54   chmod 755 $INSTALL_ROOT/root/.ssh
55   chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys
58 echo "Fixing boot menu"
59 # remove quiet from Node bootparams, added by livecd-creator
60 sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg
62 # add stand-alone boot entry
63 awk '
64 BEGIN {
65   # append additional default boot parameters
66   add_boot_params="check"
68 /^label linux0/ { linux0=1 }
69 linux0==1 && $1=="append" {
70   $0=$0 " " add_boot_params
71   append0=$0
73 linux0==1 && $1=="label" && $2!="linux0" {
74   linux0=2
75   print "label stand-alone"
76   print "  menu label Boot in stand-alone mode"
77   print "  kernel vmlinuz0"
78   gsub("console=tty0", "", append0)
79   print append0" ovirt_standalone console=tty0"
81 { print }
82 ' $LIVE_ROOT/isolinux/isolinux.cfg > $LIVE_ROOT/isolinux/isolinux.cfg.standalone
83 mv $LIVE_ROOT/isolinux/isolinux.cfg.standalone $LIVE_ROOT/isolinux/isolinux.cfg
85 %end
87 %post
88 # Create post-image processing manifests
89 manifests=/tmp/manifests
90 mkdir -p $manifests
91 rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \
92     > $manifests/rpm-manifest-post.txt
93 rpm -qa --qf '%{sourcerpm}\n' | sort -u > $manifests/srpm-manifest-post.txt
94 du -akx --exclude=/var/cache/yum / > $manifests/file-manifest-post.txt
95 du -x --exclude=/var/cache/yum / > $manifests/dir-manifest-post.txt
97 ver=$(rpm -q --qf '%{version}' ovirt-node)
98 rel=$(rpm -q --qf '%{release}' ovirt-node)
99 arch=$(rpm -q --qf '%{arch}' ovirt-node)
100 echo "oVirt Node release $ver-$rel-$arch" > $manifests/ovirt-release
101 tar -cvf ovirt-node-image-manifests-$ver-$rel.$arch.tar -C /tmp manifests
102 ln -nf ovirt-node-image-manifests-$ver-$rel.$arch.tar ovirt-node-image-manifests.tar
103 rm -Rf $manifests
104 %end
106 %post --nochroot
107 # Move manifest tar to build directory
108 mv $INSTALL_ROOT/ovirt-node-image-manifests*.tar .
110 # only works on x86, x86_64
111 if [ "$(uname -i)" = "i386" -o "$(uname -i)" = "x86_64" ]; then
112     if [ ! -d $LIVE_ROOT/LiveOS ]; then mkdir -p $LIVE_ROOT/LiveOS ; fi
113     cp /usr/bin/livecd-iso-to-disk $LIVE_ROOT/LiveOS
114     cp /usr/bin/livecd-iso-to-pxeboot $LIVE_ROOT/LiveOS
116 %end