dracut-018-25.git20120419

- fixed network for non-network root (like installer media)
This commit is contained in:
Harald Hoyer 2012-04-19 16:54:47 +02:00
parent 953eb612d1
commit 1f61980310
9 changed files with 403 additions and 6 deletions

View File

@ -0,0 +1,59 @@
From 8a1a2f6ca4c9c82f45ed793ffc9902451a04bc41 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 18 Apr 2012 12:42:39 +0200
Subject: [PATCH] udevd moved to /lib/systemd/systemd-udevd
---
dracut.conf.d/fedora.conf.example | 1 +
modules.d/95udev-rules/module-setup.sh | 10 +++++++++-
modules.d/99base/init.sh | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dracut.conf.d/fedora.conf.example b/dracut.conf.d/fedora.conf.example
index 02a530e..617d967 100644
--- a/dracut.conf.d/fedora.conf.example
+++ b/dracut.conf.d/fedora.conf.example
@@ -8,3 +8,4 @@ omit_drivers+=" .*/fs/ocfs/.* "
stdloglvl=3
realinitpath="/usr/lib/systemd/systemd"
install_items+=" vi /etc/virc ps grep cat rm "
+prefix="/"
diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh
index b17232f..cc42eb7 100755
--- a/modules.d/95udev-rules/module-setup.sh
+++ b/modules.d/95udev-rules/module-setup.sh
@@ -8,12 +8,20 @@ install() {
# ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies
# of the rules we want so that we just copy those in would be best
dracut_install udevadm
- [ -x /sbin/udevd ] && dracut_install udevd
+ if [ -x /sbin/udevd ]; then
+ dracut_install udevd
+ mkdir -p ${initdir}/lib/systemd
+ ln -s /sbin/udevd ${initdir}/lib/systemd/systemd-udevd
+ elif [ -x /lib/systemd/systemd-udevd ]; then
+ inst /lib/systemd/systemd-udevd
+ fi
for i in /etc/udev/udev.conf /etc/group; do
inst_simple $i
done
+
dracut_install basename
+
inst_rules 50-udev-default.rules 60-persistent-storage.rules \
61-persistent-storage-edd.rules 80-drivers.rules 95-udev-late.rules \
60-pcmcia.rules
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index 2f87a20..0ea72e8 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -110,7 +110,7 @@ getarg 'rd.break=pre-udev' 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Br
source_hook pre-udev
# start up udev and trigger cold plugs
-udevd --daemon --resolve-names=never
+/lib/systemd/systemd-udevd --daemon --resolve-names=never
UDEV_LOG_PRIO_ARG=--log-priority
UDEV_QUEUE_EMPTY="udevadm settle --timeout=0"

View File

@ -0,0 +1,37 @@
From 7f217d77266d4c9c283e7a6d4f576d412a1df9e5 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 18 Apr 2012 12:44:00 +0200
Subject: [PATCH] base/init.sh: mount tmpfs with strictatime
---
modules.d/99base/init.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index 0ea72e8..65bc88f 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -46,7 +46,7 @@ if [ "$RD_DEBUG" = "yes" ]; then
fi
if ! ismounted /dev; then
- mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev >/dev/null
+ mount -t devtmpfs -o mode=0755,nosuid,strictatime devtmpfs /dev >/dev/null
fi
# prepare the /dev directory
@@ -62,12 +62,12 @@ fi
if ! ismounted /dev/shm; then
mkdir -m 0755 /dev/shm
- mount -t tmpfs -o mode=1777,nosuid,nodev tmpfs /dev/shm >/dev/null
+ mount -t tmpfs -o mode=1777,nosuid,nodev,strictatime tmpfs /dev/shm >/dev/null
fi
if ! ismounted /run; then
mkdir -m 0755 /newrun
- mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /newrun >/dev/null
+ mount -t tmpfs -o mode=0755,nosuid,nodev,strictatime tmpfs /newrun >/dev/null
cp -a /run/* /newrun >/dev/null 2>&1
mount --move /newrun /run
rm -fr /newrun

View File

@ -0,0 +1,26 @@
From b4664769dc63959c60c459effcf64ba284afdc55 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 18 Apr 2012 13:08:12 +0200
Subject: [PATCH] 99shutdown/shutdown.sh: export PATH
---
modules.d/99shutdown/shutdown.sh | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/modules.d/99shutdown/shutdown.sh b/modules.d/99shutdown/shutdown.sh
index 45345a4..aa0a81f 100755
--- a/modules.d/99shutdown/shutdown.sh
+++ b/modules.d/99shutdown/shutdown.sh
@@ -7,10 +7,9 @@
# Copyright 2011, Red Hat, Inc.
# Harald Hoyer <harald@redhat.com>
-#!/bin/sh
-. /lib/dracut-lib.sh
export TERM=linux
-PATH=/usr/sbin:/usr/bin:/sbin:/bin
+export PATH=/usr/sbin:/usr/bin:/sbin:/bin
+. /lib/dracut-lib.sh
trap "emergency_shell --shutdown shutdown Signal caught!" 0
getarg 'rd.break=pre-shutdown' && emergency_shell --shutdown pre-shutdown "Break before pre-shutdown"

View File

@ -0,0 +1,26 @@
From 2de297334b4e186c1c823e8a1e04f46ae46b899a Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 18 Apr 2012 13:14:55 +0200
Subject: [PATCH] Makefile: do not install systemd service in reboot
shutdown is enough. It is pulled in on reboot.
---
Makefile | 3 ---
1 file changed, 3 deletions(-)
diff --git a/Makefile b/Makefile
index c62aae1..5ce1778 100644
--- a/Makefile
+++ b/Makefile
@@ -57,11 +57,8 @@ install: doc
if [ -n "$(systemdsystemunitdir)" ]; then \
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \
- mkdir -p $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants; \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants; \
ln -s ../dracut-shutdown.service \
- $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants/dracut-shutdown.service; \
- ln -s ../dracut-shutdown.service \
$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
fi

View File

@ -0,0 +1,22 @@
From 76b83902dc28c8b7240c346b3e9a721712301bbf Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 18 Apr 2012 13:49:48 +0200
Subject: [PATCH] network/module-setup.sh: include all kernel/drivers/net/phy
drivers
---
modules.d/40network/module-setup.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index 97fc5cb..253a87e 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
@@ -61,6 +61,7 @@ installkernel() {
{ find_kernel_modules_by_path drivers/net; find_kernel_modules_by_path drivers/s390/net; } \
| net_module_filter | instmods
+ instmods =drivers/net/phy
instmods ecb arc4
# bridge modules
instmods bridge stp llc

View File

@ -0,0 +1,105 @@
From 2e7257a2e3bf91c11e8cc56f609b288403f9be14 Mon Sep 17 00:00:00 2001
From: Dave Young <dyoung@redhat.com>
Date: Thu, 19 Apr 2012 12:01:36 +0800
Subject: [PATCH] add pre-pivot-cleanup hook
Sometimes some hook script will need to be before the cleanup hook scripts
For example dhclient killing, nfs cleanup, etc. must not happen before kdump
because it will use their fuctionalities.
So here introduce a new hook pre-pivot-cleanup, all cleanup scripts will go there.
that means pre-pivot hook is splited to two hooks pre-pivot and pre-pivot-cleanup
Signed-off-by: Dave Young <dyoung@redhat.com>
---
README.modules | 3 +++
dracut-functions.sh | 2 +-
dracut.asc | 7 ++++++-
dracut.cmdline.7.asc | 2 +-
modules.d/99base/init.sh | 7 ++++++-
5 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/README.modules b/README.modules
index 21461de..188d011 100644
--- a/README.modules
+++ b/README.modules
@@ -103,6 +103,9 @@ init has the following hook points to inject scripts:
a timeout.
/lib/dracut/hooks/pre-pivot/*.sh
+ scripts to run before latter initramfs cleanups
+
+/lib/dracut/hooks/pre-pivot-cleanup/*.sh
scripts to run before the real init is executed and the initramfs
disappears
All processes started before should be killed here.
diff --git a/dracut-functions.sh b/dracut-functions.sh
index f5611dc..ccf3ba6 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -36,7 +36,7 @@ fi
[[ $hookdirs ]] || {
hookdirs="cmdline pre-udev pre-trigger netroot "
hookdirs+="initqueue initqueue/settled initqueue/online initqueue/finished initqueue/timeout "
- hookdirs+="pre-mount pre-pivot mount "
+ hookdirs+="pre-mount pre-pivot pre-pivot-cleanup mount "
hookdirs+="emergency shutdown-emergency shutdown cleanup "
export hookdirs
}
diff --git a/dracut.asc b/dracut.asc
index 1a0e3d2..9621db2 100644
--- a/dracut.asc
+++ b/dracut.asc
@@ -854,12 +854,17 @@ This hook is mainly to mount the real root device.
=== Hook: pre-pivot
+This hook is called before pre-pivot-cleanup hook, This is a good place for
+actions other than cleanups which need to be called before pivot.
+
+
+=== Hook: pre-pivot-cleanup
+
This hook is the last hook and is called before init finally switches root to
the real root device. This is a good place to clean up and kill processes not
needed anymore.
-
=== Cleanup and switch_root
Init kills all udev processes, cleans up the environment, sets up the arguments
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index c77fee5..76db651 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -105,7 +105,7 @@ Debug
**rd.break**::
drop to a shell at the end
-**rd.break=**_{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot}_::
+**rd.break=**_{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|pre-pivot-cleanup}_::
drop to a shell on defined breakpoint
**rd.udev.info**::
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index 65bc88f..88ec184 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -224,10 +224,15 @@ done
while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
} | vinfo
-# pre pivot scripts are sourced just before we switch over to the new root.
+# pre pivot scripts are sourced just before we doing cleanup and switch over
+# to the new root.
getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
source_hook pre-pivot
+# pre pivot cleanup scripts are sourced just before we switch over to the new root.
+getarg 'rd.break=pre-pivot-cleanup' 'rdbreak=pre-pivot-cleanup' && emergency_shell -n pre-pivot-cleanup "Break pre-pivot-cleanup"
+source_hook pre-pivot-cleanup
+
# By the time we get here, the root filesystem should be mounted.
# Try to find init.
for i in "$(getarg real_init=)" "$(getarg init=)" $(getargs rd.distroinit=) /sbin/init; do

View File

@ -0,0 +1,86 @@
From 1bd76bf981d5cec3d5ba879102d84040aa5b902d Mon Sep 17 00:00:00 2001
From: Dave Young <dyoung@redhat.com>
Date: Thu, 19 Apr 2012 12:01:43 +0800
Subject: [PATCH] move cleanup scripts to pre-pivot-cleanup hook
below cleanup scripts is moved:
40network: kill-dhclient.sh
90crypt: crypt-cleanup.sh
90multipath: multipathd-stop.sh
95iscsi: cleanup-iscsi.sh
95nfs: nfsroot-cleanup.sh
Signed-off-by: Dave Young <dyoung@redhat.com>
---
modules.d/40network/module-setup.sh | 2 +-
modules.d/90crypt/module-setup.sh | 2 +-
modules.d/90multipath/module-setup.sh | 2 +-
modules.d/95iscsi/module-setup.sh | 2 +-
modules.d/95nfs/module-setup.sh | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index 253a87e..c2ad815 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
@@ -86,7 +86,7 @@ install() {
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
- inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
+ inst_hook pre-pivot-cleanup 10 "$moddir/kill-dhclient.sh"
_arch=$(uname -m)
diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
index 8fdf32b..4a66516 100755
--- a/modules.d/90crypt/module-setup.sh
+++ b/modules.d/90crypt/module-setup.sh
@@ -48,7 +48,7 @@ install() {
inst "$moddir"/probe-keydev.sh /sbin/probe-keydev
inst_hook cmdline 10 "$moddir/parse-keydev.sh"
inst_hook cmdline 30 "$moddir/parse-crypt.sh"
- inst_hook pre-pivot 30 "$moddir/crypt-cleanup.sh"
+ inst_hook pre-pivot-cleanup 30 "$moddir/crypt-cleanup.sh"
inst_simple /etc/crypttab
inst "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
}
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index 8a193c4..f044f33 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -70,7 +70,7 @@ install() {
inst_libdir_file "multipath/*"
inst_hook pre-trigger 02 "$moddir/multipathd.sh"
- inst_hook pre-pivot 02 "$moddir/multipathd-stop.sh"
+ inst_hook pre-pivot-cleanup 02 "$moddir/multipathd-stop.sh"
inst_rules 40-multipath.rules
}
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index b6c1c1f..a001a28 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -63,7 +63,7 @@ install() {
inst hostname
inst iscsi-iname
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
- inst_hook pre-pivot 90 "$moddir/cleanup-iscsi.sh"
+ inst_hook pre-pivot-cleanup 90 "$moddir/cleanup-iscsi.sh"
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
}
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index 455f52f..3587bdd 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -58,7 +58,7 @@ install() {
inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
inst_hook pre-udev 99 "$moddir/nfs-start-rpc.sh"
- inst_hook pre-pivot 99 "$moddir/nfsroot-cleanup.sh"
+ inst_hook pre-pivot-cleanup 99 "$moddir/nfsroot-cleanup.sh"
inst "$moddir/nfsroot.sh" "/sbin/nfsroot"
inst "$moddir/nfs-lib.sh" "/lib/nfs-lib.sh"
mkdir -m 0755 -p "$initdir/var/lib/nfs/rpc_pipefs"

View File

@ -0,0 +1,30 @@
From 689c3e1fcd0fff7ae978d0543fa980272f89dff2 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 19 Apr 2012 16:41:04 +0200
Subject: [PATCH] network/parse-ip-opts.sh: remove check for netroot
with anaconda and all other kind of stuff, we might want network, even
for root not on the network
---
modules.d/40network/parse-ip-opts.sh | 8 --------
1 file changed, 8 deletions(-)
diff --git a/modules.d/40network/parse-ip-opts.sh b/modules.d/40network/parse-ip-opts.sh
index 97702a2..5637a9a 100755
--- a/modules.d/40network/parse-ip-opts.sh
+++ b/modules.d/40network/parse-ip-opts.sh
@@ -17,14 +17,6 @@
command -v getarg >/dev/null || . /lib/dracut-lib.sh
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
-# Check if ip= lines should be used
-if getarg ip= >/dev/null ; then
- if [ -z "$netroot" ] ; then
- echo "Warning: No netboot configured, ignoring ip= lines"
- return;
- fi
-fi
-
# Don't mix BOOTIF=macaddr from pxelinux and ip= lines
getarg ip= >/dev/null && getarg BOOTIF= >/dev/null && \
die "Mixing BOOTIF and ip= lines is dangerous"

View File

@ -10,7 +10,7 @@
Name: dracut
Version: 018
Release: 22.git20120418%{?dist}
Release: 25.git20120419%{?dist}
Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel}
@ -40,11 +40,14 @@ Patch13: 0013-virtfs-root-filesystem-support.patch
Patch14: 0014-dracut.spec-do-not-include-IMA-and-selinux-modules-w.patch
Patch15: 0015-Do-not-run-plymouth-hook-if-the-binary-is-missing.patch
Patch16: 0016-man-Fix-add-fstab-option-in-man-page.patch
Patch17: 0017-network-move-the-kill-dhclient.sh-hook-later.patch
Patch18: 0018-udevd-moved-to-lib-systemd-systemd-udevd.patch
Patch19: 0019-base-init.sh-mount-tmpfs-with-strictatime.patch
Patch20: 0020-99shutdown-shutdown.sh-export-PATH.patch
Patch21: 0021-Makefile-do-not-install-systemd-service-in-reboot.patch
Patch17: 0017-udevd-moved-to-lib-systemd-systemd-udevd.patch
Patch18: 0018-base-init.sh-mount-tmpfs-with-strictatime.patch
Patch19: 0019-99shutdown-shutdown.sh-export-PATH.patch
Patch20: 0020-Makefile-do-not-install-systemd-service-in-reboot.patch
Patch21: 0021-network-module-setup.sh-include-all-kernel-drivers-n.patch
Patch22: 0022-add-pre-pivot-cleanup-hook.patch
Patch23: 0023-move-cleanup-scripts-to-pre-pivot-cleanup-hook.patch
Patch24: 0024-network-parse-ip-opts.sh-remove-check-for-netroot.patch
BuildArch: noarch
@ -361,6 +364,9 @@ rm -rf $RPM_BUILD_ROOT
%dir /var/lib/dracut/overlay
%changelog
* Thu Apr 19 2012 Harald Hoyer <harald@redhat.com> 018-25.git20120419
- fixed network for non-network root (like installer media)
* Wed Apr 18 2012 Harald Hoyer <harald@redhat.com> 018-22.git20120418
- new upstream version