From 4413d3ae967850db8022e378e7941593f8c51b82 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mar 20 2013 09:32:27 +0000 Subject: dracut-026-72.git20130320 - fix rescue image naming Resolves: rhbz#923439 - turn off host-only mode if essential system filesystems not mounted - turn off host-only mode if udev database is not accessible --- diff --git a/0062-network-netroot.sh-do-not-unset-root.patch b/0062-network-netroot.sh-do-not-unset-root.patch new file mode 100644 index 0000000..4f9a4cc --- /dev/null +++ b/0062-network-netroot.sh-do-not-unset-root.patch @@ -0,0 +1,23 @@ +From af2fcbafe8bdb30c34f440b76c37d535016d739f Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 19 Mar 2013 14:52:25 +0100 +Subject: [PATCH] network/netroot.sh: do not unset root + +--- + modules.d/40network/netroot.sh | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/modules.d/40network/netroot.sh b/modules.d/40network/netroot.sh +index 8c7716b..9c481a8 100755 +--- a/modules.d/40network/netroot.sh ++++ b/modules.d/40network/netroot.sh +@@ -24,9 +24,6 @@ netif=$1 + # handlers when this is not called from manually network bringing up. + if [ -z "$2" ]; then + if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then +- # Unset root so we can check later +- unset root +- + # Load dhcp options + [ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts + diff --git a/0063-TEST-40-NBD-test.sh-kill_server-after-test_run.patch b/0063-TEST-40-NBD-test.sh-kill_server-after-test_run.patch new file mode 100644 index 0000000..e783489 --- /dev/null +++ b/0063-TEST-40-NBD-test.sh-kill_server-after-test_run.patch @@ -0,0 +1,23 @@ +From 57aa1e91400ff06022afe7175f5b4e97e813cf8d Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 19 Mar 2013 14:53:17 +0100 +Subject: [PATCH] TEST-40-NBD/test.sh: kill_server() after test_run() + +--- + test/TEST-40-NBD/test.sh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh +index dae65f2..4feb557 100755 +--- a/test/TEST-40-NBD/test.sh ++++ b/test/TEST-40-NBD/test.sh +@@ -99,7 +99,8 @@ test_run() { + echo "Failed to start server" 1>&2 + return 1 + fi +- client_run || { kill_server; return 1; } ++ client_run ++ kill_server + } + + client_run() { diff --git a/0064-51-dracut-rescue-postinst.sh-add-extra-checks.patch b/0064-51-dracut-rescue-postinst.sh-add-extra-checks.patch new file mode 100644 index 0000000..9f060d1 --- /dev/null +++ b/0064-51-dracut-rescue-postinst.sh-add-extra-checks.patch @@ -0,0 +1,23 @@ +From 619c1bb334ea28fb2f096640d6127b6bfb2a0c8b Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 19 Mar 2013 16:56:56 +0100 +Subject: [PATCH] 51-dracut-rescue-postinst.sh: add extra checks + +--- + 51-dracut-rescue-postinst.sh | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/51-dracut-rescue-postinst.sh b/51-dracut-rescue-postinst.sh +index 21208a4..d206496 100755 +--- a/51-dracut-rescue-postinst.sh ++++ b/51-dracut-rescue-postinst.sh +@@ -10,6 +10,9 @@ KERNEL_IMAGE="$2" + [[ -f /etc/os-release ]] && . /etc/os-release + [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id + ++[[ $MACHINE_ID ]] || exit 1 ++[[ -f $KERNEL_IMAGE ]] || exit 1 ++ + INITRDFILE="/boot/initramfs-${MACHINE_ID}-rescue.img" + [[ -f $INITRDFILE ]] && exit 0 + diff --git a/0065-51-dracut-rescue-postinst.sh-Rename-image-and-grub-e.patch b/0065-51-dracut-rescue-postinst.sh-Rename-image-and-grub-e.patch new file mode 100644 index 0000000..d088eca --- /dev/null +++ b/0065-51-dracut-rescue-postinst.sh-Rename-image-and-grub-e.patch @@ -0,0 +1,54 @@ +From 967db700905e0f54a159152352116b995ec38737 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 20 Mar 2013 06:39:13 +0100 +Subject: [PATCH] 51-dracut-rescue-postinst.sh: Rename image and grub entry + +grub2-mkconfig ordered the rescue entries higher than the normal ones. + +https://bugzilla.redhat.com/show_bug.cgi?id=923439 +--- + 51-dracut-rescue-postinst.sh | 22 +++++++++++++--------- + 1 file changed, 13 insertions(+), 9 deletions(-) + +diff --git a/51-dracut-rescue-postinst.sh b/51-dracut-rescue-postinst.sh +index d206496..8b4e6c3 100755 +--- a/51-dracut-rescue-postinst.sh ++++ b/51-dracut-rescue-postinst.sh +@@ -13,8 +13,10 @@ KERNEL_IMAGE="$2" + [[ $MACHINE_ID ]] || exit 1 + [[ -f $KERNEL_IMAGE ]] || exit 1 + +-INITRDFILE="/boot/initramfs-${MACHINE_ID}-rescue.img" +-[[ -f $INITRDFILE ]] && exit 0 ++INITRDFILE="/boot/initramfs-0-rescue-${MACHINE_ID}.img" ++NEW_KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-0-rescue-${MACHINE_ID}" ++ ++[[ -f $INITRDFILE ]] && [[ -f $NEW_KERNEL_IMAGE ]] && exit 0 + + dropindirs_sort() + { +@@ -46,15 +48,17 @@ done + + [[ $dracut_rescue_image != "yes" ]] && exit 0 + +-dracut --no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION" +-((ret+=$?)) +- +-cp "$KERNEL_IMAGE" "${KERNEL_IMAGE%/*}/vmlinuz-${MACHINE_ID}-rescue" +-((ret+=$?)) ++if [[ ! -f $INITRDFILE ]]; then ++ dracut --no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION" ++ ((ret+=$?)) ++fi + +-KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-${MACHINE_ID}-rescue" ++if [[ ! -f $NEW_KERNEL_IMAGE ]]; then ++ cp "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE" ++ ((ret+=$?)) ++fi + +-new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$PRETTY_NAME Rescue" ++new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$NEW_KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$NAME $VERSION_ID Rescue $MACHINE_ID" + + ((ret+=$?)) + diff --git a/0066-51-dracut-rescue-postinst.sh-51-dracut-rescue.instal.patch b/0066-51-dracut-rescue-postinst.sh-51-dracut-rescue.instal.patch new file mode 100644 index 0000000..3089c2d --- /dev/null +++ b/0066-51-dracut-rescue-postinst.sh-51-dracut-rescue.instal.patch @@ -0,0 +1,46 @@ +From 478aa7dac12fbbb01161a9bc78b70b8f7746fef9 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 20 Mar 2013 06:41:25 +0100 +Subject: [PATCH] 51-dracut-rescue-postinst.sh,51-dracut-rescue.install: use + systemd-machine-id-setup + +if /etc/machine-id is empty, use systemd-machine-id-setup +--- + 51-dracut-rescue-postinst.sh | 5 +++++ + 51-dracut-rescue.install | 6 ++++++ + 2 files changed, 11 insertions(+) + +diff --git a/51-dracut-rescue-postinst.sh b/51-dracut-rescue-postinst.sh +index 8b4e6c3..e290f1a 100755 +--- a/51-dracut-rescue-postinst.sh ++++ b/51-dracut-rescue-postinst.sh +@@ -8,6 +8,11 @@ KERNEL_VERSION="$1" + KERNEL_IMAGE="$2" + + [[ -f /etc/os-release ]] && . /etc/os-release ++ ++if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then ++ systemd-machine-id-setup ++fi ++ + [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id + + [[ $MACHINE_ID ]] || exit 1 +diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install +index 1c0a6e1..39d01a7 100755 +--- a/51-dracut-rescue.install ++++ b/51-dracut-rescue.install +@@ -31,7 +31,13 @@ dropindirs_sort() + } + + [[ -f /etc/os-release ]] && . /etc/os-release ++ ++if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then ++ systemd-machine-id-setup ++fi ++ + [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id ++ + if [[ -f /etc/kernel/cmdline ]]; then + readarray -t BOOT_OPTIONS < /etc/kernel/cmdline + fi diff --git a/0067-dracut.sh-remove-temporary-cpio-output-in-trap.patch b/0067-dracut.sh-remove-temporary-cpio-output-in-trap.patch new file mode 100644 index 0000000..c7b94a1 --- /dev/null +++ b/0067-dracut.sh-remove-temporary-cpio-output-in-trap.patch @@ -0,0 +1,22 @@ +From 02566acdd7a3e371d413c30d7267fde2fb01c9cf Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 20 Mar 2013 07:07:55 +0100 +Subject: [PATCH] dracut.sh: remove temporary cpio output in trap + +--- + dracut.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut.sh b/dracut.sh +index 69f5282..7728712 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -655,7 +655,7 @@ readonly initdir=$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX) + } + + # clean up after ourselves no matter how we die. +-trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf "$initdir";exit $ret; };' EXIT ++trap 'ret=$?;[[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f "$outfile.$$";[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf "$initdir";exit $ret; };' EXIT + # clean up after ourselves no matter how we die. + trap 'exit 1;' SIGINT + diff --git a/0068-dracut.spec-use-pkg-config-for-bashcompletiondir.patch b/0068-dracut.spec-use-pkg-config-for-bashcompletiondir.patch new file mode 100644 index 0000000..606f8ae --- /dev/null +++ b/0068-dracut.spec-use-pkg-config-for-bashcompletiondir.patch @@ -0,0 +1,32 @@ +From 8c67d395d42b4e34c10418aa6c167122a72a951b Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 20 Mar 2013 07:15:04 +0100 +Subject: [PATCH] dracut.spec: use pkg-config for bashcompletiondir + +--- + dracut.spec | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/dracut.spec b/dracut.spec +index 445463f..cd61770 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -34,6 +34,8 @@ BuildRequires: dash bash git + + %if 0%{?fedora} || 0%{?rhel} + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) ++BuildRequires: bash-completion ++BuildRequires: pkgconfig + %endif + %if 0%{?suse_version} + BuildRoot: %{_tmppath}/%{name}-%{version}-build +@@ -204,7 +206,8 @@ make install DESTDIR=$RPM_BUILD_ROOT \ + %if %{defined _unitdir} + systemdsystemunitdir=%{_unitdir} \ + %endif +- sysconfdir=/etc mandir=%{_mandir} ++ sysconfdir=/etc mandir=%{_mandir} \ ++ bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) + + echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh + diff --git a/0069-dracut.spec-use-configure.patch b/0069-dracut.spec-use-configure.patch new file mode 100644 index 0000000..2d17cca --- /dev/null +++ b/0069-dracut.spec-use-configure.patch @@ -0,0 +1,99 @@ +From 1d4b3375431d2d19d511aa5784f2c1ed1e6bbb9e Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 20 Mar 2013 07:16:43 +0100 +Subject: [PATCH] dracut.spec: use configure + +--- + configure | 31 ++++++++++++++++++++++++++++--- + dracut.spec | 15 ++++++--------- + 2 files changed, 34 insertions(+), 12 deletions(-) + +diff --git a/configure b/configure +index 409256b..19b5e1f 100755 +--- a/configure ++++ b/configure +@@ -25,6 +25,7 @@ read_arg() { + # return 1 to indicate they should do it instead. + return 1 + fi ++ return 0 + } + + while (($# > 0)); do +@@ -36,18 +37,42 @@ while (($# > 0)); do + --sbindir) read_arg sbindir "$@" || shift;; + --mandir) read_arg mandir "$@" || shift;; + --disable-documentation) enable_documentation=no;; ++ --program-prefix) read_arg programprefix "$@" || shift;; ++ --exec-prefix) read_arg execprefix "$@" || shift;; ++ --bindir) read_arg bindir "$@" || shift;; ++ --includedir) read_arg includedir "$@" || shift;; ++ --libexecdir) read_arg libexecdir "$@" || shift;; ++ --localstatedir) read_arg localstatedir "$@" || shift;; ++ --sharedstatedir) read_arg sharedstatedir "$@" || shift;; ++ --infodir) read_arg infodir "$@" || shift;; ++ --systemdsystemunitdir) read_arg systemdsystemunitdir "$@" || shift;; ++ --bashcompletiondir) read_arg bashcompletiondir "$@" || shift;; + *) echo "Ignoring unknown option '$1'";; + esac + shift + done + +-cat > Makefile.inc.tmp < Makefile.inc.$$ <> Makefile.inc.$$ ++ ++mv Makefile.inc.$$ Makefile.inc +diff --git a/dracut.spec b/dracut.spec +index cd61770..93d497e 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -194,20 +194,17 @@ git am -p1 %{patches} + %endif + + %build +-make all ++%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib ++ ++make %{?_smp_mflags} + + %install + %if 0%{?fedora} || 0%{?rhel} + rm -rf $RPM_BUILD_ROOT + %endif +-make install DESTDIR=$RPM_BUILD_ROOT \ +- libdir=%{_prefix}/lib \ +- bindir=%{_bindir} \ +-%if %{defined _unitdir} +- systemdsystemunitdir=%{_unitdir} \ +-%endif +- sysconfdir=/etc mandir=%{_mandir} \ +- bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) ++make %{?_smp_mflags} install \ ++ DESTDIR=$RPM_BUILD_ROOT \ ++ libdir=%{_prefix}/lib + + echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh + diff --git a/0070-dracut.sh-turn-off-host-only-mode-if-essential-syste.patch b/0070-dracut.sh-turn-off-host-only-mode-if-essential-syste.patch new file mode 100644 index 0000000..48a814d --- /dev/null +++ b/0070-dracut.sh-turn-off-host-only-mode-if-essential-syste.patch @@ -0,0 +1,30 @@ +From 5bfa3b363a35fb5586f015701832eab5544385bf Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 20 Mar 2013 10:22:41 +0100 +Subject: [PATCH] dracut.sh: turn off host-only mode, if essential system + filesystems not mounted + +--- + dracut.sh | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/dracut.sh b/dracut.sh +index 7728712..9afa694 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -781,6 +781,15 @@ fi + # Need to be able to have non-root users read stuff (rpcbind etc) + chmod 755 "$initdir" + ++if [[ $hostonly ]]; then ++ for i in /sys /proc /run /dev; do ++ if ! findmnt "$i" &>/dev/null; then ++ dwarning "Turning off host-only mode: '$i' is not mounted!" ++ unset hostonly ++ fi ++ done ++fi ++ + declare -A host_fs_types + + for line in "${fstab_lines[@]}"; do diff --git a/0071-dracut.sh-turn-off-hostonly-mode-if-udev-database-is.patch b/0071-dracut.sh-turn-off-hostonly-mode-if-udev-database-is.patch new file mode 100644 index 0000000..88d2ed9 --- /dev/null +++ b/0071-dracut.sh-turn-off-hostonly-mode-if-udev-database-is.patch @@ -0,0 +1,25 @@ +From 78d1d4f86d8c8ad01cfa21be41852ee52db78bed Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 20 Mar 2013 10:25:23 +0100 +Subject: [PATCH] dracut.sh: turn off hostonly mode, if udev database is not + found + +--- + dracut.sh | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/dracut.sh b/dracut.sh +index 9afa694..0a87cca 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -788,6 +788,10 @@ if [[ $hostonly ]]; then + unset hostonly + fi + done ++ if ! [[ -d /run/udev/data ]]; then ++ dwarning "Turning off host-only mode: udev database not found!" ++ unset hostonly ++ fi + fi + + declare -A host_fs_types diff --git a/dracut.spec b/dracut.spec index 496d020..da5f283 100644 --- a/dracut.spec +++ b/dracut.spec @@ -10,7 +10,7 @@ Name: dracut Version: 026 -Release: 62.git20130319%{?dist} +Release: 72.git20130320%{?dist} Summary: Initramfs generator using udev %if 0%{?fedora} || 0%{?rhel} @@ -90,12 +90,24 @@ Patch58: 0058-systemd-add-more-ordering.patch Patch59: 0059-add-dracut.bootup.7-man-page.patch Patch60: 0060-fs-lib-fs-lib.sh-write_fs_tab-start-initrd-root-fs.t.patch Patch61: 0061-nbd-nbdroot.sh-fix-root-blockdev-case.patch +Patch62: 0062-network-netroot.sh-do-not-unset-root.patch +Patch63: 0063-TEST-40-NBD-test.sh-kill_server-after-test_run.patch +Patch64: 0064-51-dracut-rescue-postinst.sh-add-extra-checks.patch +Patch65: 0065-51-dracut-rescue-postinst.sh-Rename-image-and-grub-e.patch +Patch66: 0066-51-dracut-rescue-postinst.sh-51-dracut-rescue.instal.patch +Patch67: 0067-dracut.sh-remove-temporary-cpio-output-in-trap.patch +Patch68: 0068-dracut.spec-use-pkg-config-for-bashcompletiondir.patch +Patch69: 0069-dracut.spec-use-configure.patch +Patch70: 0070-dracut.sh-turn-off-host-only-mode-if-essential-syste.patch +Patch71: 0071-dracut.sh-turn-off-hostonly-mode-if-udev-database-is.patch BuildRequires: dash bash git %if 0%{?fedora} || 0%{?rhel} BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: bash-completion +BuildRequires: pkgconfig %endif %if 0%{?suse_version} BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -254,19 +266,17 @@ git am -p1 %{patches} %endif %build -make all +%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib + +make %{?_smp_mflags} %install %if 0%{?fedora} || 0%{?rhel} rm -rf $RPM_BUILD_ROOT %endif -make install DESTDIR=$RPM_BUILD_ROOT \ - libdir=%{_prefix}/lib \ - bindir=%{_bindir} \ -%if %{defined _unitdir} - systemdsystemunitdir=%{_unitdir} \ -%endif - sysconfdir=/etc mandir=%{_mandir} +make %{?_smp_mflags} install \ + DESTDIR=$RPM_BUILD_ROOT \ + libdir=%{_prefix}/lib echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh @@ -480,6 +490,12 @@ rm -rf $RPM_BUILD_ROOT %{dracutlibdir}/dracut.conf.d/02-norescue.conf %changelog +* Wed Mar 20 2013 Harald Hoyer 026-72.git20130320 +- fix rescue image naming +Resolves: rhbz#923439 +- turn off host-only mode if essential system filesystems not mounted +- turn off host-only mode if udev database is not accessible + * Tue Mar 19 2013 Harald Hoyer 026-62.git20130319 - fix dracut service ordering Resolves: rhbz#922991