version 016

This commit is contained in:
Harald Hoyer 2012-02-15 18:14:19 +01:00
parent 2b3d0de8bc
commit 4112f58b2c
9 changed files with 7 additions and 702 deletions

View File

@ -1,26 +0,0 @@
From 68910ba4a510e2d10e1c16adb348a8916a74b281 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 8 Feb 2012 17:02:17 +0100
Subject: [PATCH] dracut: setup clean PATH w/o existing one
---
dracut | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dracut b/dracut
index 86fcaf3..545f9db 100755
--- a/dracut
+++ b/dracut
@@ -284,9 +284,10 @@ for i in /usr/bin /bin /usr/sbin /sbin; do
if [ -L "$i" ]; then
rl=$(readlink -f $i)
fi
- PATH="$PATH:$rl"
+ NPATH="$NPATH:$rl"
done
-export PATH
+export PATH="$NPATH"
+unset NPATH
unset LD_LIBRARY_PATH
unset GREP_OPTIONS

View File

@ -1,31 +0,0 @@
From 12018c91eac3e0165fe3d5df5bc1382fdf64d2a1 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 8 Feb 2012 17:02:57 +0100
Subject: [PATCH] TEST-15-BTRFSRAID: write diskimage to tmp dir
---
test/TEST-15-BTRFSRAID/test.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/test/TEST-15-BTRFSRAID/test.sh b/test/TEST-15-BTRFSRAID/test.sh
index bacdb4a..8f7839d 100755
--- a/test/TEST-15-BTRFSRAID/test.sh
+++ b/test/TEST-15-BTRFSRAID/test.sh
@@ -5,8 +5,8 @@ KVERSION=${KVERSION-$(uname -r)}
# Uncomment this to debug failures
#DEBUGFAIL="rd.shell"
-DISKIMAGE=$TESTDIR/TEST-15-BTRFSRAID-root.img
test_run() {
+ DISKIMAGE=$TESTDIR/TEST-15-BTRFSRAID-root.img
$testdir/run-qemu \
-hda $DISKIMAGE \
-m 256M -nographic \
@@ -18,6 +18,7 @@ test_run() {
test_setup() {
# Create the blank file to use as a root filesystem
+ DISKIMAGE=$TESTDIR/TEST-15-BTRFSRAID-root.img
rm -f $DISKIMAGE
dd if=/dev/null of=$DISKIMAGE bs=1M seek=1024

View File

@ -1,22 +0,0 @@
From d20d307d697811f28fbd74111238c43740697226 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 9 Feb 2012 11:36:21 +0100
Subject: [PATCH] lsinitrd: silence xz test
---
lsinitrd | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lsinitrd b/lsinitrd
index 1d953b7..11e5c7a 100755
--- a/lsinitrd
+++ b/lsinitrd
@@ -36,7 +36,7 @@ image="${1:-/boot/initramfs-$(uname -r).img}"
CAT=zcat
FILE_T=$(file "$image")
-if echo "test"|xz|xz -dc --single-stream; then
+if echo "test"|xz|xz -dc --single-stream >/dev/null 2>&1; then
XZ_SINGLE_STREAM="--single-stream"
fi

View File

@ -1,31 +0,0 @@
From 7b2d3d995c97652a13880b279bfc602e47bcda9c Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 9 Feb 2012 13:58:13 +0100
Subject: [PATCH] dracut: honor binaries in sbin first
---
dracut | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dracut b/dracut
index 545f9db..fb46d70 100755
--- a/dracut
+++ b/dracut
@@ -279,14 +279,14 @@ if ! [[ $kernel ]]; then
fi
[[ $outfile ]] || outfile="/boot/initramfs-$kernel.img"
-for i in /usr/bin /bin /usr/sbin /sbin; do
+for i in /usr/sbin /sbin /usr/bin /bin; do
rl=$i
if [ -L "$i" ]; then
rl=$(readlink -f $i)
fi
- NPATH="$NPATH:$rl"
+ NPATH+=":$rl"
done
-export PATH="$NPATH"
+export PATH="${NPATH#:}"
unset NPATH
unset LD_LIBRARY_PATH
unset GREP_OPTIONS

View File

@ -1,23 +0,0 @@
From 075de7be458c4135f277d900c83bb7c3960dde8d Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 9 Feb 2012 13:58:49 +0100
Subject: [PATCH] 98usrmount/mount-usr.sh: remove extra slash
otherwise we have /sysroot//usr in fstab
---
modules.d/98usrmount/mount-usr.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh
index b24446a..5139c7a 100755
--- a/modules.d/98usrmount/mount-usr.sh
+++ b/modules.d/98usrmount/mount-usr.sh
@@ -11,7 +11,7 @@ mount_usr()
# check, if we have to mount the /usr filesystem
while read _dev _mp _fs _opts _rest; do
if [ "$_mp" = "/usr" ]; then
- echo "$_dev $NEWROOT/$_mp $_fs ${_opts} $_rest"
+ echo "$_dev ${NEWROOT}${_mp} $_fs ${_opts} $_rest"
_usr_found="1"
break
fi

View File

@ -1,22 +0,0 @@
From 81dcf7c90a853d91009888dbff6670bb483c0716 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 9 Feb 2012 14:16:31 +0100
Subject: [PATCH] 99shutdown/shutdown: don't do console_init on shutdown
emergency
---
modules.d/99shutdown/shutdown | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/modules.d/99shutdown/shutdown b/modules.d/99shutdown/shutdown
index 64937fa..2576687 100755
--- a/modules.d/99shutdown/shutdown
+++ b/modules.d/99shutdown/shutdown
@@ -26,7 +26,6 @@ emergency_shell()
source_hook shutdown-emergency
echo
if getargbool 1 rd.shell -y rdshell || getarg rd.break rdbreak; then
- [ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/console
echo "Dropping to debug shell."
echo
export PS1="$_rdshell_name:\${PWD}# "

View File

@ -1,188 +0,0 @@
From 4cfd24d1799fafacf6624c9638454de93dd6f331 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 10 Feb 2012 09:37:18 +0100
Subject: [PATCH] Backup and restore /run/initramfs via systemd services
This saves the space /run/initramfs is taking for the shutdown
---
Makefile | 16 ++++++++++++++--
dracut-backup.service | 15 +++++++++++++++
dracut-initramfs-backup.sh | 22 ++++++++++++++++++++++
dracut-restore.service | 18 ++++++++++++++++++
dracut.spec | 13 ++++++++++++-
5 files changed, 81 insertions(+), 3 deletions(-)
create mode 100644 dracut-backup.service
create mode 100644 dracut-initramfs-backup.sh
create mode 100644 dracut-restore.service
diff --git a/Makefile b/Makefile
index 8d7b7d6..09e87c8 100644
--- a/Makefile
+++ b/Makefile
@@ -40,6 +40,7 @@ install: doc
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
install -m 0755 dracut-logger $(DESTDIR)$(pkglibdir)/dracut-logger
+ install -m 0755 dracut-initramfs-backup.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-backup
cp -arx modules.d $(DESTDIR)$(pkglibdir)
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8/dracut.8
install -m 0644 dracut-catimages.8 $(DESTDIR)$(mandir)/man8/dracut-catimages.8
@@ -47,6 +48,15 @@ install: doc
install -m 0644 dracut.conf.5 $(DESTDIR)$(mandir)/man5/dracut.conf.5
install -m 0644 dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.cmdline.7
ln -s dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
+ if [ -n "$(systemdsystemunitdir)" ]; then \
+ mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
+ install -m 0644 dracut-backup.service $(DESTDIR)$(systemdsystemunitdir); \
+ install -m 0644 dracut-restore.service $(DESTDIR)$(systemdsystemunitdir); \
+ mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants; \
+ mkdir -p $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants; \
+ ln -s ../dracut-backup.service $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants/dracut-backup.service; \
+ ln -s ../dracut-restore.service $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants/dracut-restore.service; \
+ fi
clean:
$(RM) *~
@@ -77,12 +87,14 @@ rpm: dracut-$(VERSION).tar.bz2
( mv "$$rpmbuild"/noarch/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr "$$rpmbuild"; ls *.rpm )
syncheck:
- @ret=0;for i in dracut-logger modules.d/99base/init modules.d/*/*.sh; do \
+ @ret=0;for i in dracut-initramfs-backup.sh dracut-logger \
+ modules.d/99base/init modules.d/*/*.sh; do \
[ "$${i##*/}" = "module-setup.sh" ] && continue; \
[ "$${i##*/}" = "caps.sh" ] && continue; \
dash -n "$$i" ; ret=$$(($$ret+$$?)); \
done;exit $$ret
- @ret=0;for i in dracut modules.d/02caps/caps.sh modules.d/*/module-setup.sh; do \
+ @ret=0;for i in mkinitrd-dracut.sh dracut modules.d/02caps/caps.sh \
+ modules.d/*/module-setup.sh; do \
bash -n "$$i" ; ret=$$(($$ret+$$?)); \
done;exit $$ret
diff --git a/dracut-backup.service b/dracut-backup.service
new file mode 100644
index 0000000..69110eb
--- /dev/null
+++ b/dracut-backup.service
@@ -0,0 +1,15 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Save /run/initramfs
+ConditionPathExists=/run/initramfs
+
+[Service]
+ExecStart=/usr/lib/dracut/dracut-initramfs-backup backup
+Type=oneshot
+RemainAfterExit=yes
diff --git a/dracut-initramfs-backup.sh b/dracut-initramfs-backup.sh
new file mode 100644
index 0000000..7320d40
--- /dev/null
+++ b/dracut-initramfs-backup.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+set -e
+cd /run/initramfs
+
+if [ "x$1" = "xbackup" ]; then
+ compress="gzip"
+ command -v pigz > /dev/null 2>&1 && compress="pigz"
+ find . |cpio -H newc -o --quiet \
+ | pigz > /var/lib/initramfs/_run_initramfs-backup.cpio.gz
+ mv -f /var/lib/initramfs/_run_initramfs-backup.cpio.gz \
+ /var/lib/initramfs/run_initramfs-backup.cpio.gz
+ rm -fr etc bin lib lib64 sbin shutdown tmp usr var
+ > .backuped
+elif [ "x$1" = "xrestore" ]; then
+ [ -f .backuped -a -f /var/lib/initramfs/run_initramfs-backup.cpio.gz ] || exit 1
+ zcat /var/lib/initramfs/run_initramfs-backup.cpio.gz | cpio -id >/dev/null 2>&1
+ rm .backuped
+ rm -f /var/lib/initramfs/run_initramfs-backup.cpio.gz
+fi
diff --git a/dracut-restore.service b/dracut-restore.service
new file mode 100644
index 0000000..3a07efe
--- /dev/null
+++ b/dracut-restore.service
@@ -0,0 +1,18 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Restore /run/initramfs
+After=getty@tty1.service prefdm.service
+Before=reboot.service
+DefaultDependencies=no
+ConditionPathExists=/run/initramfs/.backuped
+
+[Service]
+ExecStart=/usr/lib/dracut/dracut-initramfs-backup restore
+Type=oneshot
+RemainAfterExit=yes
\ No newline at end of file
diff --git a/dracut.spec b/dracut.spec
index 1b0b76b..6efd553 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -27,6 +27,7 @@ Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar
BuildArch: noarch
BuildRequires: dash bash git
+
%if 0%{?fedora} || 0%{?rhel} > 6
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%endif
@@ -51,6 +52,10 @@ Obsoletes: nash <= 6.0.93
Obsoletes: libbdevid-python <= 6.0.93
%endif
+%if 0%{?fedora} > 16 || 0%{?rhel} > 6
+BuildRequires: systemd-units
+%endif
+
%if 0%{?suse_version} > 9999
Obsoletes: mkinitrd < 2.6.1
Provides: mkinitrd = 2.6.1
@@ -161,7 +166,8 @@ rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT \
libdir=%{_prefix}/lib \
bindir=%{_bindir} \
- sysconfdir=/etc mandir=%{_mandir}
+ sysconfdir=/etc mandir=%{_mandir} \
+ systemdsystemunitdir=%{_unitdir}
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/10rpmversion/dracut-version
@@ -217,6 +223,7 @@ rm -rf $RPM_BUILD_ROOT
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/dracut-functions
%{dracutlibdir}/dracut-logger
+%{dracutlibdir}/dracut-initramfs-backup
%config(noreplace) /etc/dracut.conf
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} > 6
%config /etc/dracut.conf.d/01-dist.conf
@@ -266,6 +273,10 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) /etc/logrotate.d/dracut_log
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
%dir %{_sharedstatedir}/initramfs
+%if 0%{?fedora} > 16 || 0%{?rhel} > 6
+%{_unitdir}/*.service
+%{_unitdir}/*/*.service
+%endif
%files network
%defattr(-,root,root,0755)

View File

@ -1,349 +0,0 @@
From fb67e4aa36948b3ed1208bf963da5569d1b13409 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 10 Feb 2012 11:14:42 +0100
Subject: [PATCH] shutdown on demand
Do not save and restore the initramfs, but instead, just unpack the
default initramfs for shutdown on shutdown.
---
Makefile | 9 +++------
dracut-backup.service | 15 ---------------
dracut-initramfs-backup.sh | 22 ----------------------
dracut-initramfs-restore.sh | 10 ++++++++++
dracut-restore.service | 18 ------------------
dracut-shutdown.service | 18 ++++++++++++++++++
dracut.conf.d/fedora.conf.example | 1 -
dracut.spec | 2 +-
modules.d/90crypt/cryptroot-ask.sh | 1 +
modules.d/90dmraid/dmraid.sh | 1 +
modules.d/90dmsquash-live/dmsquash-live-root | 2 ++
modules.d/90lvm/lvm_scan.sh | 2 ++
modules.d/90mdraid/mdraid-cleanup.sh | 4 ++--
modules.d/90multipath/multipathd.sh | 1 +
modules.d/95fcoe/fcoe-up | 2 ++
modules.d/95iscsi/iscsiroot | 2 ++
modules.d/95nbd/nbdroot | 1 +
modules.d/95nfs/nfsroot | 2 +-
modules.d/98usrmount/mount-usr.sh | 10 ++++++++++
modules.d/99base/dracut-lib.sh | 4 ++++
20 files changed, 61 insertions(+), 66 deletions(-)
delete mode 100644 dracut-backup.service
delete mode 100644 dracut-initramfs-backup.sh
create mode 100644 dracut-initramfs-restore.sh
delete mode 100644 dracut-restore.service
create mode 100644 dracut-shutdown.service
diff --git a/Makefile b/Makefile
index 09e87c8..99279ac 100644
--- a/Makefile
+++ b/Makefile
@@ -40,7 +40,7 @@ install: doc
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
install -m 0755 dracut-logger $(DESTDIR)$(pkglibdir)/dracut-logger
- install -m 0755 dracut-initramfs-backup.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-backup
+ install -m 0755 dracut-initramfs-restore.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-restore
cp -arx modules.d $(DESTDIR)$(pkglibdir)
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8/dracut.8
install -m 0644 dracut-catimages.8 $(DESTDIR)$(mandir)/man8/dracut-catimages.8
@@ -50,12 +50,9 @@ install: doc
ln -s dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
if [ -n "$(systemdsystemunitdir)" ]; then \
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
- install -m 0644 dracut-backup.service $(DESTDIR)$(systemdsystemunitdir); \
- install -m 0644 dracut-restore.service $(DESTDIR)$(systemdsystemunitdir); \
- mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants; \
+ install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants; \
- ln -s ../dracut-backup.service $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants/dracut-backup.service; \
- ln -s ../dracut-restore.service $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants/dracut-restore.service; \
+ ln -s ../dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants/dracut-shutdown.service; \
fi
clean:
diff --git a/dracut-backup.service b/dracut-backup.service
deleted file mode 100644
index 69110eb..0000000
--- a/dracut-backup.service
+++ /dev/null
@@ -1,15 +0,0 @@
-# This file is part of systemd.
-#
-# systemd is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-[Unit]
-Description=Save /run/initramfs
-ConditionPathExists=/run/initramfs
-
-[Service]
-ExecStart=/usr/lib/dracut/dracut-initramfs-backup backup
-Type=oneshot
-RemainAfterExit=yes
diff --git a/dracut-initramfs-backup.sh b/dracut-initramfs-backup.sh
deleted file mode 100644
index 7320d40..0000000
--- a/dracut-initramfs-backup.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
-
-set -e
-cd /run/initramfs
-
-if [ "x$1" = "xbackup" ]; then
- compress="gzip"
- command -v pigz > /dev/null 2>&1 && compress="pigz"
- find . |cpio -H newc -o --quiet \
- | pigz > /var/lib/initramfs/_run_initramfs-backup.cpio.gz
- mv -f /var/lib/initramfs/_run_initramfs-backup.cpio.gz \
- /var/lib/initramfs/run_initramfs-backup.cpio.gz
- rm -fr etc bin lib lib64 sbin shutdown tmp usr var
- > .backuped
-elif [ "x$1" = "xrestore" ]; then
- [ -f .backuped -a -f /var/lib/initramfs/run_initramfs-backup.cpio.gz ] || exit 1
- zcat /var/lib/initramfs/run_initramfs-backup.cpio.gz | cpio -id >/dev/null 2>&1
- rm .backuped
- rm -f /var/lib/initramfs/run_initramfs-backup.cpio.gz
-fi
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
new file mode 100644
index 0000000..26b698b
--- /dev/null
+++ b/dracut-initramfs-restore.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+set -e
+cd /run/initramfs
+IMG="/boot/initramfs-$(uname -r).img"
+[ -f .need_shutdown -a -f "$IMG" ] || exit 1
+zcat "$IMG" | cpio -id >/dev/null 2>&1
+rm .need_shutdown
diff --git a/dracut-restore.service b/dracut-restore.service
deleted file mode 100644
index 3a07efe..0000000
--- a/dracut-restore.service
+++ /dev/null
@@ -1,18 +0,0 @@
-# This file is part of systemd.
-#
-# systemd is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-[Unit]
-Description=Restore /run/initramfs
-After=getty@tty1.service prefdm.service
-Before=reboot.service
-DefaultDependencies=no
-ConditionPathExists=/run/initramfs/.backuped
-
-[Service]
-ExecStart=/usr/lib/dracut/dracut-initramfs-backup restore
-Type=oneshot
-RemainAfterExit=yes
\ No newline at end of file
diff --git a/dracut-shutdown.service b/dracut-shutdown.service
new file mode 100644
index 0000000..4f06e35
--- /dev/null
+++ b/dracut-shutdown.service
@@ -0,0 +1,18 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Restore /run/initramfs
+After=getty@tty1.service prefdm.service
+Before=reboot.service
+DefaultDependencies=no
+ConditionPathExists=/run/initramfs/.need_shutdown
+
+[Service]
+ExecStart=/usr/lib/dracut/dracut-initramfs-restore
+Type=oneshot
+RemainAfterExit=yes
diff --git a/dracut.conf.d/fedora.conf.example b/dracut.conf.d/fedora.conf.example
index 45063c6..adfecc8 100644
--- a/dracut.conf.d/fedora.conf.example
+++ b/dracut.conf.d/fedora.conf.example
@@ -5,6 +5,5 @@ i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-F
add_dracutmodules+=" rpmversion "
omit_dracutmodules+=" dash "
stdloglvl=3
-prefix=/run/initramfs
realinitpath="/usr/lib/systemd/systemd"
install_items+=" vi /etc/virc ps grep cat rm openvt "
diff --git a/dracut.spec b/dracut.spec
index 6efd553..304f1f3 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -223,7 +223,7 @@ rm -rf $RPM_BUILD_ROOT
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/dracut-functions
%{dracutlibdir}/dracut-logger
-%{dracutlibdir}/dracut-initramfs-backup
+%{dracutlibdir}/dracut-initramfs-restore
%config(noreplace) /etc/dracut.conf
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} > 6
%config /etc/dracut.conf.d/01-dist.conf
diff --git a/modules.d/90crypt/cryptroot-ask.sh b/modules.d/90crypt/cryptroot-ask.sh
index 6a95dc2..aba1331 100755
--- a/modules.d/90crypt/cryptroot-ask.sh
+++ b/modules.d/90crypt/cryptroot-ask.sh
@@ -117,6 +117,7 @@ unset device luksname luksfile
# mark device as asked
>> /tmp/cryptroot-asked-$2
+need_shutdown
udevsettle
exit 0
diff --git a/modules.d/90dmraid/dmraid.sh b/modules.d/90dmraid/dmraid.sh
index feff516..574dc3b 100755
--- a/modules.d/90dmraid/dmraid.sh
+++ b/modules.d/90dmraid/dmraid.sh
@@ -40,3 +40,4 @@ else
done
fi
+need_shutdown
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root b/modules.d/90dmsquash-live/dmsquash-live-root
index d9fcc43..e3606cf 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-root
+++ b/modules.d/90dmsquash-live/dmsquash-live-root
@@ -206,4 +206,6 @@ fi
ln -s /dev/mapper/live-rw /dev/root
printf '/bin/mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
+need_shutdown
+
exit 0
diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh
index 3c0094e..104565f 100755
--- a/modules.d/90lvm/lvm_scan.sh
+++ b/modules.d/90lvm/lvm_scan.sh
@@ -126,3 +126,5 @@ if [ "$lvmwritten" ]; then
rm -f /etc/lvm/lvm.conf
fi
unset lvmwritten
+
+need_shutdown
diff --git a/modules.d/90mdraid/mdraid-cleanup.sh b/modules.d/90mdraid/mdraid-cleanup.sh
index 3ffa2d3..2e8a389 100755
--- a/modules.d/90mdraid/mdraid-cleanup.sh
+++ b/modules.d/90mdraid/mdraid-cleanup.sh
@@ -13,11 +13,11 @@ for md in /dev/md[0-9_]*; do
containers="$containers $md"
continue
fi
- mdadm -S "$md" >/dev/null 2>&1
+ mdadm -S "$md" >/dev/null 2>&1 || need_shutdown
done
for md in $containers; do
- mdadm -S "$md" >/dev/null 2>&1
+ mdadm -S "$md" >/dev/null 2>&1 || need_shutdown
done
unset containers udevinfo
diff --git a/modules.d/90multipath/multipathd.sh b/modules.d/90multipath/multipathd.sh
index 4d8935f..6d6eb99 100755
--- a/modules.d/90multipath/multipathd.sh
+++ b/modules.d/90multipath/multipathd.sh
@@ -5,6 +5,7 @@
if [ -e /etc/multipath.conf ]; then
modprobe dm-multipath
multipathd -B || multipathd
+ need_shutdown
else
rm /etc/udev/rules.d/??-multipath.rules 2>/dev/null
fi
diff --git a/modules.d/95fcoe/fcoe-up b/modules.d/95fcoe/fcoe-up
index 5c5bdb5..1e1bcf5 100755
--- a/modules.d/95fcoe/fcoe-up
+++ b/modules.d/95fcoe/fcoe-up
@@ -46,3 +46,5 @@ elif [ "$netdriver" = "bnx2x" ]; then
else
echo -n "$netif" > /sys/module/fcoe/parameters/create
fi
+
+need_shutdown
diff --git a/modules.d/95iscsi/iscsiroot b/modules.d/95iscsi/iscsiroot
index e7bac74..d8f7c8f 100755
--- a/modules.d/95iscsi/iscsiroot
+++ b/modules.d/95iscsi/iscsiroot
@@ -205,6 +205,8 @@ else
handle_netroot $iroot
fi
+need_shutdown
+
# now we have a root filesystem somewhere in /dev/sda*
# let the normal block handler handle root=
exit 0
diff --git a/modules.d/95nbd/nbdroot b/modules.d/95nbd/nbdroot
index 1fb2140..e20b4e4 100755
--- a/modules.d/95nbd/nbdroot
+++ b/modules.d/95nbd/nbdroot
@@ -107,4 +107,5 @@ fi
# NBD doesn't emit uevents when it gets connected, so kick it
echo change > /sys/block/nbd0/uevent
udevadm settle
+need_shutdown
exit 0
diff --git a/modules.d/95nfs/nfsroot b/modules.d/95nfs/nfsroot
index 2103e24..764971b 100755
--- a/modules.d/95nfs/nfsroot
+++ b/modules.d/95nfs/nfsroot
@@ -106,4 +106,4 @@ echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/
# force udevsettle to break
> $hookdir/initqueue/work
-
+need_shutdown
diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh
index 5139c7a..9998624 100755
--- a/modules.d/98usrmount/mount-usr.sh
+++ b/modules.d/98usrmount/mount-usr.sh
@@ -11,6 +11,16 @@ mount_usr()
# check, if we have to mount the /usr filesystem
while read _dev _mp _fs _opts _rest; do
if [ "$_mp" = "/usr" ]; then
+ case "$_dev" in
+ LABEL=*)
+ _dev="$(echo $_dev | sed 's,/,\\x2f,g')"
+ _dev="/dev/disk/by-label/${_dev#LABEL=}"
+ ;;
+ UUID=*)
+ _dev="${_dev#block:}"
+ _dev="/dev/disk/by-uuid/${_dev#UUID=}"
+ ;;
+ esac
echo "$_dev ${NEWROOT}${_mp} $_fs ${_opts} $_rest"
_usr_found="1"
break
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 4897a3d..6b70adf 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -738,3 +738,7 @@ killproc() {
fi
done
}
+
+need_shutdown() {
+ >/run/initramfs/.need_shutdown
+}

