From 22a1cb863f688a14222a60aa57fb2d30a473cd06 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mar 13 2013 08:40:57 +0000 Subject: dracut-026-19.git20130313 - fix switch-root and local-fs.target problem - add norescue and nohostonly subpackages --- diff --git a/0015-dracut.spec-add-nohostonly-and-norescue-subpackages.patch b/0015-dracut.spec-add-nohostonly-and-norescue-subpackages.patch new file mode 100644 index 0000000..8817de2 --- /dev/null +++ b/0015-dracut.spec-add-nohostonly-and-norescue-subpackages.patch @@ -0,0 +1,66 @@ +From e22eb857bef9eb1d927049b13d6d60afc1f69a0d Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 12 Mar 2013 13:50:58 +0100 +Subject: [PATCH] dracut.spec: add nohostonly and norescue subpackages + +we need rpm subpackages, to be able to pull them in the installation +transaction for the initial %posttrans initramfs image creation. +--- + dracut.spec | 29 ++++++++++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/dracut.spec b/dracut.spec +index 940d364..65112cb 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -153,6 +153,22 @@ Requires: libcap + This package requires everything which is needed to build an + initramfs with dracut, which drops capabilities. + ++%package nohostonly ++Summary: dracut configuration to turn off hostonly image generation ++Requires: %{name} = %{version}-%{release} ++ ++%description nohostonly ++This package provides the configuration to turn off the host specific initramfs ++generation with dracut. ++ ++%package norescue ++Summary: dracut configuration to turn off rescue image generation ++Requires: %{name} = %{version}-%{release} ++ ++%description norescue ++This package provides the configuration to turn off the rescue initramfs ++generation with dracut. ++ + %package tools + Summary: dracut tools to build the local initramfs + Requires: %{name} = %{version}-%{release} +@@ -235,10 +251,13 @@ rm $RPM_BUILD_ROOT%{_bindir}/mkinitrd + rm $RPM_BUILD_ROOT%{_bindir}/lsinitrd + %endif + +-# FIXME: remove after F19 + %if 0%{?fedora} || 0%{?rhel} > 6 ++# FIXME: remove after F19 + mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d + install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh ++ ++echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-nohostonly.conf ++echo 'dracut_rescue_image="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-norescue.conf + %endif + + mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d +@@ -387,4 +406,12 @@ rm -rf $RPM_BUILD_ROOT + %dir /var/lib/dracut + %dir /var/lib/dracut/overlay + ++%files nohostonly ++%defattr(-,root,root,0755) ++%{dracutlibdir}/dracut.conf.d/02-nohostonly.conf ++ ++%files norescue ++%defattr(-,root,root,0755) ++%{dracutlibdir}/dracut.conf.d/02-norescue.conf ++ + %changelog diff --git a/0016-lsinitrd.sh-simplify-check-for-boot-loader-spec-dirs.patch b/0016-lsinitrd.sh-simplify-check-for-boot-loader-spec-dirs.patch new file mode 100644 index 0000000..02966b7 --- /dev/null +++ b/0016-lsinitrd.sh-simplify-check-for-boot-loader-spec-dirs.patch @@ -0,0 +1,22 @@ +From d26bd6ca55c96e06d614fc9d5ad73dc6d83d5438 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 08:23:18 +0100 +Subject: [PATCH] lsinitrd.sh: simplify check for boot loader spec dirs + +--- + lsinitrd.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lsinitrd.sh b/lsinitrd.sh +index 5cd8c2a..1b27393 100755 +--- a/lsinitrd.sh ++++ b/lsinitrd.sh +@@ -57,7 +57,7 @@ if [[ "$1" ]]; then + else + [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id + +- if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then ++ if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then + image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd" + else + image="/boot/initramfs-${KERNEL_VERSION}.img" diff --git a/0017-51-dracut-rescue.install-create-directory-if-it-does.patch b/0017-51-dracut-rescue.install-create-directory-if-it-does.patch new file mode 100644 index 0000000..b13dcf4 --- /dev/null +++ b/0017-51-dracut-rescue.install-create-directory-if-it-does.patch @@ -0,0 +1,25 @@ +From c0c6c74d99a06a4ccdc2ddc8849bbe073e5bcbce Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 08:04:08 +0100 +Subject: [PATCH] 51-dracut-rescue.install: create directory, if it does not + exist + +--- + 51-dracut-rescue.install | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install +index 94f064c..1c0a6e1 100755 +--- a/51-dracut-rescue.install ++++ b/51-dracut-rescue.install +@@ -61,7 +61,9 @@ case "$COMMAND" in + + [[ $dracut_rescue_image != "yes" ]] && exit 0 + +- if ! cp --preserve "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then ++ [[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS" ++ ++ if ! cp "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then + echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'!" >&2 + fi + diff --git a/0018-systemd-local-fs.target-is-now-root-fs.target-and-in.patch b/0018-systemd-local-fs.target-is-now-root-fs.target-and-in.patch new file mode 100644 index 0000000..564d7ba --- /dev/null +++ b/0018-systemd-local-fs.target-is-now-root-fs.target-and-in.patch @@ -0,0 +1,201 @@ +From c85cda9e2f72c655c01452956bda629bbecb9e55 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 08:04:25 +0100 +Subject: [PATCH] systemd: local-fs.target is now root-fs.target and + initrd-fs.target + +Also rename dracut.target to initrd.target + +see also systemd commit 700e07f +http://cgit.freedesktop.org/systemd/systemd/commit/?id=700e07f +--- + dracut.spec | 3 ++- + modules.d/98systemd/dracut-mount.service | 4 ++-- + modules.d/98systemd/dracut-pre-mount.service | 2 +- + modules.d/98systemd/dracut-pre-pivot.service | 4 ++-- + modules.d/98systemd/emergency.service | 2 +- + .../98systemd/{dracut.target => initrd.target} | 6 ++---- + modules.d/98systemd/module-setup.sh | 24 ++++++++++++---------- + modules.d/99base/dracut-lib.sh | 6 +++--- + 8 files changed, 26 insertions(+), 25 deletions(-) + rename modules.d/98systemd/{dracut.target => initrd.target} (73%) + +diff --git a/dracut.spec b/dracut.spec +index 65112cb..06149de 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -87,7 +87,8 @@ Requires: kbd kbd-misc + + %if 0%{?fedora} || 0%{?rhel} > 6 + Requires: util-linux >= 2.21 +-Conflicts: systemd < 198 ++Conflicts: systemd < 198-4 ++Conflicts: grubby < 8.23 + %else + Requires: util-linux-ng >= 2.21 + %endif +diff --git a/modules.d/98systemd/dracut-mount.service b/modules.d/98systemd/dracut-mount.service +index b478067..b26b8a5 100644 +--- a/modules.d/98systemd/dracut-mount.service ++++ b/modules.d/98systemd/dracut-mount.service +@@ -11,8 +11,8 @@ + Description=dracut mount hook + Documentation=man:dracut-mount.service(8) + DefaultDependencies=no +-After=dracut-pre-mount.service dracut-initqueue.service initrd-parse-etc.service local-fs.target +-Wants=local-fs.target ++After=dracut-pre-mount.service dracut-initqueue.service initrd-parse-etc.service root-fs.target initrd-fs.target ++Wants=root-fs.target initrd-fs.target + ConditionPathExists=/etc/initrd-release + ConditionDirectoryNotEmpty=|/lib/dracut/hooks/mount + ConditionKernelCommandLine=|rd.break=mount +diff --git a/modules.d/98systemd/dracut-pre-mount.service b/modules.d/98systemd/dracut-pre-mount.service +index 39c830c..17bfda9 100644 +--- a/modules.d/98systemd/dracut-pre-mount.service ++++ b/modules.d/98systemd/dracut-pre-mount.service +@@ -11,7 +11,7 @@ + Description=dracut pre-mount hook + Documentation=man:dracut-pre-mount.service(8) + DefaultDependencies=no +-Before=sysroot.mount local-fs.target ++Before=sysroot.mount root-fs.target + After=dracut-initqueue.service + After=cryptsetup.target + ConditionPathExists=/etc/initrd-release +diff --git a/modules.d/98systemd/dracut-pre-pivot.service b/modules.d/98systemd/dracut-pre-pivot.service +index 40a0fb1..49f76ef 100644 +--- a/modules.d/98systemd/dracut-pre-pivot.service ++++ b/modules.d/98systemd/dracut-pre-pivot.service +@@ -11,8 +11,8 @@ + Description=dracut pre-pivot and cleanup hook + Documentation=man:dracut-pre-pivot.service(8) + DefaultDependencies=no +-After=dracut-mount.service dracut-initqueue.service initrd-parse-etc.service local-fs.target +-Wants=local-fs.target ++After=dracut-mount.service dracut-initqueue.service initrd-parse-etc.service initrd-fs.target root-fs.target ++Wants=initrd-fs.target root-fs.target + Before=initrd-cleanup.service + ConditionPathExists=/etc/initrd-release + ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-pivot +diff --git a/modules.d/98systemd/emergency.service b/modules.d/98systemd/emergency.service +index 22115be..18bb45f 100644 +--- a/modules.d/98systemd/emergency.service ++++ b/modules.d/98systemd/emergency.service +@@ -17,7 +17,7 @@ Wants=systemd-vconsole-setup.service + Environment=HOME=/ + WorkingDirectory=/ + ExecStart=/bin/dracut-emergency +-ExecStopPost=-/usr/bin/systemctl --no-block isolate dracut.target ++ExecStopPost=-/usr/bin/systemctl --no-block isolate initrd.target + Type=oneshot + StandardInput=tty-force + StandardOutput=inherit +diff --git a/modules.d/98systemd/dracut.target b/modules.d/98systemd/initrd.target +similarity index 73% +rename from modules.d/98systemd/dracut.target +rename to modules.d/98systemd/initrd.target +index 08a22d2..19494d4 100644 +--- a/modules.d/98systemd/dracut.target ++++ b/modules.d/98systemd/initrd.target +@@ -1,11 +1,9 @@ + [Unit] +-Description=dracut ++Description=Initrd Target + Requires=basic.target + Conflicts=rescue.service rescue.target + After=basic.target rescue.service rescue.target + AllowIsolate=yes + OnFailure=emergency.target + OnFailureIsolate=yes +- +-[Install] +-Alias=default.target ++ConditionPathExists=/etc/initrd-release +diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh +index 32d4be5..443481a 100755 +--- a/modules.d/98systemd/module-setup.sh ++++ b/modules.d/98systemd/module-setup.sh +@@ -45,6 +45,8 @@ install() { + $systemdsystemunitdir/basic.target \ + $systemdsystemunitdir/halt.target \ + $systemdsystemunitdir/kexec.target \ ++ $systemdsystemunitdir/initrd-fs.target \ ++ $systemdsystemunitdir/root-fs.target \ + $systemdsystemunitdir/local-fs.target \ + $systemdsystemunitdir/local-fs-pre.target \ + $systemdsystemunitdir/remote-fs.target \ +@@ -139,7 +141,7 @@ install() { + + dracutsystemunitdir="/etc/systemd/system" + +- mkdir -p "${initdir}${dracutsystemunitdir}/dracut.target.wants" ++ mkdir -p "${initdir}${dracutsystemunitdir}/initrd.target.wants" + + mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.d" + { +@@ -148,38 +150,38 @@ install() { + echo "After=emergency.service emergency.target" + } > "${initdir}${systemdsystemunitdir}/sysinit.target.d/nolocalfs.conf" + +- inst_simple "$moddir/dracut.target" ${dracutsystemunitdir}/dracut.target +- ln -fs ${dracutsystemunitdir}/dracut.target "${initdir}${systemdsystemunitdir}/default.target" ++ inst_simple "$moddir/initrd.target" ${dracutsystemunitdir}/initrd.target ++ ln -fs ${dracutsystemunitdir}/initrd.target "${initdir}${systemdsystemunitdir}/default.target" + + inst_script "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline + inst_simple "$moddir/dracut-cmdline.service" ${dracutsystemunitdir}/dracut-cmdline.service +- ln -fs ../dracut-cmdline.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-cmdline.service" ++ ln -fs ../dracut-cmdline.service "${initdir}${dracutsystemunitdir}/initrd.target.wants/dracut-cmdline.service" + + inst_script "$moddir/dracut-pre-udev.sh" /bin/dracut-pre-udev + inst_simple "$moddir/dracut-pre-udev.service" ${dracutsystemunitdir}/dracut-pre-udev.service +- ln -fs ../dracut-pre-udev.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-pre-udev.service" ++ ln -fs ../dracut-pre-udev.service "${initdir}${dracutsystemunitdir}/initrd.target.wants/dracut-pre-udev.service" + + inst_script "$moddir/dracut-pre-trigger.sh" /bin/dracut-pre-trigger + inst_simple "$moddir/dracut-pre-trigger.service" ${dracutsystemunitdir}/dracut-pre-trigger.service +- ln -fs ../dracut-pre-trigger.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-pre-trigger.service" ++ ln -fs ../dracut-pre-trigger.service "${initdir}${dracutsystemunitdir}/initrd.target.wants/dracut-pre-trigger.service" + + inst_script "$moddir/dracut-initqueue.sh" /bin/dracut-initqueue + inst_simple "$moddir/dracut-initqueue.service" ${dracutsystemunitdir}/dracut-initqueue.service +- ln -fs ../dracut-initqueue.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-initqueue.service" ++ ln -fs ../dracut-initqueue.service "${initdir}${dracutsystemunitdir}/initrd.target.wants/dracut-initqueue.service" + + inst_script "$moddir/dracut-pre-mount.sh" /bin/dracut-pre-mount + inst_simple "$moddir/dracut-pre-mount.service" ${dracutsystemunitdir}/dracut-pre-mount.service +- ln -fs ../dracut-pre-mount.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-pre-mount.service" ++ ln -fs ../dracut-pre-mount.service "${initdir}${dracutsystemunitdir}/initrd.target.wants/dracut-pre-mount.service" + + inst_script "$moddir/dracut-mount.sh" /bin/dracut-mount + inst_simple "$moddir/dracut-mount.service" ${dracutsystemunitdir}/dracut-mount.service +- ln -fs ../dracut-mount.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-mount.service" ++ ln -fs ../dracut-mount.service "${initdir}${dracutsystemunitdir}/initrd.target.wants/dracut-mount.service" + + inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot + inst_simple "$moddir/dracut-pre-pivot.service" ${dracutsystemunitdir}/dracut-pre-pivot.service +- ln -fs ../dracut-pre-pivot.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-pre-pivot.service" ++ ln -fs ../dracut-pre-pivot.service "${initdir}${dracutsystemunitdir}/initrd.target.wants/dracut-pre-pivot.service" + +- ln -fs ../initrd-parse-etc.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/initrd-parse-etc.service" ++ ln -fs ../initrd-parse-etc.service "${initdir}${dracutsystemunitdir}/initrd.target.wants/initrd-parse-etc.service" + + inst_rules 99-systemd.rules + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index d2c803a..d4d1e77 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -839,9 +839,9 @@ wait_for_dev() + _name="${_name##/}" + _name="$(str_replace "$_name" '-' '\x2d')" + _name="$(str_replace "$_name" '/' '-')" +- if ! [ -L ${PREFIX}/etc/systemd/system/dracut.target.requires/${_name}.device ]; then +- [ -d ${PREFIX}/etc/systemd/system/dracut.target.requires ] || mkdir -p ${PREFIX}/etc/systemd/system/dracut.target.requires +- ln -s ../${_name}.device ${PREFIX}/etc/systemd/system/dracut.target.requires/${_name}.device ++ if ! [ -L ${PREFIX}/etc/systemd/system/initrd.target.requires/${_name}.device ]; then ++ [ -d ${PREFIX}/etc/systemd/system/initrd.target.requires ] || mkdir -p ${PREFIX}/etc/systemd/system/initrd.target.requires ++ ln -s ../${_name}.device ${PREFIX}/etc/systemd/system/initrd.target.requires/${_name}.device + fi + fi + } diff --git a/dracut.spec b/dracut.spec index 0c68e22..c9647bd 100644 --- a/dracut.spec +++ b/dracut.spec @@ -10,7 +10,7 @@ Name: dracut Version: 026 -Release: 15.git20130311%{?dist} +Release: 19.git20130313%{?dist} Summary: Initramfs generator using udev %if 0%{?fedora} || 0%{?rhel} @@ -43,6 +43,10 @@ Patch11: 0011-lsinitrd.sh-removed-trailing.patch Patch12: 0012-make-host_fs_types-a-hashmap.patch Patch13: 0013-dracut.sh-add-swap-partitions-to-host-only-setup.patch Patch14: 0014-add-51-dracut-rescue-postinst.sh.patch +Patch15: 0015-dracut.spec-add-nohostonly-and-norescue-subpackages.patch +Patch16: 0016-lsinitrd.sh-simplify-check-for-boot-loader-spec-dirs.patch +Patch17: 0017-51-dracut-rescue.install-create-directory-if-it-does.patch +Patch18: 0018-systemd-local-fs.target-is-now-root-fs.target-and-in.patch BuildRequires: dash bash git @@ -102,7 +106,8 @@ Requires: kbd kbd-misc %if 0%{?fedora} || 0%{?rhel} > 6 Requires: util-linux >= 2.21 -Conflicts: systemd < 198 +Conflicts: systemd < 198-4 +Conflicts: grubby < 8.23 %else Requires: util-linux-ng >= 2.21 %endif @@ -168,6 +173,22 @@ Requires: libcap This package requires everything which is needed to build an initramfs with dracut, which drops capabilities. +%package nohostonly +Summary: dracut configuration to turn off hostonly image generation +Requires: %{name} = %{version}-%{release} + +%description nohostonly +This package provides the configuration to turn off the host specific initramfs +generation with dracut. + +%package norescue +Summary: dracut configuration to turn off rescue image generation +Requires: %{name} = %{version}-%{release} + +%description norescue +This package provides the configuration to turn off the rescue initramfs +generation with dracut. + %package tools Summary: dracut tools to build the local initramfs Requires: %{name} = %{version}-%{release} @@ -250,10 +271,13 @@ rm $RPM_BUILD_ROOT%{_bindir}/mkinitrd rm $RPM_BUILD_ROOT%{_bindir}/lsinitrd %endif -# FIXME: remove after F19 %if 0%{?fedora} || 0%{?rhel} > 6 +# FIXME: remove after F19 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh + +echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-nohostonly.conf +echo 'dracut_rescue_image="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-norescue.conf %endif mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d @@ -402,7 +426,19 @@ rm -rf $RPM_BUILD_ROOT %dir /var/lib/dracut %dir /var/lib/dracut/overlay +%files nohostonly +%defattr(-,root,root,0755) +%{dracutlibdir}/dracut.conf.d/02-nohostonly.conf + +%files norescue +%defattr(-,root,root,0755) +%{dracutlibdir}/dracut.conf.d/02-norescue.conf + %changelog +* Wed Mar 13 2013 Harald Hoyer 026-19.git20130313 +- fix switch-root and local-fs.target problem +- add norescue and nohostonly subpackages + * Mon Mar 11 2013 Harald Hoyer 026-15.git20130311 - update to recent git