From 2f4f1d71a4e811a611782fa1511e28a83f6a932c Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Apr 24 2012 13:58:18 +0000 Subject: new upstream version --- diff --git a/0010-virtfs-root-filesystem-support.patch b/0010-virtfs-root-filesystem-support.patch deleted file mode 100644 index 247075a..0000000 --- a/0010-virtfs-root-filesystem-support.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 4c32a717692fa5a74d10d9710dd5d358890f0d4e Mon Sep 17 00:00:00 2001 -From: Lennert Buytenhek -Date: Sun, 15 Apr 2012 02:40:17 +0200 -Subject: [PATCH] virtfs root filesystem support - -Qemu/KVM provides virtfs, a paravirtualised filesystem that is -implemented by running the Plan 9 folder sharing protocol over -virtio. - -Make booting with root=virtfs:foobar use the virtfs filesystem -with mount tag 'foobar' as root filesystem, to allow booting -virtual machines off virtfs. - -Note that this only handles 9p over virtio (i.e. virtfs), and -doesn't attempt to handle mounting 9p filesystems over TCP/IP, -for example. - -Signed-off-by: Lennert Buytenhek ---- - dracut.spec | 1 + - modules.d/95virtfs/module-setup.sh | 27 +++++++++++++ - modules.d/95virtfs/mount-virtfs.sh | 75 ++++++++++++++++++++++++++++++++++++ - modules.d/95virtfs/parse-virtfs.sh | 9 +++++ - 4 files changed, 112 insertions(+) - create mode 100755 modules.d/95virtfs/module-setup.sh - create mode 100755 modules.d/95virtfs/mount-virtfs.sh - create mode 100755 modules.d/95virtfs/parse-virtfs.sh - -diff --git a/dracut.spec b/dracut.spec -index 074cb10..9cd08b7 100644 ---- a/dracut.spec -+++ b/dracut.spec -@@ -270,6 +270,7 @@ rm -rf $RPM_BUILD_ROOT - %{dracutlibdir}/modules.d/95zfcp - %{dracutlibdir}/modules.d/95terminfo - %{dracutlibdir}/modules.d/95udev-rules -+%{dracutlibdir}/modules.d/95virtfs - %{dracutlibdir}/modules.d/96securityfs - %{dracutlibdir}/modules.d/97biosdevname - %{dracutlibdir}/modules.d/97masterkey -diff --git a/modules.d/95virtfs/module-setup.sh b/modules.d/95virtfs/module-setup.sh -new file mode 100755 -index 0000000..a6081c2 ---- /dev/null -+++ b/modules.d/95virtfs/module-setup.sh -@@ -0,0 +1,27 @@ -+#!/bin/bash -+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -+# ex: ts=8 sw=4 sts=4 et filetype=sh -+ -+check() { -+ [[ $hostonly ]] || [[ $mount_needs ]] && { -+ for fs in ${host_fs_types[@]}; do -+ strstr "$fs" "\|9p" && return 0 -+ done -+ return 1 -+ } -+ -+ return 0 -+} -+ -+depends() { -+ return 0 -+} -+ -+installkernel() { -+ instmods 9p 9pnet_virtio -+} -+ -+install() { -+ inst_hook cmdline 95 "$moddir/parse-virtfs.sh" -+ inst_hook mount 99 "$moddir/mount-virtfs.sh" -+} -diff --git a/modules.d/95virtfs/mount-virtfs.sh b/modules.d/95virtfs/mount-virtfs.sh -new file mode 100755 -index 0000000..dfebf38 ---- /dev/null -+++ b/modules.d/95virtfs/mount-virtfs.sh -@@ -0,0 +1,75 @@ -+#!/bin/sh -+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -+# ex: ts=8 sw=4 sts=4 et filetype=sh -+ -+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh -+ -+filter_rootopts() { -+ rootopts=$1 -+ # strip ro and rw options -+ local OLDIFS="$IFS" -+ IFS=, -+ set -- $rootopts -+ IFS="$OLDIFS" -+ local v -+ while [ $# -gt 0 ]; do -+ case $1 in -+ rw|ro);; -+ defaults);; -+ *) -+ v="$v,${1}";; -+ esac -+ shift -+ done -+ rootopts=${v#,} -+ echo $rootopts -+} -+ -+mount_root() { -+ local _ret -+ -+ rootfs="9p" -+ rflags="trans=virtio,version=9p2000.L" -+ -+ modprobe 9pnet_virtio -+ -+ mount -t ${rootfs} -o "$rflags",ro "${root#virtfs:}" "$NEWROOT" -+ -+ rootopts= -+ if getargbool 1 rd.fstab -n rd_NO_FSTAB \ -+ && ! getarg rootflags \ -+ && [ -f "$NEWROOT/etc/fstab" ] \ -+ && ! [ -L "$NEWROOT/etc/fstab" ]; then -+ # if $NEWROOT/etc/fstab contains special mount options for -+ # the root filesystem, -+ # remount it with the proper options -+ rootopts="defaults" -+ while read dev mp fs opts rest; do -+ # skip comments -+ [ "${dev%%#*}" != "$dev" ] && continue -+ -+ if [ "$mp" = "/" ]; then -+ rootopts=$opts -+ break -+ fi -+ done < "$NEWROOT/etc/fstab" -+ -+ rootopts=$(filter_rootopts $rootopts) -+ fi -+ -+ # we want rootflags (rflags) to take precedence so prepend rootopts to -+ # them; rflags is guaranteed to not be empty -+ rflags="${rootopts:+"${rootopts},"}${rflags}" -+ -+ umount "$NEWROOT" -+ -+ info "Remounting ${root#virtfs:} with -o ${rflags}" -+ mount -t ${rootfs} -o "$rflags" "${root#virtfs:}" "$NEWROOT" 2>&1 | vinfo -+ -+ [ -f "$NEWROOT"/forcefsck ] && rm -f "$NEWROOT"/forcefsck 2>/dev/null -+ [ -f "$NEWROOT"/.autofsck ] && rm -f "$NEWROOT"/.autofsck 2>/dev/null -+} -+ -+if [ -n "$root" -a -z "${root%%virtfs:*}" ]; then -+ mount_root -+fi -diff --git a/modules.d/95virtfs/parse-virtfs.sh b/modules.d/95virtfs/parse-virtfs.sh -new file mode 100755 -index 0000000..ce6de6d ---- /dev/null -+++ b/modules.d/95virtfs/parse-virtfs.sh -@@ -0,0 +1,9 @@ -+#!/bin/sh -+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -+# ex: ts=8 sw=4 sts=4 et filetype=sh -+ -+if [ "${root%%:*}" = "virtfs" ] ; then -+ modprobe 9pnet_virtio -+ -+ rootok=1 -+fi diff --git a/0011-udev-rules-remove-01-ignore.rules.patch b/0011-udev-rules-remove-01-ignore.rules.patch deleted file mode 100644 index 16b9b1b..0000000 --- a/0011-udev-rules-remove-01-ignore.rules.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 5d73033e540846a42e26449f72191c11989d4721 Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -Date: Mon, 16 Apr 2012 14:50:35 +0200 -Subject: [PATCH] udev-rules: remove 01-ignore.rules - ---- - modules.d/95udev-rules/01-ignore.rules | 1 - - modules.d/95udev-rules/module-setup.sh | 3 --- - 2 files changed, 4 deletions(-) - delete mode 100644 modules.d/95udev-rules/01-ignore.rules - -diff --git a/modules.d/95udev-rules/01-ignore.rules b/modules.d/95udev-rules/01-ignore.rules -deleted file mode 100644 -index b32f22e..0000000 ---- a/modules.d/95udev-rules/01-ignore.rules -+++ /dev/null -@@ -1 +0,0 @@ --KERNEL=="ram[0-9]*", OPTIONS+="ignore_device", OPTIONS+="last_rule" -diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh -index 1c71336..b17232f 100755 ---- a/modules.d/95udev-rules/module-setup.sh -+++ b/modules.d/95udev-rules/module-setup.sh -@@ -20,9 +20,6 @@ install() { - #Some debian udev rules are named differently - inst_rules 50-udev.rules 95-late.rules - -- # ignore some devices in the initrd -- inst_rules "$moddir/01-ignore.rules" -- - # for firmware loading - inst_rules 50-firmware.rules - dracut_install cat uname diff --git a/0017-network-move-the-kill-dhclient.sh-hook-later.patch b/0017-network-move-the-kill-dhclient.sh-hook-later.patch deleted file mode 100644 index 0809424..0000000 --- a/0017-network-move-the-kill-dhclient.sh-hook-later.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 3ba29cde19a9e66d3ad1a74d481356168e27ddab Mon Sep 17 00:00:00 2001 -From: Cong Wang -Date: Tue, 17 Apr 2012 21:25:11 +0800 -Subject: [PATCH] network: move the kill-dhclient.sh hook later - -kdump module uses a pre-pivot hook too, it needs networking, so -do not kill dhclient so early. kdump hook needs to find a place -where all needed fs are mounted meanwhile networking works too. - -Cc: Harald Hoyer -Signed-off-by: Cong Wang ---- - modules.d/40network/module-setup.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh -index 97fc5cb..49e440e 100755 ---- a/modules.d/40network/module-setup.sh -+++ b/modules.d/40network/module-setup.sh -@@ -85,7 +85,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 98 "$moddir/kill-dhclient.sh" - - _arch=$(uname -m) - diff --git a/0018-udevd-moved-to-lib-systemd-systemd-udevd.patch b/0018-udevd-moved-to-lib-systemd-systemd-udevd.patch deleted file mode 100644 index 165f957..0000000 --- a/0018-udevd-moved-to-lib-systemd-systemd-udevd.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 2369f8aa7684df0b1b0dbd1fd24823ea8d78ad13 Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -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" diff --git a/0019-base-init.sh-mount-tmpfs-with-strictatime.patch b/0019-base-init.sh-mount-tmpfs-with-strictatime.patch deleted file mode 100644 index d19a7cb..0000000 --- a/0019-base-init.sh-mount-tmpfs-with-strictatime.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 6d25b60e719a41340adff21d4a3ef0ab525c8b5d Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -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 diff --git a/0020-99shutdown-shutdown.sh-export-PATH.patch b/0020-99shutdown-shutdown.sh-export-PATH.patch deleted file mode 100644 index 874bad8..0000000 --- a/0020-99shutdown-shutdown.sh-export-PATH.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 4ce38419808566708beb8be2350b028b69c531d9 Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -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 - --#!/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" diff --git a/0021-Makefile-do-not-install-systemd-service-in-reboot.patch b/0021-Makefile-do-not-install-systemd-service-in-reboot.patch deleted file mode 100644 index 3784f14..0000000 --- a/0021-Makefile-do-not-install-systemd-service-in-reboot.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 817ddcf053f8d068a6bf6089e25059f171cd8493 Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -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 - diff --git a/0025-url-lib-don-t-add-existing-handlers-multiple-times.patch b/0025-url-lib-don-t-add-existing-handlers-multiple-times.patch new file mode 100644 index 0000000..89d342c --- /dev/null +++ b/0025-url-lib-don-t-add-existing-handlers-multiple-times.patch @@ -0,0 +1,27 @@ +From c6a91ec9928f7f09dd70ad597bf96ac60f6b652d Mon Sep 17 00:00:00 2001 +From: Will Woods +Date: Fri, 20 Apr 2012 16:20:24 -0400 +Subject: [PATCH] url-lib: don't add existing handlers multiple times + +Every time url-lib gets imported we end up making the list of handlers +longer with redundant entries. That's silly - we shouldn't add items +that already exist. + +Note that this means you'll have to manipulate the handler list yourself +if you want to change the position/priority of existing handlers. +--- + modules.d/45url-lib/url-lib.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/modules.d/45url-lib/url-lib.sh b/modules.d/45url-lib/url-lib.sh +index e305a68..7930146 100755 +--- a/modules.d/45url-lib/url-lib.sh ++++ b/modules.d/45url-lib/url-lib.sh +@@ -43,6 +43,7 @@ add_url_handler() { + local schemes="$@" scheme="" + set -- + for scheme in $schemes; do ++ [ "$(get_url_handler $scheme)" = "$handler" ] && continue + set -- "$@" "$scheme:$handler" + done + set -- $@ $url_handler_map # add new items to *front* of list diff --git a/0026-url-lib-don-t-use-progress-bar-if-TERM-dumb-RHBZ-814.patch b/0026-url-lib-don-t-use-progress-bar-if-TERM-dumb-RHBZ-814.patch new file mode 100644 index 0000000..70b8b29 --- /dev/null +++ b/0026-url-lib-don-t-use-progress-bar-if-TERM-dumb-RHBZ-814.patch @@ -0,0 +1,34 @@ +From dc1504121b1119f9d797aa276f040f3dfe9d56a3 Mon Sep 17 00:00:00 2001 +From: Will Woods +Date: Fri, 20 Apr 2012 16:20:25 -0400 +Subject: [PATCH] url-lib: don't use --progress-bar if TERM=dumb (RHBZ#814713) + +Basically, s390 is the only place I've ever seen TERM=dumb, and it's too +dumb to handle '\r', so --progress-bar produces waaaaay too much output. + +The normal progress meter only prints something once per second, so +that's reasonable on terminals where '\r' doesn't work. + +See also: https://bugzilla.redhat.com/show_bug.cgi?id=814713 +--- + modules.d/45url-lib/url-lib.sh | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/modules.d/45url-lib/url-lib.sh b/modules.d/45url-lib/url-lib.sh +index 7930146..5721294 100755 +--- a/modules.d/45url-lib/url-lib.sh ++++ b/modules.d/45url-lib/url-lib.sh +@@ -54,7 +54,12 @@ add_url_handler() { + + export CURL_HOME="/run/initramfs/url-lib" + mkdir -p $CURL_HOME +-curl_args="--location --retry 3 --fail --show-error --progress-bar" ++curl_args="--location --retry 3 --fail --show-error" ++ ++# technically "dumb" can handle the progress bar, but the only thing I've ever ++# seen using TERM=dumb is s390 CMS, and it's too dumb for --progress-bar ++[ "$TERM" != "dumb" ] && curl_args="$curl_args --progress-bar" ++ + curl_fetch_url() { + local url="$1" outloc="$2" + echo "$url" > /proc/self/fd/0 diff --git a/0027-base-add-debug_on-and-debug_off-functions.patch b/0027-base-add-debug_on-and-debug_off-functions.patch new file mode 100644 index 0000000..8f767ef --- /dev/null +++ b/0027-base-add-debug_on-and-debug_off-functions.patch @@ -0,0 +1,206 @@ +From c32908cee324c60cc6d31a7030a9fb11cdfa0d45 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 23 Apr 2012 11:28:10 +0200 +Subject: [PATCH] base: add debug_on() and debug_off() functions + +--- + modules.d/99base/dracut-lib.sh | 42 +++++++++++++++++++++++++++------------- + modules.d/99base/init.sh | 6 ++---- + 2 files changed, 31 insertions(+), 17 deletions(-) + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index a29d586..f46c4a7 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -2,6 +2,14 @@ + # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- + # ex: ts=8 sw=4 sts=4 et filetype=sh + ++debug_off() { ++ set +x ++} ++ ++debug_on() { ++ [ "$RD_DEBUG" = "yes" ] && set -x ++} ++ + # returns OK if $1 contains $2 + strstr() { + [ "${1#*$2*}" != "$1" ] +@@ -93,29 +101,29 @@ _dogetarg() { + } + + getarg() { +- set +x ++ debug_off + while [ $# -gt 0 ]; do + case $1 in + -y) if _dogetarg $2 >/dev/null; then + echo 1 +- [ "$RD_DEBUG" = "yes" ] && set -x ++ debug_on + return 0 + fi + shift 2;; + -n) if _dogetarg $2 >/dev/null; then + echo 0; +- [ "$RD_DEBUG" = "yes" ] && set -x ++ debug_on + return 1 + fi + shift 2;; + *) if _dogetarg $1; then +- [ "$RD_DEBUG" = "yes" ] && set -x ++ debug_on + return 0; + fi + shift;; + esac + done +- [ "$RD_DEBUG" = "yes" ] && set -x ++ debug_on + return 1 + } + +@@ -135,7 +143,7 @@ getargbool() { + } + + _dogetargs() { +- set +x ++ debug_off + local _o _found _key + unset _o + unset _found +@@ -158,7 +166,7 @@ _dogetargs() { + } + + getargs() { +- set +x ++ debug_off + local _val _i _args _gfound + unset _val + unset _gfound +@@ -175,10 +183,10 @@ getargs() { + else + echo -n 1 + fi +- [ "$RD_DEBUG" = "yes" ] && set -x ++ debug_on + return 0 + fi +- [ "$RD_DEBUG" = "yes" ] && set -x ++ debug_on + return 1; + } + +@@ -221,6 +229,7 @@ getoptcomma() { + # + # TODO: ':' inside fields. + splitsep() { ++ debug_off + local sep="$1"; local str="$2"; shift 2 + local tmp + +@@ -232,7 +241,7 @@ splitsep() { + shift + done + [ -n "$str" -a -n "$1" ] && eval "$1=$str" +- ++ debug_on + return 0 + } + +@@ -248,7 +257,7 @@ setdebug() { + fi + export RD_DEBUG + fi +- [ "$RD_DEBUG" = "yes" ] && set -x ++ debug_on + } + + setdebug +@@ -347,6 +356,7 @@ check_occurances() { + } + + incol2() { ++ debug_off + local dummy check; + local file="$1"; + local str="$2"; +@@ -355,8 +365,12 @@ incol2() { + [ -z "$str" ] && return 1; + + while read dummy check restofline; do +- [ "$check" = "$str" ] && return 0 ++ if [ "$check" = "$str" ]; then ++ debug_on ++ return 0 ++ fi + done < $file ++ debug_on + return 1 + } + +@@ -719,6 +733,7 @@ cancel_wait_for_dev() + } + + killproc() { ++ debug_off + local _exe="$(command -v $1)" + local _sig=$2 + local _i +@@ -729,6 +744,7 @@ killproc() { + kill $_sig ${_i##*/} + fi + done ++ debug_on + } + + need_shutdown() { +@@ -739,7 +755,7 @@ wait_for_loginit() + { + [ "$RD_DEBUG" = "yes" ] || return + [ -e /run/initramfs/loginit.pipe ] || return +- set +x ++ debug_off + echo "DRACUT_LOG_END" + exec 0<>/dev/console 1<>/dev/console 2<>/dev/console + # wait for loginit +diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh +index 88ec184..cb03137 100755 +--- a/modules.d/99base/init.sh ++++ b/modules.d/99base/init.sh +@@ -277,7 +277,6 @@ for var in root rflags fstype netroot NEWROOT; do + done + + export RD_TIMESTAMP +-set +x # Turn off debugging for this section + # Clean up the environment + for i in $(export -p); do + i=${i#declare -x} +@@ -298,7 +297,6 @@ rm -f /tmp/export.orig + initargs="" + read CLINE /dev/null ; then +- set +x # Turn off debugging for this section + ignoreargs="console BOOT_IMAGE" + # only pass arguments after init= to the init + CLINE=${CLINE#*init=} +@@ -312,7 +310,7 @@ if getarg init= >/dev/null ; then + done + unset CLINE + else +- set +x # Turn off debugging for this section ++ debug_off # Turn off debugging for this section + set -- $CLINE + for x in "$@"; do + case "$x" in +@@ -322,7 +320,7 @@ else + esac + done + fi +-[ "$RD_DEBUG" = "yes" ] && set -x ++debug_on + + if ! [ -d "$NEWROOT"/run ]; then + NEWRUN=/dev/.initramfs diff --git a/0028-base-add-export_n-function.patch b/0028-base-add-export_n-function.patch new file mode 100644 index 0000000..614b16f --- /dev/null +++ b/0028-base-add-export_n-function.patch @@ -0,0 +1,62 @@ +From 476eb1b345764a7317f32da52b9b36f26fdf51ba Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 23 Apr 2012 11:28:59 +0200 +Subject: [PATCH] base: add export_n() function + +resembles export -n for dash +--- + modules.d/99base/dracut-lib.sh | 13 +++++++++++++ + modules.d/99base/init.sh | 12 ++++-------- + 2 files changed, 17 insertions(+), 8 deletions(-) + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index f46c4a7..a4aa20c 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -821,3 +821,16 @@ emergency_shell() + exit 1 + fi + } ++ ++# Retain the values of these variables but ensure that they are unexported ++# This is a POSIX-compliant equivalent of bash's "export -n" ++export_n() ++{ ++ local var ++ local val ++ for var in "$@"; do ++ eval val=\$$var ++ unset $var ++ [ -n "$val" ] && eval $var=\"$val\" ++ done ++} +diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh +index cb03137..aea739f 100755 +--- a/modules.d/99base/init.sh ++++ b/modules.d/99base/init.sh +@@ -251,7 +251,6 @@ done + emergency_shell + } + +- + if [ $UDEVVERSION -lt 168 ]; then + # stop udev queue before killing it + udevadm control --stop-exec-queue +@@ -268,13 +267,10 @@ else + udevadm info --cleanup-db + fi + +-# Retain the values of these variables but ensure that they are unexported +-# This is a POSIX-compliant equivalent of bash's "export -n" +-for var in root rflags fstype netroot NEWROOT; do +- eval tmp=\$$var +- unset $var +- [ -n "$tmp" ] && eval $var=\"$tmp\" +-done ++debug_off # Turn off debugging for this section ++ ++# unexport some vars ++export_n root rflags fstype netroot NEWROOT + + export RD_TIMESTAMP + # Clean up the environment diff --git a/0029-base-dracut-lib.sh-add-arguments-for-source_hook-and.patch b/0029-base-dracut-lib.sh-add-arguments-for-source_hook-and.patch new file mode 100644 index 0000000..266428b --- /dev/null +++ b/0029-base-dracut-lib.sh-add-arguments-for-source_hook-and.patch @@ -0,0 +1,37 @@ +From f8d50f60b376682217eb1a88e2e07c54cd5e9955 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 23 Apr 2012 11:30:08 +0200 +Subject: [PATCH] base/dracut-lib.sh: add arguments for source_hook() and + source_all() + +--- + modules.d/99base/dracut-lib.sh | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index a4aa20c..a6b8d1a 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -264,15 +264,19 @@ setdebug + + source_all() { + local f +- [ "$1" ] && [ -d "/$1" ] || return +- for f in "/$1"/*.sh; do [ -e "$f" ] && . "$f"; done ++ local _dir ++ _dir=$1; shift ++ [ "$_dir" ] && [ -d "/$_dir" ] || return ++ for f in "/$_dir"/*.sh; do [ -e "$f" ] && . "$f" "$@"; done + } + + hookdir=/lib/dracut/hooks + export hookdir + + source_hook() { +- source_all "/lib/dracut/hooks/$1" ++ local _dir ++ _dir=$1; shift ++ source_all "/lib/dracut/hooks/$_dir" "$@" + } + + check_finished() { diff --git a/0030-merge-cleanup-and-pre-pivot-cleanup-hooks.patch b/0030-merge-cleanup-and-pre-pivot-cleanup-hooks.patch new file mode 100644 index 0000000..102d7e1 --- /dev/null +++ b/0030-merge-cleanup-and-pre-pivot-cleanup-hooks.patch @@ -0,0 +1,165 @@ +From eef7649e712481aa3bd821d4b11c39541611b4fd Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 23 Apr 2012 11:31:32 +0200 +Subject: [PATCH] merge "cleanup" and "pre-pivot-cleanup" hooks + +--- + README.modules | 2 +- + dracut-functions.sh | 4 ++-- + dracut.asc | 4 ++-- + dracut.cmdline.7.asc | 2 +- + 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 +- + modules.d/99base/init.sh | 5 ++--- + 10 files changed, 13 insertions(+), 14 deletions(-) + +diff --git a/README.modules b/README.modules +index 188d011..64d533f 100644 +--- a/README.modules ++++ b/README.modules +@@ -105,7 +105,7 @@ init has the following hook points to inject scripts: + /lib/dracut/hooks/pre-pivot/*.sh + scripts to run before latter initramfs cleanups + +-/lib/dracut/hooks/pre-pivot-cleanup/*.sh ++/lib/dracut/hooks/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 ccf3ba6..ff4e16d 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -36,8 +36,8 @@ fi + [[ $hookdirs ]] || { + hookdirs="cmdline pre-udev pre-trigger netroot " + hookdirs+="initqueue initqueue/settled initqueue/online initqueue/finished initqueue/timeout " +- hookdirs+="pre-mount pre-pivot pre-pivot-cleanup mount " +- hookdirs+="emergency shutdown-emergency shutdown cleanup " ++ hookdirs+="pre-mount pre-pivot cleanup mount " ++ hookdirs+="emergency shutdown-emergency shutdown " + export hookdirs + } + +diff --git a/dracut.asc b/dracut.asc +index 9621db2..a6e050d 100644 +--- a/dracut.asc ++++ b/dracut.asc +@@ -854,11 +854,11 @@ 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 ++This hook is called before cleanup hook, This is a good place for + actions other than cleanups which need to be called before pivot. + + +-=== Hook: pre-pivot-cleanup ++=== Hook: 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 +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index 76db651..61cd139 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|pre-pivot-cleanup}_:: ++**rd.break=**_{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|cleanup}_:: + drop to a shell on defined breakpoint + + **rd.udev.info**:: +diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh +index c2ad815..d49b594 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-cleanup 10 "$moddir/kill-dhclient.sh" ++ inst_hook 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 4a66516..5082434 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-cleanup 30 "$moddir/crypt-cleanup.sh" ++ inst_hook 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 f044f33..2bc1b41 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-cleanup 02 "$moddir/multipathd-stop.sh" ++ inst_hook 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 a001a28..2f343ee 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-cleanup 90 "$moddir/cleanup-iscsi.sh" ++ inst_hook 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 3587bdd..1d62e95 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-cleanup 99 "$moddir/nfsroot-cleanup.sh" ++ inst_hook 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" +diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh +index aea739f..cba2e1a 100755 +--- a/modules.d/99base/init.sh ++++ b/modules.d/99base/init.sh +@@ -230,8 +230,8 @@ getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n 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 ++getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup" ++source_hook cleanup + + # By the time we get here, the root filesystem should be mounted. + # Try to find init. +@@ -332,7 +332,6 @@ wait_for_loginit + getarg rd.break rdbreak && emergency_shell -n switch_root "Break before switch_root" + info "Switching root" + +-source_hook cleanup + + unset PS4 + diff --git a/0031-network-fix-ifup-and-netroot-calling.patch b/0031-network-fix-ifup-and-netroot-calling.patch new file mode 100644 index 0000000..1a8c83d --- /dev/null +++ b/0031-network-fix-ifup-and-netroot-calling.patch @@ -0,0 +1,270 @@ +From c6c704fda61d791303ea71f49e914b260ff90dca Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 23 Apr 2012 11:31:59 +0200 +Subject: [PATCH] network: fix ifup and netroot calling + +--- + modules.d/40network/dhclient-script.sh | 32 ++++++++-------- + modules.d/40network/ifup.sh | 65 ++++++++++++++------------------ + modules.d/40network/net-genrules.sh | 6 --- + modules.d/40network/net-lib.sh | 4 -- + modules.d/40network/netroot.sh | 27 ++----------- + 5 files changed, 48 insertions(+), 86 deletions(-) + +diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh +index 52e4900..dd893c1 100755 +--- a/modules.d/40network/dhclient-script.sh ++++ b/modules.d/40network/dhclient-script.sh +@@ -22,15 +22,15 @@ setup_interface() { + # disallow MTUs from 576 and below by default, so that broken + # MTUs are ignored, but higher stuff is allowed (1492, 1500, etc). + if [ -n "$mtu" ] && [ $mtu -gt 576 ] ; then +- echo "if ! ip link set $netif mtu $mtu ; then" +- echo "ip link set $netif down" +- echo "ip link set $netif mtu $mtu" +- echo "ip link set $netif up" +- echo wait_for_if_up $netif +- echo "fi" +- fi > /tmp/net.$netif.up ++ if ! ip link set $netif mtu $mtu ; then ++ ip link set $netif down ++ ip link set $netif mtu $mtu ++ ip link set $netif up ++ wait_for_if_up $netif ++ fi ++ fi + +- echo ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif >> /tmp/net.$netif.up ++ ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif + + [ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw + +@@ -75,14 +75,16 @@ case $reason in + [ "${line#new_}" = "$line" ] && continue + echo "$line" + done >/tmp/dhclient.$netif.dhcpopts +- echo online > /sys/class/net/$netif/uevent + +- if [ -e /tmp/net.$netif.manualup ]; then +- /sbin/netroot $netif -m +- rm -f /tmp/net.$netif.manualup +- else +- initqueue --onetime --name netroot-$netif netroot $netif +- fi ++ { ++ echo '. /lib/net-lib.sh' ++ echo "setup_net $netif" ++ echo "source_hook initqueue/online $netif" ++ [ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif" ++ echo "rm -f $hookdir/initqueue/setup_net_$netif.sh" ++ } > $hookdir/initqueue/setup_net_$netif.sh ++ ++ >/tmp/net.$netif.up + ;; + *) echo "dhcp: $reason";; + esac +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index 2111b41..71b869d 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -40,10 +40,6 @@ if [ -e /tmp/bridge.info ]; then + fi + fi + +-# bail immediately if the interface is already up +-# or we don't need the network +-[ -f "/tmp/net.$netif.up" ] && exit 0 +- + # disable manual ifup while netroot is set for simplifying our logic + # in netroot case we prefer netroot to bringup $netif automaticlly + [ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2" +@@ -72,13 +68,11 @@ load_ipv6() { + + do_ipv6auto() { + load_ipv6 +- { +- echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding +- echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra +- echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects +- echo ip link set $netif up +- echo wait_for_if_up $netif +- } > /tmp/net.$netif.up ++ echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding ++ echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra ++ echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects ++ ip link set $netif up ++ wait_for_if_up $netif + + [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname + +@@ -88,30 +82,20 @@ do_ipv6auto() { + echo nameserver $s + done + fi >> /tmp/net.$netif.resolv.conf +- +- +- echo online > /sys/class/net/$netif/uevent +- if [ -n "$manualup" ]; then +- /sbin/netroot $netif -m +- else +- initqueue --onetime --name netroot-$netif netroot $netif +- fi + } + + # Handle static ip configuration + do_static() { + strstr $ip '*:*:*' && load_ipv6 + +- { +- echo ip link set $netif up +- echo wait_for_if_up $netif +- [ -n "$macaddr" ] && echo ip link set address $macaddr +- [ -n "$mtu" ] && echo ip link set mtu $mtu +- # do not flush addr for ipv6 +- strstr $ip '*:*:*' || \ +- echo ip addr flush dev $netif +- echo ip addr add $ip/$mask brd + dev $netif +- } > /tmp/net.$netif.up ++ ip link set $netif up ++ wait_for_if_up $netif ++ [ -n "$macaddr" ] && ip link set address $macaddr ++ [ -n "$mtu" ] && ip link set mtu $mtu ++ # do not flush addr for ipv6 ++ strstr $ip '*:*:*' || \ ++ ip addr flush dev $netif ++ ip addr add $ip/$mask brd + dev $netif + + [ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw + [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname +@@ -122,20 +106,12 @@ do_static() { + echo nameserver $s + done + fi >> /tmp/net.$netif.resolv.conf +- +- echo online > /sys/class/net/$netif/uevent +- if [ -n "$manualup" ]; then +- /sbin/netroot $netif -m +- else +- initqueue --onetime --name netroot-$netif netroot $netif +- fi + } + + # loopback is always handled the same way + if [ "$netif" = "lo" ] ; then + ip link set lo up + ip addr add 127.0.0.1/8 dev lo +- >/tmp/net.$netif.up + exit 0 + fi + +@@ -238,6 +214,21 @@ for p in $(getargs ip=); do + *) + do_static ;; + esac ++ ++ case $autoconf in ++ dhcp|on|any|dhcp6) ++ ;; ++ *) ++ if [ $? -eq 0 ]; then ++ setup_net $netif ++ source_hook initqueue/online $netif ++ if [ -z "$manualup" ]; then ++ /sbin/netroot $netif ++ fi ++ fi ++ ;; ++ esac ++ + break + done + exit 0 +diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh +index b3d5584..7176681 100755 +--- a/modules.d/40network/net-genrules.sh ++++ b/modules.d/40network/net-genrules.sh +@@ -51,10 +51,4 @@ fix_bootif() { + printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" + fi + +- # Run the "online" hook +- printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' +- # And make sure we run setup_net at the start of the hook +- echo '. /lib/net-lib.sh; setup_net $netif' > \ +- $hookdir/initqueue/online/05-setup_net.sh +- + } > /etc/udev/rules.d/60-net.rules +diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh +index c0f73da..d6adda9 100644 +--- a/modules.d/40network/net-lib.sh ++++ b/modules.d/40network/net-lib.sh +@@ -65,13 +65,9 @@ ifdown() { + + setup_net() { + local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES="" +- [ -e /tmp/net.$netif.up ] || return 1 + [ -e /tmp/net.$netif.did-setup ] && return + [ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces + [ -z "$IFACES" ] && IFACES="$netif" +- for iface in $IFACES ; do +- . /tmp/net.$iface.up +- done + # run the scripts written by ifup + [ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw + [ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname +diff --git a/modules.d/40network/netroot.sh b/modules.d/40network/netroot.sh +index 1bb62bb..fa7e632 100755 +--- a/modules.d/40network/netroot.sh ++++ b/modules.d/40network/netroot.sh +@@ -13,24 +13,13 @@ command -v setup_net >/dev/null || . /lib/net-lib.sh + # instead of real netroot; If It's called without $2, then there's + # no sense in doing something if no (net)root info is available + # or root is already there +-if [ -z "$2" ]; then +- [ -d $NEWROOT/proc ] && exit 0 +- [ -z "$netroot" ] && exit 1 +-fi +- +-# Let's see if we have to wait for other interfaces +-# Note: exit works just fine, since the last interface to be +-# online'd should see all files +-all_ifaces_up || exit 1 ++[ -d $NEWROOT/proc ] && exit 0 ++[ -z "$netroot" ] && exit 1 + + # Set or override primary interface + netif=$1 + [ -e "/tmp/net.bootdev" ] && read netif < /tmp/net.bootdev + +-if [ -e /tmp/net.$netif.manualup ]; then +- rm -f /tmp/net.$netif.manualup +-fi +- + # Figure out the handler for root=dhcp by recalling all netroot cmdline + # handlers when this is not called from manually network bringing up. + if [ -z "$2" ]; then +@@ -72,23 +61,13 @@ if [ -z "$2" ]; then + fi + fi + +-# We're here, so we can assume that upping interfaces is now ok +-setup_net $netif +- +-# exit in case manually bring up network +-[ -n "$2" ] && exit 0 +- + # Source netroot hooks before we start the handler +-source_hook netroot ++source_hook netroot $netif + + # Run the handler; don't store the root, it may change from device to device + # XXX other variables to export? + if $handler $netif $netroot $NEWROOT; then + # Network rootfs mount successful - save interface info for ifcfg etc. + save_netinfo $netif +-else +- warn "Mounting root via '$netif' failed" +- # If we're trying with multiple interfaces, put that one down. +- [ -z "$BOOTDEV" ] && ifdown $netif + fi + exit 0 diff --git a/0032-ifcfg-write-DNS1-.-for-nameserver-args-RHBZ-815369.patch b/0032-ifcfg-write-DNS1-.-for-nameserver-args-RHBZ-815369.patch new file mode 100644 index 0000000..570eb60 --- /dev/null +++ b/0032-ifcfg-write-DNS1-.-for-nameserver-args-RHBZ-815369.patch @@ -0,0 +1,31 @@ +From eb6e141adb9ee06de1f0a960602526f0aa314817 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 24 Apr 2012 13:08:57 +0200 +Subject: [PATCH] ifcfg: write DNS1=... for nameserver= args (RHBZ#815369) + +If you're using a static network config, you'll want to keep your +nameservers around when NM starts. Write DNS1 (and DNS2, DNS3, etc..) +into the ifcfg file. + +Thanks to Mark Hamzy +and Will Woods for the patch. +--- + modules.d/45ifcfg/write-ifcfg.sh | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh +index c072a13..b81ac39 100755 +--- a/modules.d/45ifcfg/write-ifcfg.sh ++++ b/modules.d/45ifcfg/write-ifcfg.sh +@@ -138,6 +138,11 @@ for netif in $IFACES ; do + } >> /tmp/ifcfg/ifcfg-$ethname + fi + fi ++ i=1 ++ for ns in $(getargs nameserver); do ++ echo "DNS${i}=${ns}" >> /tmp/ifcfg/ifcfg-$netif ++ i=$((i+1)) ++ done + done + + # Pass network opts diff --git a/dracut.spec b/dracut.spec index cc3bad8..fe9094d 100644 --- a/dracut.spec +++ b/dracut.spec @@ -10,7 +10,7 @@ Name: dracut Version: 018 -Release: 25.git20120419%{?dist} +Release: 33.git20120424%{?dist} Summary: Initramfs generator using udev %if 0%{?fedora} || 0%{?rhel} @@ -48,6 +48,14 @@ 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 +Patch25: 0025-url-lib-don-t-add-existing-handlers-multiple-times.patch +Patch26: 0026-url-lib-don-t-use-progress-bar-if-TERM-dumb-RHBZ-814.patch +Patch27: 0027-base-add-debug_on-and-debug_off-functions.patch +Patch28: 0028-base-add-export_n-function.patch +Patch29: 0029-base-dracut-lib.sh-add-arguments-for-source_hook-and.patch +Patch30: 0030-merge-cleanup-and-pre-pivot-cleanup-hooks.patch +Patch31: 0031-network-fix-ifup-and-netroot-calling.patch +Patch32: 0032-ifcfg-write-DNS1-.-for-nameserver-args-RHBZ-815369.patch BuildArch: noarch @@ -364,6 +372,9 @@ rm -rf $RPM_BUILD_ROOT %dir /var/lib/dracut/overlay %changelog +* Tue Apr 24 2012 Harald Hoyer 018-33.git20120424 +- new upstream version + * Thu Apr 19 2012 Harald Hoyer 018-25.git20120419 - fixed network for non-network root (like installer media)