View File

@ -9,8 +9,8 @@
%endif
Name: dracut
Version: 015
Release: 9.git20120213%{?dist}
Version: 016
Release: 1%{?dist}
Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel} > 6
@ -24,14 +24,6 @@ URL: https://dracut.wiki.kernel.org/
# Source can be generated by
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
Patch1: 0001-dracut-setup-clean-PATH-w-o-existing-one.patch
Patch2: 0002-TEST-15-BTRFSRAID-write-diskimage-to-tmp-dir.patch
Patch3: 0003-lsinitrd-silence-xz-test.patch
Patch4: 0004-dracut-honor-binaries-in-sbin-first.patch
Patch5: 0005-98usrmount-mount-usr.sh-remove-extra-slash.patch
Patch6: 0006-99shutdown-shutdown-don-t-do-console_init-on-shutdow.patch
Patch7: 0007-Backup-and-restore-run-initramfs-via-systemd-service.patch
Patch8: 0008-shutdown-on-demand.patch
BuildArch: noarch
@ -248,6 +240,7 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/10i18n
%{dracutlibdir}/modules.d/10rpmversion
%{dracutlibdir}/modules.d/30convertfs
%{dracutlibdir}/modules.d/45url-lib
%{dracutlibdir}/modules.d/50plymouth
%{dracutlibdir}/modules.d/90btrfs
%{dracutlibdir}/modules.d/90crypt
@ -278,6 +271,7 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base
%{dracutlibdir}/modules.d/99fs-lib
%{dracutlibdir}/modules.d/99img-lib
%{dracutlibdir}/modules.d/99shutdown
%config(noreplace) /etc/logrotate.d/dracut_log
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
@ -326,6 +320,9 @@ rm -rf $RPM_BUILD_ROOT
%dir /var/lib/dracut/overlay
%changelog
* Wed Feb 15 2012 Harald Hoyer <harald@redhat.com> 016-1
- version 016
* Mon Feb 13 2012 Harald Hoyer <harald@redhat.com> 015-9.git20120213
- update to latest git