[Ovirt-devel] [PATCH] move dracut config and patching to spec

Alan Pevec apevec at redhat.com
Sat Jul 23 23:10:34 UTC 2011


this is cleaner and avoids rebuilding initramfs in the kickstart post
it is built with correct configuration for the node image the first
time, in kernel posttrans
---
 dracut/Makefile.am                                 |    3 +
 ...-3d88d27810acc7782618d67a03ff5c0e41494ca4.patch |   20 ++++++++
 ...-93724aa28fc20c8b7f0167201d1759b7118ba890.patch |   37 +++++++++++++++
 dracut/ovirt-dracut.conf                           |    1 +
 ovirt-node.spec.in                                 |   26 ++++++++++-
 recipe/Makefile.am                                 |    2 -
 recipe/common-initrd.ks                            |   48 --------------------
 recipe/ovirt-node-image.ks.in                      |    2 -
 8 files changed, 86 insertions(+), 53 deletions(-)
 create mode 100644 dracut/dracut-3d88d27810acc7782618d67a03ff5c0e41494ca4.patch
 create mode 100644 dracut/dracut-93724aa28fc20c8b7f0167201d1759b7118ba890.patch
 create mode 100644 dracut/ovirt-dracut.conf
 delete mode 100644 recipe/common-initrd.ks

diff --git a/dracut/Makefile.am b/dracut/Makefile.am
index df51be1..937a3c1 100644
--- a/dracut/Makefile.am
+++ b/dracut/Makefile.am
@@ -16,6 +16,9 @@
 # also available at http://www.gnu.org/copyleft/gpl.html.
 
 EXTRA_DIST = \
+  dracut-3d88d27810acc7782618d67a03ff5c0e41494ca4.patch \
+  dracut-93724aa28fc20c8b7f0167201d1759b7118ba890.patch \
+  ovirt-dracut.conf \
   check \
   install \
   ovirt-cleanup.sh
