From 52ce144d06cd2bef813a20f2cd81d58dcdb48b32 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mar 11 2013 18:26:29 +0000 Subject: dracut-026-15.git20130311 - update to recent git --- diff --git a/0001-systemd-module-setup.sh-call-systemd-in-private-dir-.patch b/0001-systemd-module-setup.sh-call-systemd-in-private-dir-.patch new file mode 100644 index 0000000..bc61cbd --- /dev/null +++ b/0001-systemd-module-setup.sh-call-systemd-in-private-dir-.patch @@ -0,0 +1,23 @@ +From 900e15da342db2675d7ccd3ca17907bc6ec8cfc5 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 8 Mar 2013 11:50:03 +0100 +Subject: [PATCH] systemd/module-setup.sh: call systemd in private dir for + version + +--- + modules.d/98systemd/module-setup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh +index 3ce1705..32d4be5 100755 +--- a/modules.d/98systemd/module-setup.sh ++++ b/modules.d/98systemd/module-setup.sh +@@ -17,7 +17,7 @@ depends() { + + install() { + +- SYSTEMD_VERSION=$(systemd --version | { read a b a; echo $b; }) ++ SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; }) + if (( $SYSTEMD_VERSION < 198 )); then + dfatal "systemd version $SYSTEMD_VERSION is too low. Need at least version 198." + exit 1 diff --git a/0002-add-lib-kernel-install.d-51-dracut-rescue.install.patch b/0002-add-lib-kernel-install.d-51-dracut-rescue.install.patch new file mode 100644 index 0000000..424d889 --- /dev/null +++ b/0002-add-lib-kernel-install.d-51-dracut-rescue.install.patch @@ -0,0 +1,118 @@ +From d837ac398492cc2f6683cb8e2cbb80475ba232d5 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Sat, 9 Mar 2013 15:09:55 +0100 +Subject: [PATCH] add /lib/kernel/install.d/51-dracut-rescue.install + +Upon installation of a kernel, check if a rescue image is already +available and if not, create a non-hostonly generic initramfs image with +the rescue module added. +--- + 51-dracut-rescue.install | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ + Makefile | 1 + + dracut.spec | 1 + + 3 files changed, 75 insertions(+) + create mode 100755 51-dracut-rescue.install + +diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install +new file mode 100755 +index 0000000..844e578 +--- /dev/null ++++ b/51-dracut-rescue.install +@@ -0,0 +1,73 @@ ++#!/bin/sh ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++ ++export LANG=C ++ ++COMMAND="$1" ++KERNEL_VERSION="$2" ++BOOT_DIR_ABS="$3" ++BOOT_DIR="${3#/boot}" ++ ++[[ -f /etc/os-release ]] && . /etc/os-release ++[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id ++if [[ -f /etc/kernel/cmdline ]]; then ++ readarray -t BOOT_OPTIONS < /etc/kernel/cmdline ++fi ++if ! [[ "${BOOT_OPTIONS[@]}" ]]; then ++ readarray -t BOOT_OPTIONS < /proc/cmdline ++fi ++if ! [[ $BOOT_OPTIONS ]]; then ++ exit 1 ++fi ++ ++LOADER_ENTRY="/boot/loader/entries/${MACHINE_ID}-00-${KERNEL_VERSION}-rescue.conf" ++ ++ret=0 ++ ++case "$COMMAND" in ++ add) ++ for i in "/boot/loader/entries/${MACHINE_ID}-00-"*"-rescue.conf"; do ++ [[ -f $i ]] && exit 0 ++ done ++ ++ dracut --no-hostonly -a "rescue" "$3"/initrd-rescue "$2" ++ ((ret+=$?)) ++ ++ { ++ echo "title $PRETTY_NAME - Rescue Image" ++ echo "version $KERNEL_VERSION" ++ echo "machine-id $MACHINE_ID" ++ echo "options ${BOOT_OPTIONS[@]} rd.auto=1" ++ echo "linux $BOOT_DIR/linux" ++ echo "initrd $BOOT_DIR/initrd-rescue" ++ } > $LOADER_ENTRY ++ ((ret+=$?)) ++ ++ if (( $ret == 0 )); then ++ command -v yumdb &>/dev/null && \ ++ yumdb set installonly keep kernel-$KERNEL_VERSION >/dev/null ++ fi ++ ++ ;; ++ ++ remove) ++ [[ -f $LOADER_ENTRY ]] || exit 0 ++ ++ rm -f "$LOADER_ENTRY" "$3"/initrd-rescue ++ ++ if command -v yumdb &>/dev/null; then ++ if [[ $(yumdb get installonly kernel-$KERNEL_VERSION 2>/dev/null) == *installonly\ \=\ keep* ]]; then ++ yumdb del installonly kernel-$KERNEL_VERSION >/dev/null ++ fi ++ fi ++ ;; ++ ++ *) ++ usage ++ ret=1;; ++esac ++ ++((ret+=$?)) ++ ++exit $ret +diff --git a/Makefile b/Makefile +index 7546ac6..a11689c 100644 +--- a/Makefile ++++ b/Makefile +@@ -118,6 +118,7 @@ endif + fi + mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d + install -m 0755 50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install ++ install -m 0755 51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install + + dracut-version.sh: + @echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh +diff --git a/dracut.spec b/dracut.spec +index 707e66a..6d30e57 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -338,6 +338,7 @@ rm -rf $RPM_BUILD_ROOT + %endif + %if 0%{?fedora} || 0%{?rhel} > 6 + %{_prefix}/lib/kernel/install.d/50-dracut.install ++%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install + %endif + + %files network diff --git a/0003-fedora.conf.example-make-hostonly-default-for-fedora.patch b/0003-fedora.conf.example-make-hostonly-default-for-fedora.patch new file mode 100644 index 0000000..caa7ad7 --- /dev/null +++ b/0003-fedora.conf.example-make-hostonly-default-for-fedora.patch @@ -0,0 +1,51 @@ +From bcd352dfa105544a7531d999301c84bf88e850ed Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Sat, 9 Mar 2013 15:10:23 +0100 +Subject: [PATCH] fedora.conf.example: make hostonly default for fedora + +--- + dracut.conf.d/fedora.conf.example | 1 + + dracut.spec | 7 +++---- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/dracut.conf.d/fedora.conf.example b/dracut.conf.d/fedora.conf.example +index 6266921..8448fc3 100644 +--- a/dracut.conf.d/fedora.conf.example ++++ b/dracut.conf.d/fedora.conf.example +@@ -12,3 +12,4 @@ systemdutildir=/usr/lib/systemd + systemdsystemunitdir=/usr/lib/systemd/system + udevdir=/usr/lib/udev + add_dracutmodules+=" systemd " ++hostonly="yes" +diff --git a/dracut.spec b/dracut.spec +index 6d30e57..6906d68 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -132,7 +132,7 @@ Requires: nss-softokn-freebl + + %description fips + This package requires everything which is needed to build an +-all purpose initramfs with dracut, which does an integrity check. ++initramfs with dracut, which does an integrity check. + %endif + + %package fips-aesni +@@ -141,8 +141,7 @@ Requires: %{name}-fips = %{version}-%{release} + + %description fips-aesni + This package requires everything which is needed to build an +-all purpose initramfs with dracut, which does an integrity check +-and adds the aesni-intel kernel module. ++initramfs with dracut, which does an integrity check and adds the aesni-intel kernel module. + + %package caps + Summary: dracut modules to build a dracut initramfs which drops capabilities +@@ -151,7 +150,7 @@ Requires: libcap + + %description caps + This package requires everything which is needed to build an +-all purpose initramfs with dracut, which drops capabilities. ++initramfs with dracut, which drops capabilities. + + %package tools + Summary: dracut tools to build the local initramfs diff --git a/0004-dracut.sh-remove-default-marker-in-help.patch b/0004-dracut.sh-remove-default-marker-in-help.patch new file mode 100644 index 0000000..727f14f --- /dev/null +++ b/0004-dracut.sh-remove-default-marker-in-help.patch @@ -0,0 +1,57 @@ +From 54e7d7c32daf14f7174dd852c64924cb4f2daa69 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Sat, 9 Mar 2013 15:11:12 +0100 +Subject: [PATCH] dracut.sh: remove (default) marker in --help + +--- + dracut.sh | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/dracut.sh b/dracut.sh +index 28ed4f1..7243078 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -69,11 +69,11 @@ Creates initial ramdisk images for preloading modules + + --kver [VERSION] Set kernel version to [VERSION]. + -f, --force Overwrite existing initramfs file. ++ -a, --add [LIST] Add a space-separated list of dracut modules. + -m, --modules [LIST] Specify a space-separated list of dracut modules to + call when building the initramfs. Modules are located + in /usr/lib/dracut/modules.d. + -o, --omit [LIST] Omit a space-separated list of dracut modules. +- -a, --add [LIST] Add a space-separated list of dracut modules. + -d, --drivers [LIST] Specify a space-separated list of kernel modules to + exclusively include in the initramfs. + --add-drivers [LIST] Specify a space-separated list of kernel +@@ -90,12 +90,12 @@ Creates initial ramdisk images for preloading modules + --kernel-only Only install kernel drivers and firmware files + --no-kernel Do not install kernel drivers and firmware files + --kernel-cmdline [PARAMETERS] Specify default kernel command line parameters +- --strip Strip binaries in the initramfs (default) ++ --strip Strip binaries in the initramfs + --nostrip Do not strip binaries in the initramfs +- --hardlink Hardlink files in the initramfs (default) ++ --hardlink Hardlink files in the initramfs + --nohardlink Do not hardlink files in the initramfs + --prefix [DIR] Prefix initramfs files with [DIR] +- --noprefix Do not prefix initramfs files (default) ++ --noprefix Do not prefix initramfs files + --mdadmconf Include local /etc/mdadm.conf + --nomdadmconf Do not include local /etc/mdadm.conf + --lvmconf Include local /etc/lvm/lvm.conf +@@ -111,11 +111,11 @@ Creates initial ramdisk images for preloading modules + 1 - only fatal errors + 2 - all errors + 3 - warnings +- 4 - info (default) ++ 4 - info + 5 - debug info (here starts lots of output) + 6 - trace info (and even more) +- -v, --verbose Increase verbosity level (default is info(4)) +- -q, --quiet Decrease verbosity level (default is info(4)) ++ -v, --verbose Increase verbosity level ++ -q, --quiet Decrease verbosity level + -c, --conf [FILE] Specify configuration file to use. + Default: /etc/dracut.conf + --confdir [DIR] Specify configuration directory to use *.conf files diff --git a/0005-dracut.sh-add-new-default-path-to-initramfs-accordin.patch b/0005-dracut.sh-add-new-default-path-to-initramfs-accordin.patch new file mode 100644 index 0000000..0cd7394 --- /dev/null +++ b/0005-dracut.sh-add-new-default-path-to-initramfs-accordin.patch @@ -0,0 +1,40 @@ +From cc2303001e713f2f7c3f70161c28aa95f4d339d1 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Sat, 9 Mar 2013 15:11:39 +0100 +Subject: [PATCH] dracut.sh: add new default path to initramfs according to + bootloader spec + +see kernel-install(8) and +http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec +--- + dracut.sh | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/dracut.sh b/dracut.sh +index 7243078..8f3e5d2 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -442,7 +442,13 @@ if ! [[ $kernel ]]; then + fi + + if ! [[ $outfile ]]; then +- outfile="/boot/initramfs-$kernel.img" ++ [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id ++ ++ if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then ++ outfile="/boot/${MACHINE_ID}/$kernel/initrd" ++ else ++ outfile="/boot/initramfs-$kernel.img" ++ fi + fi + + for i in /usr/sbin /sbin /usr/bin /bin; do +@@ -726,7 +732,7 @@ outdir=${outfile%/*} + [[ $outdir ]] || outdir="/" + + if [[ ! -d "$outdir" ]]; then +- dfatal "Can't write $outfile: Directory $outdir does not exist." ++ dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible." + exit 1 + elif [[ ! -w "$outdir" ]]; then + dfatal "No permission to write to $outdir." diff --git a/0006-add-rescue-dracut-module.patch b/0006-add-rescue-dracut-module.patch new file mode 100644 index 0000000..711d834 --- /dev/null +++ b/0006-add-rescue-dracut-module.patch @@ -0,0 +1,35 @@ +From aede120c92e08712e5ab93b283b12ab5f3df510d Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Sat, 9 Mar 2013 15:15:41 +0100 +Subject: [PATCH] add rescue dracut module + +--- + modules.d/03rescue/module-setup.sh | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + create mode 100755 modules.d/03rescue/module-setup.sh + +diff --git a/modules.d/03rescue/module-setup.sh b/modules.d/03rescue/module-setup.sh +new file mode 100755 +index 0000000..3f10b7c +--- /dev/null ++++ b/modules.d/03rescue/module-setup.sh +@@ -0,0 +1,19 @@ ++#!/bin/bash ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++ ++check() { ++ # do not add this module by default ++ return 255 ++} ++ ++depends() { ++ return 0 ++} ++ ++install() { ++ dracut_install -o ps grep more cat rm strace free showmount \ ++ ping netstat rpcinfo vi scp ping6 ssh \ ++ fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck ++} ++ diff --git a/0007-dracut.sh-move-cleanup-trap-just-after-mktemp.patch b/0007-dracut.sh-move-cleanup-trap-just-after-mktemp.patch new file mode 100644 index 0000000..2cf98cf --- /dev/null +++ b/0007-dracut.sh-move-cleanup-trap-just-after-mktemp.patch @@ -0,0 +1,37 @@ +From d008b6b89f69772a119da779c9e934e9bdd426ec Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Sat, 9 Mar 2013 15:30:44 +0100 +Subject: [PATCH] dracut.sh: move cleanup trap, just after mktemp + +--- + dracut.sh | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/dracut.sh b/dracut.sh +index 8f3e5d2..860cfb5 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -623,6 +623,11 @@ readonly initdir=$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX) + exit 1 + } + ++# clean up after ourselves no matter how we die. ++trap 'ret=$?;[[ $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 ++ + export DRACUT_KERNEL_LAZY="1" + export DRACUT_RESOLVE_LAZY="1" + +@@ -742,11 +747,6 @@ elif [[ -f "$outfile" && ! -w "$outfile" ]]; then + exit 1 + fi + +-# clean up after ourselves no matter how we die. +-trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || rm -rf "$initdir";exit $ret;' EXIT +-# clean up after ourselves no matter how we die. +-trap 'exit 1;' SIGINT +- + # Need to be able to have non-root users read stuff (rpcbind etc) + chmod 755 "$initdir" + diff --git a/0008-dracut.spec-add-rescue-module.patch b/0008-dracut.spec-add-rescue-module.patch new file mode 100644 index 0000000..5d22ba6 --- /dev/null +++ b/0008-dracut.spec-add-rescue-module.patch @@ -0,0 +1,21 @@ +From fba5fbbdad0f59ce06fde71441832952cdefe546 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Sat, 9 Mar 2013 15:32:32 +0100 +Subject: [PATCH] dracut.spec: add rescue module + +--- + dracut.spec | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/dracut.spec b/dracut.spec +index 6906d68..14ce0d0 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -282,6 +282,7 @@ rm -rf $RPM_BUILD_ROOT + %else + %{dracutlibdir}/modules.d/00bootchart + %endif ++%{dracutlibdir}/modules.d/03rescue + %{dracutlibdir}/modules.d/04watchdog + %{dracutlibdir}/modules.d/05busybox + %{dracutlibdir}/modules.d/10i18n diff --git a/0009-51-dracut-rescue.install-do-not-unset-installonly-on.patch b/0009-51-dracut-rescue.install-do-not-unset-installonly-on.patch new file mode 100644 index 0000000..c6e7b00 --- /dev/null +++ b/0009-51-dracut-rescue.install-do-not-unset-installonly-on.patch @@ -0,0 +1,26 @@ +From 8d28614e4f6d270e57371cde4ea9f1fe776cdb35 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Sun, 10 Mar 2013 14:44:16 +0100 +Subject: [PATCH] 51-dracut-rescue.install: do not unset installonly on remove + +--- + 51-dracut-rescue.install | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install +index 844e578..e5781d3 100755 +--- a/51-dracut-rescue.install ++++ b/51-dracut-rescue.install +@@ -55,12 +55,6 @@ case "$COMMAND" in + [[ -f $LOADER_ENTRY ]] || exit 0 + + rm -f "$LOADER_ENTRY" "$3"/initrd-rescue +- +- if command -v yumdb &>/dev/null; then +- if [[ $(yumdb get installonly kernel-$KERNEL_VERSION 2>/dev/null) == *installonly\ \=\ keep* ]]; then +- yumdb del installonly kernel-$KERNEL_VERSION >/dev/null +- fi +- fi + ;; + + *) diff --git a/0010-lsinitrd.sh-fix-for-default-initrd-not-found-but-ima.patch b/0010-lsinitrd.sh-fix-for-default-initrd-not-found-but-ima.patch new file mode 100644 index 0000000..03d7485 --- /dev/null +++ b/0010-lsinitrd.sh-fix-for-default-initrd-not-found-but-ima.patch @@ -0,0 +1,39 @@ +From 727e68d0b5cb93eb6c6e00f0541b8519657a2597 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Sun, 10 Mar 2013 14:44:32 +0100 +Subject: [PATCH] lsinitrd.sh: fix for default initrd not found, but image + given + +--- + lsinitrd.sh | 15 ++++++++------- + 1 file changed, 8 insertions(+), 7 deletions(-) + +diff --git a/lsinitrd.sh b/lsinitrd.sh +index 7a09423..4b8a7e2 100755 +--- a/lsinitrd.sh ++++ b/lsinitrd.sh +@@ -54,16 +54,17 @@ if [[ "$1" ]]; then + usage + exit 1 + fi +-fi +- +-[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id +- +-if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then +- image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd" + else +- image="/boot/initramfs-${KERNEL_VERSION}.img}" ++ [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id ++ ++ if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then ++ image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd" ++ else ++ image="/boot/initramfs-${KERNEL_VERSION}.img}" ++ fi + fi + ++ + if ! [[ -f "$image" ]]; then + { + echo "No specified and the default image '$image' cannot be accessed!" diff --git a/0011-lsinitrd.sh-removed-trailing.patch b/0011-lsinitrd.sh-removed-trailing.patch new file mode 100644 index 0000000..b36e399 --- /dev/null +++ b/0011-lsinitrd.sh-removed-trailing.patch @@ -0,0 +1,22 @@ +From d928724c3cf464a495c11162042951887b80f5e6 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 11 Mar 2013 15:46:37 +0100 +Subject: [PATCH] lsinitrd.sh: removed trailing "}" + +--- + lsinitrd.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lsinitrd.sh b/lsinitrd.sh +index 4b8a7e2..5cd8c2a 100755 +--- a/lsinitrd.sh ++++ b/lsinitrd.sh +@@ -60,7 +60,7 @@ else + if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then + image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd" + else +- image="/boot/initramfs-${KERNEL_VERSION}.img}" ++ image="/boot/initramfs-${KERNEL_VERSION}.img" + fi + fi + diff --git a/0012-make-host_fs_types-a-hashmap.patch b/0012-make-host_fs_types-a-hashmap.patch new file mode 100644 index 0000000..955a930 --- /dev/null +++ b/0012-make-host_fs_types-a-hashmap.patch @@ -0,0 +1,406 @@ +From d351541ee625f8a1b42446448214f200f19c2631 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 11 Mar 2013 16:32:16 +0100 +Subject: [PATCH] make host_fs_types a hashmap + +This requires bash >= 4, but hash maps are so much more comfortable +--- + dracut-functions.sh | 14 +++--------- + dracut.sh | 23 +++++++++---------- + modules.d/90btrfs/module-setup.sh | 6 ++--- + modules.d/90crypt/module-setup.sh | 39 +++++++++++++++++++-------------- + modules.d/90dmraid/module-setup.sh | 34 ++++++++++++++++------------ + modules.d/90lvm/module-setup.sh | 36 +++++++++++++++++------------- + modules.d/90mdraid/module-setup.sh | 45 +++++++++++++++++++++----------------- + modules.d/95cifs/module-setup.sh | 2 +- + modules.d/95nfs/module-setup.sh | 6 ++--- + modules.d/95virtfs/module-setup.sh | 4 ++-- + 10 files changed, 112 insertions(+), 97 deletions(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index 2a84d17..c6a5c7e 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -450,23 +450,15 @@ find_mp_fstype() { + find_root_block_device() { find_block_device /; } + + # for_each_host_dev_fs +-# Execute " " for every "|" pair found ++# Execute " " for every " " pair found + # in ${host_fs_types[@]} + for_each_host_dev_fs() + { + local _func="$1" + local _dev +- local _fs + local _ret=1 +- for f in ${host_fs_types[@]}; do +- OLDIFS="$IFS" +- IFS="|" +- set -- $f +- IFS="$OLDIFS" +- _dev="$1" +- [[ -b "$_dev" ]] || continue +- _fs="$2" +- $_func $_dev $_fs && _ret=0 ++ for _dev in "${!host_fs_types[@]}"; do ++ $_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0 + done + return $_ret + } +diff --git a/dracut.sh b/dracut.sh +index 860cfb5..8306733 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -750,11 +750,13 @@ fi + # Need to be able to have non-root users read stuff (rpcbind etc) + chmod 755 "$initdir" + ++declare -A host_fs_types ++ + for line in "${fstab_lines[@]}"; do + set -- $line + #dev mp fs fsopts + push host_devs "$1" +- push host_fs_types "$1|$3" ++ host_fs_types["$1"]="$3" + done + + for f in $add_fstab; do +@@ -797,28 +799,27 @@ fi + _get_fs_type() ( + [[ $1 ]] || return + if [[ -b $1 ]] && get_fs_env $1; then +- echo "$(readlink -f $1)|$ID_FS_TYPE" ++ echo "$(readlink -f $1) $ID_FS_TYPE" + return 1 + fi + if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then +- echo "$(readlink -f /dev/block/$1)|$ID_FS_TYPE" ++ echo "$(readlink -f /dev/block/$1) $ID_FS_TYPE" + return 1 + fi + if fstype=$(find_dev_fstype $1); then +- echo "$1|$fstype" ++ echo "$1 $fstype" + return 1 + fi + return 1 + ) + + for dev in "${host_devs[@]}"; do +- unset fs_type +- for fstype in $(_get_fs_type $dev) \ +- $(check_block_and_slaves _get_fs_type $(get_maj_min $dev)); do +- if ! strstr " ${host_fs_types[*]} " " $fstype ";then +- push host_fs_types "$fstype" +- fi +- done ++ while read key val; do ++ host_fs_types["$key"]="$val" ++ done < <( ++ _get_fs_type $dev ++ check_block_and_slaves_all _get_fs_type $(get_maj_min $dev) ++ ) + done + + [[ -d $udevdir ]] \ +diff --git a/modules.d/90btrfs/module-setup.sh b/modules.d/90btrfs/module-setup.sh +index 0f79f5e..4a7c01d 100755 +--- a/modules.d/90btrfs/module-setup.sh ++++ b/modules.d/90btrfs/module-setup.sh +@@ -9,12 +9,10 @@ check() { + type -P btrfs >/dev/null || return 1 + + [[ $hostonly ]] || [[ $mount_needs ]] && { +- local _found + for fs in ${host_fs_types[@]}; do +- strstr "$fs" "\|btrfs" && _found="1" ++ [[ "$fs" == "btrfs" ]] && return 0 + done +- [[ $_found ]] || return 1 +- unset _found ++ return 255 + } + + return 0 +diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh +index 2b4456b..b76f6ae 100755 +--- a/modules.d/90crypt/module-setup.sh ++++ b/modules.d/90crypt/module-setup.sh +@@ -7,8 +7,30 @@ check() { + # if cryptsetup is not installed, then we cannot support encrypted devices. + type -P cryptsetup >/dev/null || return 1 + ++ [[ $hostonly ]] || [[ $mount_needs ]] && { ++ for fs in "${host_fs_types[@]}"; do ++ [[ $fs = "crypto_LUKS" ]] && return 0 ++ done ++ return 255 ++ } ++ ++ return 0 ++} ++ ++depends() { ++ echo dm rootfs-block ++ return 0 ++} ++ ++installkernel() { ++ instmods dm_crypt =crypto ++} ++ ++install() { ++ + check_crypt() { + local dev=$1 fs=$2 ++ + [[ $fs = "crypto_LUKS" ]] || return 1 + ID_FS_UUID=$(udevadm info --query=property --name=$dev \ + | while read line; do +@@ -24,23 +46,8 @@ check() { + return 0 + } + +- [[ $hostonly ]] || [[ $mount_needs ]] && { +- for_each_host_dev_and_slaves_all check_crypt || return 1 +- } +- +- return 0 +-} +- +-depends() { +- echo dm rootfs-block +- return 0 +-} +- +-installkernel() { +- instmods dm_crypt =crypto +-} ++ for_each_host_dev_fs check_crypt + +-install() { + dracut_install cryptsetup rmdir readlink umount + inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask + inst_script "$moddir"/probe-keydev.sh /sbin/probe-keydev +diff --git a/modules.d/90dmraid/module-setup.sh b/modules.d/90dmraid/module-setup.sh +index c315961..76daa4a 100755 +--- a/modules.d/90dmraid/module-setup.sh ++++ b/modules.d/90dmraid/module-setup.sh +@@ -8,9 +8,27 @@ check() { + # in trying to support it in the initramfs. + type -P dmraid >/dev/null || return 1 + ++ [[ $hostonly ]] || [[ $mount_needs ]] && { ++ for fs in "${host_fs_types[@]}"; do ++ [[ $fs = *_raid_member ]] && return 0 ++ done ++ return 255 ++ } ++ ++ return 0 ++} ++ ++depends() { ++ echo dm rootfs-block ++ return 0 ++} ++ ++install() { ++ local _i ++ + check_dmraid() { + local dev=$1 fs=$2 holder DEVPATH DM_NAME +- [[ "$fs" = "${fs%%_raid_member}" ]] && return 1 ++ [[ "$fs" != *_raid_member ]] && return 1 + + DEVPATH=$(udevadm info --query=property --name=$dev \ + | while read line; do +@@ -37,20 +55,8 @@ check() { + return 0 + } + +- [[ $hostonly ]] || [[ $mount_needs ]] && { +- for_each_host_dev_and_slaves_all check_dmraid || return 1 +- } ++ for_each_host_dev_fs check_dmraid + +- return 0 +-} +- +-depends() { +- echo dm rootfs-block +- return 0 +-} +- +-install() { +- local _i + dracut_install dmraid + dracut_install -o kpartx + inst $(command -v partx) /sbin/partx +diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh +index e0e4043..22186f4 100755 +--- a/modules.d/90lvm/module-setup.sh ++++ b/modules.d/90lvm/module-setup.sh +@@ -7,22 +7,11 @@ check() { + # No point trying to support lvm if the binaries are missing + type -P lvm >/dev/null || return 1 + +- check_lvm() { +- local DM_VG_NAME DM_LV_NAME DM_UDEV_DISABLE_DISK_RULES_FLAG +- eval $(udevadm info --query=property --name=/dev/block/$1|egrep '(DM_VG_NAME|DM_LV_NAME|DM_UDEV_DISABLE_DISK_RULES_FLAG)=') +- [[ "$DM_UDEV_DISABLE_DISK_RULES_FLAG" = "1" ]] && return 1 +- [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1 +- if ! strstr " ${_activated[*]} " " ${DM_VG_NAME}/${DM_LV_NAME} "; then +- if ! [[ $kernel_only ]]; then +- echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf" +- fi +- push _activated "${DM_VG_NAME}/${DM_LV_NAME}" +- fi +- return 0 +- } +- + [[ $hostonly ]] || [[ $mount_needs ]] && { +- for_each_host_dev_and_slaves_all check_lvm || return 1 ++ for fs in "${host_fs_types[@]}"; do ++ [[ $fs = LVM*_member ]] && return 0 ++ done ++ return 255 + } + + return 0 +@@ -38,6 +27,23 @@ install() { + local _i + inst lvm + ++ check_lvm() { ++ local DM_VG_NAME DM_LV_NAME DM_UDEV_DISABLE_DISK_RULES_FLAG ++ ++ eval $(udevadm info --query=property --name=$1 | egrep '(DM_VG_NAME|DM_LV_NAME|DM_UDEV_DISABLE_DISK_RULES_FLAG)=') ++ [[ "$DM_UDEV_DISABLE_DISK_RULES_FLAG" = "1" ]] && return 1 ++ [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1 ++ if ! strstr " ${_activated[*]} " " ${DM_VG_NAME}/${DM_LV_NAME} "; then ++ if ! [[ $kernel_only ]]; then ++ echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf" ++ fi ++ push _activated "${DM_VG_NAME}/${DM_LV_NAME}" ++ fi ++ return 0 ++ } ++ ++ for_each_host_dev_fs check_lvm ++ + inst_rules "$moddir/64-lvm.rules" + + if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then +diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh +index 0efffbb..70c27dd 100755 +--- a/modules.d/90mdraid/module-setup.sh ++++ b/modules.d/90mdraid/module-setup.sh +@@ -7,27 +7,11 @@ check() { + # No mdadm? No mdraid support. + type -P mdadm >/dev/null || return 1 + +- check_mdraid() { +- local dev=$1 fs=$2 holder DEVPATH MD_UUID +- [[ "$fs" = "${fs%%_raid_member}" ]] && return 1 +- +- MD_UUID=$(/sbin/mdadm --examine --export $dev \ +- | while read line; do +- [[ ${line#MD_UUID} = $line ]] && continue +- eval "$line" +- echo $MD_UUID +- break +- done) +- +- [[ ${MD_UUID} ]] || return 1 +- if ! [[ $kernel_only ]]; then +- echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf" +- fi +- return 0 +- } +- + [[ $hostonly ]] || [[ $mount_needs ]] && { +- for_each_host_dev_and_slaves_all check_mdraid || return 1 ++ for fs in "${host_fs_types[@]}"; do ++ [[ "$fs" == *_raid_member ]] && return 0 ++ done ++ return 255 + } + + return 0 +@@ -48,6 +32,27 @@ install() { + inst $(command -v partx) /sbin/partx + inst $(command -v mdadm) /sbin/mdadm + ++ check_mdraid() { ++ local dev=$1 fs=$2 holder DEVPATH MD_UUID ++ [[ "$fs" != *_raid_member ]] && return 1 ++ ++ MD_UUID=$(/sbin/mdadm --examine --export $dev \ ++ | while read line; do ++ [[ ${line#MD_UUID} = $line ]] && continue ++ eval "$line" ++ echo $MD_UUID ++ break ++ done) ++ ++ [[ ${MD_UUID} ]] || return 1 ++ if ! [[ $kernel_only ]]; then ++ echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf" ++ fi ++ return 0 ++ } ++ ++ for_each_host_dev_fs check_mdraid ++ + inst_rules 64-md-raid.rules + # remove incremental assembly from stock rules, so they don't shadow + # 65-md-inc*.rules and its fine-grained controls, or cause other problems +diff --git a/modules.d/95cifs/module-setup.sh b/modules.d/95cifs/module-setup.sh +index 1c7d0be..bf0eddf 100755 +--- a/modules.d/95cifs/module-setup.sh ++++ b/modules.d/95cifs/module-setup.sh +@@ -8,7 +8,7 @@ check() { + + [[ $hostonly ]] || [[ $mount_needs ]] && { + for fs in ${host_fs_types[@]}; do +- strstr "$fs" "\|cifs" && return 0 ++ [[ "$fs" == "cifs" ]] && return 0 + done + return 255 + } +diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh +index 38ee5d7..7c3a64d 100755 +--- a/modules.d/95nfs/module-setup.sh ++++ b/modules.d/95nfs/module-setup.sh +@@ -9,9 +9,9 @@ check() { + + [[ $hostonly ]] || [[ $mount_needs ]] && { + for fs in ${host_fs_types[@]}; do +- strstr "$fs" "\|nfs" && return 0 +- strstr "$fs" "\|nfs3" && return 0 +- strstr "$fs" "\|nfs4" && return 0 ++ [[ "$fs" == "nfs" ]] && return 0 ++ [[ "$fs" == "nfs3" ]] && return 0 ++ [[ "$fs" == "nfs4" ]] && return 0 + done + return 255 + } +diff --git a/modules.d/95virtfs/module-setup.sh b/modules.d/95virtfs/module-setup.sh +index 0b961a8..12bd354 100755 +--- a/modules.d/95virtfs/module-setup.sh ++++ b/modules.d/95virtfs/module-setup.sh +@@ -5,9 +5,9 @@ + check() { + [[ $hostonly ]] || [[ $mount_needs ]] && { + for fs in ${host_fs_types[@]}; do +- strstr "$fs" "\|9p" && return 0 ++ [[ "$fs" == "9p" ]] && return 0 + done +- return 1 ++ return 255 + } + + if type -P systemd-detect-virt >/dev/null 2>&1; then diff --git a/0013-dracut.sh-add-swap-partitions-to-host-only-setup.patch b/0013-dracut.sh-add-swap-partitions-to-host-only-setup.patch new file mode 100644 index 0000000..b41fec2 --- /dev/null +++ b/0013-dracut.sh-add-swap-partitions-to-host-only-setup.patch @@ -0,0 +1,37 @@ +From dd5875499ece9dbc90e10eafd0073ee15d0c86a4 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 11 Mar 2013 16:31:48 +0100 +Subject: [PATCH] dracut.sh: add swap partitions to host-only setup + +--- + dracut.sh | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/dracut.sh b/dracut.sh +index 8306733..bb49299 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -794,6 +794,23 @@ if [[ $hostonly ]]; then + mountpoint "$mp" >/dev/null 2>&1 || continue + push host_devs $(readlink -f "/dev/block/$(find_block_device "$mp")") + done ++ ++ while read dev type rest; do ++ [[ -b $dev ]] || continue ++ [[ "$type" == "partition" ]] || continue ++ while read _d _m _t _o _r; do ++ [[ "$_d" == \#* ]] && continue ++ [[ $_d ]] || continue ++ [[ $_t != "swap" ]] || [[ $_m != "swap" ]] && continue ++ [[ "$_o" == *noauto* ]] && continue ++ [[ "$_d" == UUID\=* ]] && _d="/dev/disk/by-uuid/${_d#UUID=}" ++ [[ "$_d" == LABEL\=* ]] && _d="/dev/disk/by-label/$_d#LABEL=}" ++ [[ "$_d" -ef "$dev" ]] || continue ++ push host_devs $(readlink -f $dev) ++ break ++ done < /etc/fstab ++ done < /proc/swaps ++ + fi + + _get_fs_type() ( diff --git a/0014-add-51-dracut-rescue-postinst.sh.patch b/0014-add-51-dracut-rescue-postinst.sh.patch new file mode 100644 index 0000000..0adfeb1 --- /dev/null +++ b/0014-add-51-dracut-rescue-postinst.sh.patch @@ -0,0 +1,247 @@ +From 2fa6fd3aaa3015ad80b2b16f68c9b6de6724f202 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 11 Mar 2013 15:59:13 +0100 +Subject: [PATCH] add 51-dracut-rescue-postinst.sh + +also fixup 51-dracut-rescue.install to read in dracut conf +--- + 51-dracut-rescue-postinst.sh | 58 +++++++++++++++++++++++++++++++++++++++ + 51-dracut-rescue.install | 58 ++++++++++++++++++++++++++++----------- + dracut.conf.d/fedora.conf.example | 1 + + dracut.spec | 18 ++++++++---- + 4 files changed, 114 insertions(+), 21 deletions(-) + create mode 100755 51-dracut-rescue-postinst.sh + +diff --git a/51-dracut-rescue-postinst.sh b/51-dracut-rescue-postinst.sh +new file mode 100755 +index 0000000..5c0fe2c +--- /dev/null ++++ b/51-dracut-rescue-postinst.sh +@@ -0,0 +1,58 @@ ++#!/bin/bash ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++ ++export LANG=C ++ ++KERNEL_VERSION="$1" ++KERNEL_IMAGE="$2" ++ ++[[ -f /etc/os-release ]] && . /etc/os-release ++[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id ++ ++INITRDFILE="/boot/initramfs-${MACHINE_ID}-rescue.img" ++[[ -f $INITRDFILE ]] && exit 0 ++ ++dropindirs_sort() ++{ ++ suffix=$1; shift ++ args=("$@") ++ files=$( ++ while (( $# > 0 )); do ++ for i in ${1}/*${suffix}; do ++ [[ -f $i ]] && echo ${i##*/} ++ done ++ shift ++ done | sort -Vu ++ ) ++ ++ for f in $files; do ++ for d in "${args[@]}"; do ++ if [[ -f "$d/$f" ]]; then ++ echo "$d/$f" ++ continue 2 ++ fi ++ done ++ done ++} ++ ++# source our config dir ++for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do ++ [[ -e $f ]] && . "$f" ++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+=$?)) ++ ++KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-${MACHINE_ID}-rescue" ++ ++new-kernel-image --install "$KERNEL_VERSION" --kernel-image "$KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$PRETTY_NAME Rescue" ++ ++((ret+=$?)) ++ ++exit $ret +diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install +index e5781d3..94f064c 100755 +--- a/51-dracut-rescue.install ++++ b/51-dracut-rescue.install +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!/bin/bash + # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- + # ex: ts=8 sw=4 sts=4 et filetype=sh + +@@ -6,8 +6,29 @@ export LANG=C + + COMMAND="$1" + KERNEL_VERSION="$2" +-BOOT_DIR_ABS="$3" +-BOOT_DIR="${3#/boot}" ++ ++dropindirs_sort() ++{ ++ suffix=$1; shift ++ args=("$@") ++ files=$( ++ while (( $# > 0 )); do ++ for i in ${1}/*${suffix}; do ++ [[ -f $i ]] && echo ${i##*/} ++ done ++ shift ++ done | sort -Vu ++ ) ++ ++ for f in $files; do ++ for d in "${args[@]}"; do ++ if [[ -f "$d/$f" ]]; then ++ echo "$d/$f" ++ continue 2 ++ fi ++ done ++ done ++} + + [[ -f /etc/os-release ]] && . /etc/os-release + [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id +@@ -21,17 +42,30 @@ if ! [[ $BOOT_OPTIONS ]]; then + exit 1 + fi + +-LOADER_ENTRY="/boot/loader/entries/${MACHINE_ID}-00-${KERNEL_VERSION}-rescue.conf" ++LOADER_ENTRY="/boot/loader/entries/${MACHINE_ID}-0-rescue.conf" ++BOOT_DIR="/${MACHINE_ID}/0-rescue" ++BOOT_DIR_ABS="/boot${BOOT_DIR}" + + ret=0 + + case "$COMMAND" in + add) +- for i in "/boot/loader/entries/${MACHINE_ID}-00-"*"-rescue.conf"; do ++ for i in "/boot/loader/entries/${MACHINE_ID}-0-rescue.conf"; do + [[ -f $i ]] && exit 0 + done + +- dracut --no-hostonly -a "rescue" "$3"/initrd-rescue "$2" ++ # source our config dir ++ for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do ++ [[ -e $f ]] && . "$f" ++ done ++ ++ [[ $dracut_rescue_image != "yes" ]] && exit 0 ++ ++ if ! cp --preserve "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then ++ echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'!" >&2 ++ fi ++ ++ dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS"/initrd "$2" + ((ret+=$?)) + + { +@@ -40,21 +74,13 @@ case "$COMMAND" in + echo "machine-id $MACHINE_ID" + echo "options ${BOOT_OPTIONS[@]} rd.auto=1" + echo "linux $BOOT_DIR/linux" +- echo "initrd $BOOT_DIR/initrd-rescue" ++ echo "initrd $BOOT_DIR/initrd" + } > $LOADER_ENTRY + ((ret+=$?)) +- +- if (( $ret == 0 )); then +- command -v yumdb &>/dev/null && \ +- yumdb set installonly keep kernel-$KERNEL_VERSION >/dev/null +- fi +- + ;; + + remove) +- [[ -f $LOADER_ENTRY ]] || exit 0 +- +- rm -f "$LOADER_ENTRY" "$3"/initrd-rescue ++ exit 0 + ;; + + *) +diff --git a/dracut.conf.d/fedora.conf.example b/dracut.conf.d/fedora.conf.example +index 8448fc3..ba7857c 100644 +--- a/dracut.conf.d/fedora.conf.example ++++ b/dracut.conf.d/fedora.conf.example +@@ -13,3 +13,4 @@ systemdsystemunitdir=/usr/lib/systemd/system + udevdir=/usr/lib/udev + add_dracutmodules+=" systemd " + hostonly="yes" ++dracut_rescue_image="yes" +diff --git a/dracut.spec b/dracut.spec +index 14ce0d0..940d364 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -84,6 +84,7 @@ Requires: file + Requires: kpartx + Requires: udev > 166 + Requires: kbd kbd-misc ++ + %if 0%{?fedora} || 0%{?rhel} > 6 + Requires: util-linux >= 2.21 + Conflicts: systemd < 198 +@@ -234,8 +235,14 @@ rm $RPM_BUILD_ROOT%{_bindir}/mkinitrd + rm $RPM_BUILD_ROOT%{_bindir}/lsinitrd + %endif + +-mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d +-install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut_log ++# FIXME: remove after F19 ++%if 0%{?fedora} || 0%{?rhel} > 6 ++mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d ++install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh ++%endif ++ ++mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d ++install -m 0644 dracut.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/dracut_log + + # create compat symlink + mkdir -p $RPM_BUILD_ROOT/sbin +@@ -262,11 +269,11 @@ rm -rf $RPM_BUILD_ROOT + %{dracutlibdir}/dracut-logger.sh + %{dracutlibdir}/dracut-initramfs-restore + %{dracutlibdir}/dracut-install +-%config(noreplace) /etc/dracut.conf ++%config(noreplace) %{_sysconfdir}/dracut.conf + %if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} + %{dracutlibdir}/dracut.conf.d/01-dist.conf + %endif +-%dir /etc/dracut.conf.d ++%dir %{_sysconfdir}/dracut.conf.d + %dir %{dracutlibdir}/dracut.conf.d + %{_mandir}/man8/dracut.8* + %{_mandir}/man8/*service.8* +@@ -329,7 +336,7 @@ rm -rf $RPM_BUILD_ROOT + %{dracutlibdir}/modules.d/99fs-lib + %{dracutlibdir}/modules.d/99img-lib + %{dracutlibdir}/modules.d/99shutdown +-%config(noreplace) /etc/logrotate.d/dracut_log ++%config(noreplace) %{_sysconfdir}/logrotate.d/dracut_log + %attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log + %dir %{_sharedstatedir}/initramfs + %if %{defined _unitdir} +@@ -339,6 +346,7 @@ rm -rf $RPM_BUILD_ROOT + %if 0%{?fedora} || 0%{?rhel} > 6 + %{_prefix}/lib/kernel/install.d/50-dracut.install + %{_prefix}/lib/kernel/install.d/51-dracut-rescue.install ++%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh + %endif + + %files network diff --git a/dracut.spec b/dracut.spec index 0661565..0c68e22 100644 --- a/dracut.spec +++ b/dracut.spec @@ -10,7 +10,7 @@ Name: dracut Version: 026 -Release: 1%{?dist} +Release: 15.git20130311%{?dist} Summary: Initramfs generator using udev %if 0%{?fedora} || 0%{?rhel} @@ -29,6 +29,20 @@ 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-systemd-module-setup.sh-call-systemd-in-private-dir-.patch +Patch2: 0002-add-lib-kernel-install.d-51-dracut-rescue.install.patch +Patch3: 0003-fedora.conf.example-make-hostonly-default-for-fedora.patch +Patch4: 0004-dracut.sh-remove-default-marker-in-help.patch +Patch5: 0005-dracut.sh-add-new-default-path-to-initramfs-accordin.patch +Patch6: 0006-add-rescue-dracut-module.patch +Patch7: 0007-dracut.sh-move-cleanup-trap-just-after-mktemp.patch +Patch8: 0008-dracut.spec-add-rescue-module.patch +Patch9: 0009-51-dracut-rescue.install-do-not-unset-installonly-on.patch +Patch10: 0010-lsinitrd.sh-fix-for-default-initrd-not-found-but-ima.patch +Patch11: 0011-lsinitrd.sh-removed-trailing.patch +Patch12: 0012-make-host_fs_types-a-hashmap.patch +Patch13: 0013-dracut.sh-add-swap-partitions-to-host-only-setup.patch +Patch14: 0014-add-51-dracut-rescue-postinst.sh.patch BuildRequires: dash bash git @@ -85,6 +99,7 @@ Requires: file Requires: kpartx Requires: udev > 166 Requires: kbd kbd-misc + %if 0%{?fedora} || 0%{?rhel} > 6 Requires: util-linux >= 2.21 Conflicts: systemd < 198 @@ -133,7 +148,7 @@ Requires: nss-softokn-freebl %description fips This package requires everything which is needed to build an -all purpose initramfs with dracut, which does an integrity check. +initramfs with dracut, which does an integrity check. %endif %package fips-aesni @@ -142,8 +157,7 @@ Requires: %{name}-fips = %{version}-%{release} %description fips-aesni This package requires everything which is needed to build an -all purpose initramfs with dracut, which does an integrity check -and adds the aesni-intel kernel module. +initramfs with dracut, which does an integrity check and adds the aesni-intel kernel module. %package caps Summary: dracut modules to build a dracut initramfs which drops capabilities @@ -152,7 +166,7 @@ Requires: libcap %description caps This package requires everything which is needed to build an -all purpose initramfs with dracut, which drops capabilities. +initramfs with dracut, which drops capabilities. %package tools Summary: dracut tools to build the local initramfs @@ -236,8 +250,14 @@ rm $RPM_BUILD_ROOT%{_bindir}/mkinitrd rm $RPM_BUILD_ROOT%{_bindir}/lsinitrd %endif -mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d -install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut_log +# FIXME: remove after F19 +%if 0%{?fedora} || 0%{?rhel} > 6 +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d +install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh +%endif + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d +install -m 0644 dracut.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/dracut_log # create compat symlink mkdir -p $RPM_BUILD_ROOT/sbin @@ -264,11 +284,11 @@ rm -rf $RPM_BUILD_ROOT %{dracutlibdir}/dracut-logger.sh %{dracutlibdir}/dracut-initramfs-restore %{dracutlibdir}/dracut-install -%config(noreplace) /etc/dracut.conf +%config(noreplace) %{_sysconfdir}/dracut.conf %if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} %{dracutlibdir}/dracut.conf.d/01-dist.conf %endif -%dir /etc/dracut.conf.d +%dir %{_sysconfdir}/dracut.conf.d %dir %{dracutlibdir}/dracut.conf.d %{_mandir}/man8/dracut.8* %{_mandir}/man8/*service.8* @@ -284,6 +304,7 @@ rm -rf $RPM_BUILD_ROOT %else %{dracutlibdir}/modules.d/00bootchart %endif +%{dracutlibdir}/modules.d/03rescue %{dracutlibdir}/modules.d/04watchdog %{dracutlibdir}/modules.d/05busybox %{dracutlibdir}/modules.d/10i18n @@ -330,7 +351,7 @@ rm -rf $RPM_BUILD_ROOT %{dracutlibdir}/modules.d/99fs-lib %{dracutlibdir}/modules.d/99img-lib %{dracutlibdir}/modules.d/99shutdown -%config(noreplace) /etc/logrotate.d/dracut_log +%config(noreplace) %{_sysconfdir}/logrotate.d/dracut_log %attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log %dir %{_sharedstatedir}/initramfs %if %{defined _unitdir} @@ -339,6 +360,8 @@ rm -rf $RPM_BUILD_ROOT %endif %if 0%{?fedora} || 0%{?rhel} > 6 %{_prefix}/lib/kernel/install.d/50-dracut.install +%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install +%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh %endif %files network @@ -380,6 +403,9 @@ rm -rf $RPM_BUILD_ROOT %dir /var/lib/dracut/overlay %changelog +* Mon Mar 11 2013 Harald Hoyer 026-15.git20130311 +- update to recent git + * Fri Mar 08 2013 Harald Hoyer 026-1 - version 026