diff --git a/dracut/dracut-3d88d27810acc7782618d67a03ff5c0e41494ca4.patch b/dracut/dracut-3d88d27810acc7782618d67a03ff5c0e41494ca4.patch
new file mode 100644
index 0000000..c012a6c
--- /dev/null
+++ b/dracut/dracut-3d88d27810acc7782618d67a03ff5c0e41494ca4.patch
@@ -0,0 +1,20 @@
+From 3d88d27810acc7782618d67a03ff5c0e41494ca4 Mon Sep 17 00:00:00 2001
+From: Will Woods <wwoods at redhat.com>
+Date: Tue, 8 Mar 2011 18:35:11 -0500
+Subject: [PATCH] Fix bash logic typo/buglet ([ condition ] & expression)
+
+---
+ modules.d/90dmsquash-live/dmsquash-live-root |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+--- modules.d/90dmsquash-live/dmsquash-live-root.orig	2011-07-22 02:16:51.013118899 +0200
++++ modules.d/90dmsquash-live/dmsquash-live-root	2011-07-22 02:17:01.592391181 +0200
+@@ -24,7 +24,7 @@
+ overlay=$(getarg overlay)
+ 
+ # FIXME: we need to be able to hide the plymouth splash for the check really
+-[ -e $livedev ] & fs=$(blkid -s TYPE -o value $livedev)
++[ -e $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
+ if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
+     check="yes"
+ fi
diff --git a/dracut/dracut-93724aa28fc20c8b7f0167201d1759b7118ba890.patch b/dracut/dracut-93724aa28fc20c8b7f0167201d1759b7118ba890.patch
new file mode 100644
index 0000000..2447cb9
--- /dev/null
+++ b/dracut/dracut-93724aa28fc20c8b7f0167201d1759b7118ba890.patch
@@ -0,0 +1,37 @@
+From 93724aa28fc20c8b7f0167201d1759b7118ba890 Mon Sep 17 00:00:00 2001
+From: Alan Pevec <apevec at redhat.com>
+Date: Thu, 7 Apr 2011 01:53:51 +0200
+Subject: [PATCH] dmsquash-live: hide plymouth while checking ISO
+
+Fixes long-standing FIXME
+Latest isomd5sum added an option to abort media check with ESC key,
+but that key is taken by plymouth for switching to the detailed log
+messages, making it impossible to abort checkisomd5.
+Tested in text mode.
+---
+ modules.d/90dmsquash-live/dmsquash-live-root |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+--- modules.d/90dmsquash-live/dmsquash-live-root.orig	2011-07-22 02:02:58.000000000 +0200
++++ modules.d/90dmsquash-live/dmsquash-live-root	2011-07-22 02:07:20.873266232 +0200
+@@ -23,18 +23,19 @@
+ getarg readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
+ overlay=$(getarg overlay)
+ 
+-# FIXME: we need to be able to hide the plymouth splash for the check really
+ [ -e $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
+ if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
+     check="yes"
+ fi
+ getarg check || check=""
+ if [ -n "$check" ]; then
++    [ -x /bin/plymouth ] && /bin/plymouth --hide-splash
+     checkisomd5 --verbose $livedev || :
+     if [ $? -ne 0 ]; then
+ 	die "CD check failed!"
+ 	exit 1
+     fi
++    [ -x /bin/plymouth ] && /bin/plymouth --show-splash
+ fi
+ 
+ getarg ro && liverw=ro
diff --git a/dracut/ovirt-dracut.conf b/dracut/ovirt-dracut.conf
new file mode 100644
index 0000000..e2f8eec
--- /dev/null
+++ b/dracut/ovirt-dracut.conf
@@ -0,0 +1 @@
+add_dracutmodules+="ovirtnode multipath"
diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index 4bb7baf..33a903d 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -48,6 +48,11 @@ Requires:       python-gudev
 Requires:       PyPAM
 Requires:       ethtool
 Requires:       cracklib-python
+Requires:       dracut
+%if 0%{?rhel}
+# for applying patches in %post
+Requires:       patch
+%endif
 
 BuildArch:      noarch
 
@@ -90,6 +95,7 @@ make install DESTDIR=%{buildroot}
 %{__install} -d -m0755 %{buildroot}%{mgmt_scripts_dir}
 %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/cron.d
 %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d
+%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/dracut.conf.d
 
 %{__install} -p -m0755 scripts/node-config %{buildroot}%{_sysconfdir}/sysconfig
 
@@ -108,6 +114,12 @@ make install DESTDIR=%{buildroot}
 %{__install} -p -m0755 dracut/install %{buildroot}%{_datadir}/dracut/modules.d/91ovirtnode
 %{__install} -p -m0755 scripts/ovirt-boot-functions %{buildroot}%{_datadir}/dracut/modules.d/91ovirtnode
 %{__install} -p -m0755 dracut/ovirt-cleanup.sh %{buildroot}%{_datadir}/dracut/modules.d/91ovirtnode
+%{__install} -p -m0644 dracut/ovirt-dracut.conf %{buildroot}%{_sysconfdir}/dracut.conf.d
+%if 0%{?rhel}
+# dracut patches for rhel6
+%{__install} -p -m0644 dracut/dracut-3d88d27810acc7782618d67a03ff5c0e41494ca4.patch %{buildroot}%{app_root}
+%{__install} -p -m0644 dracut/dracut-93724aa28fc20c8b7f0167201d1759b7118ba890.patch %{buildroot}%{app_root}
+%endif
 
 # resolv.conf augeas lens
 %{__install} -d -m0755 %{buildroot}/usr/share/augeas/lenses
@@ -165,8 +177,15 @@ echo "# File where default configuration is kept" > %{buildroot}/%{_sysconfdir}/
 /sbin/chkconfig --add ovirt-post
 # workaround for imgcreate/live.py __copy_efi_files
 if [ ! -e /boot/grub/splash.xpm.gz ]; then
-  cp /usr/share/ovirt-node/grub-splash.xpm.gz /boot/grub/splash.xpm.gz
+  cp %{app_root}/grub-splash.xpm.gz /boot/grub/splash.xpm.gz
 fi
+%if 0%{?rhel}
+# apply dracut fixes not in rhel6
+# rhbz#683330
+# dracut.git commits rediffed for dracut-004-53.el6
+patch -d /usr/share/dracut/ -p0 < %{app_root}/dracut-3d88d27810acc7782618d67a03ff5c0e41494ca4.patch
+patch -d /usr/share/dracut/ -p0 < %{app_root}/dracut-93724aa28fc20c8b7f0167201d1759b7118ba890.patch
+%endif
 
 %preun
 if [ $1 = 0 ] ; then
@@ -206,6 +225,10 @@ fi
 %{app_root}/grub-splash.xpm.gz
 # end i386 bits
 %{app_root}/syslinux-vesa-splash.jpg
+%if 0%{?rhel}
+%{app_root}/dracut-3d88d27810acc7782618d67a03ff5c0e41494ca4.patch
+%{app_root}/dracut-93724aa28fc20c8b7f0167201d1759b7118ba890.patch
+%endif
 
 %{_datadir}/augeas/lenses/build.aug
 %{_datadir}/augeas/lenses/resolv.aug
@@ -214,6 +237,7 @@ fi
 %{_datadir}/dracut/modules.d/91ovirtnode/install
 %{_datadir}/dracut/modules.d/91ovirtnode/ovirt-boot-functions
 %{_datadir}/dracut/modules.d/91ovirtnode/ovirt-cleanup.sh
+%{_sysconfdir}/dracut.conf.d/ovirt-dracut.conf
 %{_libexecdir}/ovirt-config-boot
 %{_libexecdir}/ovirt-config-boot-wrapper
 %{_libexecdir}/ovirt-config-hostname
diff --git a/recipe/Makefile.am b/recipe/Makefile.am
index 1de1646..87b0c68 100644
--- a/recipe/Makefile.am
+++ b/recipe/Makefile.am
@@ -37,7 +37,6 @@ OVIRT_NODE_TOOLS_DATA =         \
         *-post.ks        \
         *-minimizer.ks   \
         common-nochroot.ks \
-        common-initrd.ks   \
         common-manifest.ks \
         $(PACKAGE).ks
 
@@ -47,7 +46,6 @@ EXTRA_DIST =                    \
         *-post.ks        \
         *-minimizer.ks   \
         common-nochroot.ks \
-        common-initrd.ks   \
         common-manifest.ks \
         $(PACKAGE).ks.in        \
         $(PACKAGE).ks
diff --git a/recipe/common-initrd.ks b/recipe/common-initrd.ks
deleted file mode 100644
index 90fda3d..0000000
--- a/recipe/common-initrd.ks
+++ /dev/null
@@ -1,48 +0,0 @@
-%post
-
-# patch dmsquash-live dracut module
-# rhbz#683330
-# http://article.gmane.org/gmane.linux.kernel.initramfs/1879
-patch -d /usr/share/dracut/ -p1 << \EOF_DMSQUASH
---- a/modules.d/90dmsquash-live/dmsquash-live-root
-+++ b/modules.d/90dmsquash-live/dmsquash-live-root
-@@ -23,18 +23,19 @@
- getarg readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
- overlay=$(getarg overlay)
- 
--# FIXME: we need to be able to hide the plymouth splash for the check really
--[ -e $livedev ] & fs=$(blkid -s TYPE -o value $livedev)
-+[ -e $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
- if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
-     check="yes"
- fi
- getarg check || check=""
- if [ -n "$check" ]; then
-+    [ -x /bin/plymouth ] && /bin/plymouth --hide-splash
-     checkisomd5 --verbose $livedev || :
-     if [ $? -ne 0 ]; then
- 	die "CD check failed!"
- 	exit 1
-     fi
-+    [ -x /bin/plymouth ] && /bin/plymouth --show-splash
- fi
- 
- getarg ro && liverw=ro
-EOF_DMSQUASH
-
-# rebuild initramfs to include multipath rhbz#627647
-echo -n "Rebuilding initramfs for multipath and disk cleanup..."
-kernel="$(rpm -q --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' kernel)"
-/sbin/dracut -f -a "ovirtnode" -a "multipath" /initrd0.img "$kernel"
-echo "done."
-
-%end
-
-%post --nochroot
-
-# replace initramfs if regenerated
-if [ -f "$INSTALL_ROOT/initrd0.img" ]; then
-  mv -v "$INSTALL_ROOT/initrd0.img" "$LIVE_ROOT/isolinux/initrd0.img"
-fi
-
-%end
diff --git a/recipe/ovirt-node-image.ks.in b/recipe/ovirt-node-image.ks.in
index 2c9fcf6..5eaa813 100644
--- a/recipe/ovirt-node-image.ks.in
+++ b/recipe/ovirt-node-image.ks.in
@@ -21,8 +21,6 @@
 
 %end
 
-%include common-initrd.ks
-
 %post --nochroot --interpreter image-minimizer
 %include common-minimizer.ks
 %include @DISTRO at -minimizer.ks
-- 
1.7.3.4




More information about the ovirt-devel mailing list