dracut-044-1

- version 044
This commit is contained in:
Harald Hoyer 2015-11-25 17:41:51 +01:00
parent 4536824578
commit 300e6d220d
176 changed files with 7 additions and 11946 deletions

1
.gitignore vendored
View File

@ -28,3 +28,4 @@
/dracut-041.tar.xz
/dracut-042.tar.xz
/dracut-043.tar.xz
/dracut-044.tar.xz

View File

@ -1,33 +0,0 @@
From 80dab03a7dc080b8d35fdd4c23e30e79e044c2a2 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Date: Tue, 17 Feb 2015 13:03:01 +0000
Subject: [PATCH] Fix default udev & systemd dir detection, in usr-merge
configurations.
Test that /lib is not a symlink, before using split-usr paths.
---
dracut.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index d06d7d4..4f72b54 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1300,7 +1300,7 @@ done
[[ -d $udevdir ]] \
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
if ! [[ -d "$udevdir" ]]; then
- [[ -d /lib/udev ]] && udevdir=/lib/udev
+ [[ ! -h /lib ]] && [[ -d /lib/udev ]] && udevdir=/lib/udev
[[ -d /usr/lib/udev ]] && udevdir=/usr/lib/udev
fi
@@ -1308,7 +1308,7 @@ fi
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
if ! [[ -d "$systemdutildir" ]]; then
- [[ -d /lib/systemd ]] && systemdutildir=/lib/systemd
+ [[ ! -h /lib ]] && [[ -d /lib/systemd ]] && systemdutildir=/lib/systemd
[[ -d /usr/lib/systemd ]] && systemdutildir=/usr/lib/systemd
fi

View File

@ -1,22 +0,0 @@
From 231b3dd4327e011285636e73459c3d139baba661 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 15 Jun 2015 15:28:52 +0200
Subject: [PATCH] rootfs-generator: check for rootok, before doing any action
---
modules.d/98dracut-systemd/rootfs-generator.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/98dracut-systemd/rootfs-generator.sh b/modules.d/98dracut-systemd/rootfs-generator.sh
index 5910ce7..670613e 100755
--- a/modules.d/98dracut-systemd/rootfs-generator.sh
+++ b/modules.d/98dracut-systemd/rootfs-generator.sh
@@ -93,7 +93,7 @@ esac
GENERATOR_DIR="$1"
-if [ "${root%%:*}" = "block" ]; then
+if [ "$rootok" = "1" ]; then
generator_wait_for_dev "${root#block:}" "$RDRETRY"
strstr "$(cat /proc/cmdline)" 'root=' || generator_mount_rootfs "${root#block:}" "$(getarg rootfstype=)" "$(getarg rootflags=)"
fi

View File

@ -1,19 +0,0 @@
From aca93e3364b9b837eb98eeb62322cf19d9819147 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 16 Jun 2015 15:08:23 +0200
Subject: [PATCH] uefi-lib: remove bogus comment
---
modules.d/99uefi-lib/module-setup.sh | 1 -
1 file changed, 1 deletion(-)
diff --git a/modules.d/99uefi-lib/module-setup.sh b/modules.d/99uefi-lib/module-setup.sh
index 4a856ea..3dcff22 100755
--- a/modules.d/99uefi-lib/module-setup.sh
+++ b/modules.d/99uefi-lib/module-setup.sh
@@ -1,5 +1,4 @@
#!/bin/bash
-# module-setup for img-lib
# called by dracut
check() {

View File

@ -1,69 +0,0 @@
From ac13778f60f3a9568eaa2b480a77563337575d91 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 16 Jun 2015 15:17:39 +0200
Subject: [PATCH] dracut.spec: move dmsquash and livnet to subpackage
dmsquash and livenet need img-lib, which needs tar, which is normally
not needed.
---
dracut.spec | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/dracut.spec b/dracut.spec
index 6b37dc3..58510db 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -168,6 +168,16 @@ Requires: libcap
This package requires everything which is needed to build an
initramfs with dracut, which drops capabilities.
+%package live
+Summary: dracut modules to build a dracut initramfs with live image capabilities
+Requires: %{name} = %{version}-%{release}
+Requires: %{name}-network = %{version}-%{release}
+Requires: tar gzip coreutils bash device-mapper curl
+
+%description live
+This package requires everything which is needed to build an
+initramfs with dracut, with live image capabilities, like Live CDs.
+
%package config-generic
Summary: dracut configuration to turn off hostonly image generation
Requires: %{name} = %{version}-%{release}
@@ -345,7 +355,6 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/90crypt
%{dracutlibdir}/modules.d/90dm
%{dracutlibdir}/modules.d/90dmraid
-%{dracutlibdir}/modules.d/90dmsquash-live
%{dracutlibdir}/modules.d/90kernel-modules
%{dracutlibdir}/modules.d/90lvm
%{dracutlibdir}/modules.d/90mdraid
@@ -379,7 +388,6 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base
%{dracutlibdir}/modules.d/99fs-lib
-%{dracutlibdir}/modules.d/99img-lib
%{dracutlibdir}/modules.d/99shutdown
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
%dir %{_sharedstatedir}/initramfs
@@ -413,7 +421,6 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/90kernel-network-modules
%{dracutlibdir}/modules.d/95fcoe
%{dracutlibdir}/modules.d/95iscsi
-%{dracutlibdir}/modules.d/90livenet
%{dracutlibdir}/modules.d/90qemu-net
%{dracutlibdir}/modules.d/95cifs
%{dracutlibdir}/modules.d/95nbd
@@ -440,6 +447,12 @@ rm -rf -- $RPM_BUILD_ROOT
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/02caps
+%files live
+%defattr(-,root,root,0755)
+%{dracutlibdir}/modules.d/99img-lib
+%{dracutlibdir}/modules.d/90dmsquash-live
+%{dracutlibdir}/modules.d/90livenet
+
%files tools
%defattr(-,root,root,0755)

View File

@ -1,24 +0,0 @@
From 47ff68e78b3bbd01367948b5b9fe1cbaeb45f262 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 23 Jun 2015 15:21:37 +0200
Subject: [PATCH] dracut.spec: Recommends grubby
---
dracut.spec | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dracut.spec b/dracut.spec
index 58510db..7a1a9c2 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -113,6 +113,10 @@ Requires: util-linux-ng >= 2.21
Conflicts: mdadm < 3.2.6-14
+%if 0%{?fedora} > 22
+Recommends: grubby
+%endif
+
%description
dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
Unlike existing implementations, dracut does hard-code as little as possible

View File

@ -1,48 +0,0 @@
From c42064a684f3413dfce249c5bd6ebe0cb0a16908 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 23 Jun 2015 15:29:00 +0200
Subject: [PATCH] dracut.spec: turn requires in recommends
---
dracut.spec | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/dracut.spec b/dracut.spec
index 7a1a9c2..4775210 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -92,11 +92,21 @@ Requires: cpio
Requires: filesystem >= 2.1.0
Requires: findutils
Requires: grep
-Requires: hardlink
-Requires: gzip xz
Requires: kmod
Requires: sed
+
+%if 0%{?fedora} > 22
+Recommends: grubby
+Recommends: hardlink
+Recommends: gzip
+Recommends: xz
+Recommends: kpartx
+%else
+Requires: hardlink
+Requires: gzip
+Requires: xz
Requires: kpartx
+%endif
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.21
@@ -113,10 +123,6 @@ Requires: util-linux-ng >= 2.21
Conflicts: mdadm < 3.2.6-14
-%if 0%{?fedora} > 22
-Recommends: grubby
-%endif
-
%description
dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
Unlike existing implementations, dracut does hard-code as little as possible

View File

@ -1,30 +0,0 @@
From d4b93a092db1105a29a3f768d1d49ece8b90547a Mon Sep 17 00:00:00 2001
From: Fabian Deutsch <fabiand@fedoraproject.org>
Date: Thu, 25 Jun 2015 11:17:59 +0200
Subject: [PATCH] Revert "lvm: Don't activate LVs with activationskip set"
This reverts commit cfa365a32d47388c8476064b23d7d4684f1e591b.
The logic in commit cfa365a was added to prevent (odl) lvms from
activating snapshots which should not be activated.
Newer lvms however do this automatically (not enabling an LV if the
the 'k' attribute set), thus we can revert the previous commit.
---
modules.d/90lvm/lvm_scan.sh | 4 ----
1 file changed, 4 deletions(-)
diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh
index ce46e14..7495644 100755
--- a/modules.d/90lvm/lvm_scan.sh
+++ b/modules.d/90lvm/lvm_scan.sh
@@ -106,10 +106,6 @@ if [ -n "$LVS" ] ; then
info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
lvm lvscan --ignorelockingfailure 2>&1 | vinfo
for LV in $LVS; do
- if [ "x$(lvm lvs --noheadings --select "lv_attr =~ k" $LV | wc -l)" = "x0" ]; then
- info "Skipping activation of '$LV' because activationskip is set."
- continue
- fi
if [ -z "$sysinit" ]; then
lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LV 2>&1 | vinfo
else

View File

@ -1,22 +0,0 @@
From 90ff5ad67ecab66a8f699c9805729701981ee018 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org>
Date: Wed, 1 Jul 2015 20:15:13 -0300
Subject: [PATCH] systemd: if kdbus is available, include the kernel module
---
modules.d/00systemd/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh
index ed55fcc..e763d9f 100755
--- a/modules.d/00systemd/module-setup.sh
+++ b/modules.d/00systemd/module-setup.sh
@@ -19,7 +19,7 @@ depends() {
installkernel() {
hostonly='' instmods autofs4 ipv6
- instmods -s efivarfs
+ instmods -s efivarfs kdbus
}
# called by dracut

View File

@ -1,50 +0,0 @@
From cf627b20d039c527f4de167e38978d4984e4d727 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 1 Jul 2015 14:53:33 +0200
Subject: [PATCH] network/dhclient-script.sh: add RENEW/REBIND
---
modules.d/40network/dhclient-script.sh | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
index 500f518..320208b 100755
--- a/modules.d/40network/dhclient-script.sh
+++ b/modules.d/40network/dhclient-script.sh
@@ -135,6 +135,17 @@ case $reason in
>/tmp/net.$netif.up
;;
+ RENEW|REBIND)
+ unset lease_time
+ [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
+ [ -n "$new_max_life" ] && lease_time=$new_max_life
+ preferred_lft=$lease_time
+ [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
+ ip -4 addr change ${new_ip_address}/${new_prefix} broadcast ${new_broadcast_address} dev ${interface} \
+ ${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
+ >/dev/null 2>&1
+ ;;
+
BOUND6)
echo "dhcp: BOND6 setting $netif"
setup_interface6
@@ -155,6 +166,18 @@ case $reason in
echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
>/tmp/net.$netif.up
;;
+
+ RENEW6|REBIND6)
+ unset lease_time
+ [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
+ [ -n "$new_max_life" ] && lease_time=$new_max_life
+ preferred_lft=$lease_time
+ [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
+ ip -6 addr change ${new_ip6_address}/${new_ip6_prefixlen} dev ${interface} scope global \
+ ${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
+ >/dev/null 2>&1
+ ;;
+
*) echo "dhcp: $reason";;
esac

View File

@ -1,29 +0,0 @@
From 0f89ec314b062a410199251db0356a55b4773173 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 1 Jul 2015 14:57:15 +0200
Subject: [PATCH] network/dhclient-script.sh: make IPv4 DHCP lease time
optionally
If bootp is used, no lease time is provided in the packet from the bootp
server.
---
modules.d/40network/dhclient-script.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
index 320208b..a8b5b89 100755
--- a/modules.d/40network/dhclient-script.sh
+++ b/modules.d/40network/dhclient-script.sh
@@ -39,9 +39,9 @@ setup_interface() {
fi
fi
- ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} \
- valid_lft ${lease_time} preferred_lft ${lease_time} \
- dev $netif
+ ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif \
+ ${lease_time:+valid_lft $lease_time} \
+ ${preferred_lft:+preferred_lft ${preferred_lft}}
if [ -n "$gw" ] ; then
if [ "$mask" == "255.255.255.255" ] ; then

View File

@ -1,44 +0,0 @@
From 7cca5efdcea4f1431331cf7663fc6fb48a365cdf Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 2 Jul 2015 11:32:08 +0200
Subject: [PATCH] network: don't use "ifup -m"
"ifup -m" was thought to be used by humans in the emergency shell.
Using it programatically shows some other flaw in the execution logic.
Also, "ifup -m" was configuring the interface multiple times on "add"
and "change" uevent, because the "$netif.did-setup" test was not
executed.
---
modules.d/40network/ifup.sh | 3 ++-
modules.d/40network/net-genrules.sh | 1 -
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index de518b6..0138e01 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
@@ -77,9 +77,10 @@ fi
# 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"
-[ -z "$netroot" ] && [ -z "$manualup" ] && exit 0
+
if [ -n "$manualup" ]; then
>/tmp/net.$netif.manualup
+ rm -f /tmp/net.${netif}.did-setup
else
[ -e /tmp/net.${netif}.did-setup ] && exit 0
[ -e /sys/class/net/$netif/address ] && \
diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh
index 77e47b5..b1c156c 100755
--- a/modules.d/40network/net-genrules.sh
+++ b/modules.d/40network/net-genrules.sh
@@ -50,7 +50,6 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
fi
ifup='/sbin/ifup $env{INTERFACE}'
- [ -z "$netroot" ] && ifup="$ifup -m"
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""

View File

@ -1,34 +0,0 @@
From 3639fe543c06c79e8c7a4872844c95d7d9b61299 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 29 Jun 2015 16:14:58 +0200
Subject: [PATCH] lower the log level for dfatal
---
dracut-logger.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dracut-logger.sh b/dracut-logger.sh
index 41e04f4..2a6019c 100755
--- a/dracut-logger.sh
+++ b/dracut-logger.sh
@@ -264,9 +264,9 @@ _lvl2syspri() {
# Conversion is done as follows:
#
# <tt>
-# FATAL(1) -> LOG_EMERG (0)
+# none -> LOG_EMERG (0)
# none -> LOG_ALERT (1)
-# none -> LOG_CRIT (2)
+# FATAL(1) -> LOG_CRIT (2)
# ERROR(2) -> LOG_ERR (3)
# WARN(3) -> LOG_WARNING (4)
# none -> LOG_NOTICE (5)
@@ -280,7 +280,7 @@ _dlvl2syslvl() {
local lvl
case "$1" in
- 1) lvl=0;;
+ 1) lvl=2;;
2) lvl=3;;
3) lvl=4;;
4) lvl=6;;

View File

@ -1,36 +0,0 @@
From 916559e073a49eedbc7b0c58b399d303fb8c2a05 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 2 Jul 2015 14:55:31 +0200
Subject: [PATCH] dracut.sh: add devices with x-initrd.mount in /etc/fstab to
host_devs
otherwise dracut might not even be able to mount those.
---
dracut.sh | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/dracut.sh b/dracut.sh
index 4f72b54..52383c0 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1231,6 +1231,20 @@ if [[ $hostonly ]]; then
done < /etc/fstab
done < /proc/swaps
fi
+
+ # collect all "x-initrd.mount" entries from /etc/fstab
+ if [[ -f /etc/fstab ]]; then
+ while read _d _m _t _o _r || [ -n "$_d" ]; do
+ [[ "$_d" == \#* ]] && continue
+ [[ $_d ]] || continue
+ [[ "$_o" != *x-initrd.mount* ]] && continue
+ _dev=$(expand_persistent_dev "$_d")
+ _dev="$(readlink -f "$_dev")"
+ [[ -b $_dev ]] && push_host_devs "$_dev"
+ done < /etc/fstab
+ fi
+
+
# record all host modaliases
declare -A host_modalias
find /sys/devices/ -name uevent -print > "$initdir/.modalias"

View File

@ -1,32 +0,0 @@
From 57fb6e67de0cc58b9d188439b0ceb0d0d5dbbd6f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 2 Jul 2015 15:02:31 +0200
Subject: [PATCH] dracut-lib.sh:info() output info to stderr
otherwise it might collide with stdout redirection
---
modules.d/99base/dracut-lib.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 08110cc..cd1f49f 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -63,7 +63,7 @@ if [ -z "$DRACUT_SYSTEMD" ]; then
check_quiet
echo "<30>dracut: $*" > /dev/kmsg
[ "$DRACUT_QUIET" != "yes" ] && \
- echo "dracut: $*"
+ echo "dracut: $*" >&2
}
else
@@ -73,7 +73,7 @@ else
}
info() {
- echo "$*"
+ echo "$*" >&2
}
fi

View File

@ -1,48 +0,0 @@
From ba665de454e7d6ef1da4ba95308fb9f65c7a9497 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 2 Jul 2015 15:21:35 +0200
Subject: [PATCH] nfs/nfs-lib.sh: add anaconda_nfsv6_to_var()
add "nfs:[[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]]/path" style parsing
https://bugzilla.redhat.com/show_bug.cgi?id=1190098
---
modules.d/95nfs/nfs-lib.sh | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/modules.d/95nfs/nfs-lib.sh b/modules.d/95nfs/nfs-lib.sh
index 77c03d9..58aa7e3 100755
--- a/modules.d/95nfs/nfs-lib.sh
+++ b/modules.d/95nfs/nfs-lib.sh
@@ -15,6 +15,7 @@ nfs_to_var() {
# FIXME: local netif=${2:-$netif}?
case "$1" in
nfs://*) rfc2224_nfs_to_var "$1" ;;
+ nfs:*[*) anaconda_nfsv6_to_var "$1" ;;
nfs:*:*:/*) anaconda_nfs_to_var "$1" ;;
*) nfsroot_to_var "$1" ;;
esac
@@ -84,6 +85,23 @@ anaconda_nfs_to_var() {
path="/${1##*:/}"
}
+# IPv6 nfs path will be treated separately
+anaconda_nfsv6_to_var() {
+ nfs="nfs"
+ path="$1:"
+ options="${path#*:/}"
+ path="/${options%%:*}"
+ server="${1#*nfs:}"
+ if str_starts $server '['; then
+ server="${server%:/*}"
+ options="${options#*:*}"
+ else
+ server="${server%:/*}"
+ options="${server%%:*}"
+ server="${server#*:}"
+ fi
+}
+
# nfsroot_from_dhcp NETIF
# fill in missing server/path from DHCP options.
nfsroot_from_dhcp() {

View File

@ -1,645 +0,0 @@
From 777f2db0373ccbc1a44fc2d960ecefbe50195055 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 2 Jul 2015 15:40:13 +0200
Subject: [PATCH] splitup dracut-init.sh from dracut-functions.sh
other tools want to source dracut-functions.sh without any mkdir side
effects.
---
Makefile | 1 +
dracut-functions.sh | 9 ++-------
dracut-init.sh | 34 ++++++++++++++++++++++++++++++++++
dracut.sh | 8 ++++----
test/TEST-01-BASIC/test.sh | 6 +++---
test/TEST-02-SYSTEMD/test.sh | 6 +++---
test/TEST-03-USR-MOUNT/test.sh | 6 +++---
test/TEST-04-FULL-SYSTEMD/test.sh | 6 +++---
test/TEST-10-RAID/test.sh | 6 +++---
test/TEST-11-LVM/test.sh | 6 +++---
test/TEST-12-RAID-DEG/test.sh | 6 +++---
test/TEST-13-ENC-RAID-LVM/test.sh | 6 +++---
test/TEST-14-IMSM/test.sh | 6 +++---
test/TEST-15-BTRFSRAID/test.sh | 6 +++---
test/TEST-16-DMSQUASH/test.sh | 4 ++--
test/TEST-17-LVM-THIN/test.sh | 6 +++---
test/TEST-20-NFS/test.sh | 6 +++---
test/TEST-30-ISCSI/test.sh | 8 ++++----
test/TEST-40-NBD/test.sh | 10 +++++-----
test/TEST-50-MULTINIC/test.sh | 6 +++---
20 files changed, 91 insertions(+), 61 deletions(-)
create mode 100644 dracut-init.sh
diff --git a/Makefile b/Makefile
index 0af5d0f..98a2fbf 100644
--- a/Makefile
+++ b/Makefile
@@ -118,6 +118,7 @@ install: all
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
mkdir -p $(DESTDIR)$(pkglibdir)/dracut.conf.d
+ install -m 0755 dracut-init.sh $(DESTDIR)$(pkglibdir)/dracut-init.sh
install -m 0755 dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh
install -m 0755 dracut-version.sh $(DESTDIR)$(pkglibdir)/dracut-version.sh
ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 8f971c0..f415f0d 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -20,14 +20,9 @@
export LC_MESSAGES=C
if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
- if ! [[ -d "$initdir/.kernelmodseen" ]]; then
- mkdir -p "$initdir/.kernelmodseen"
+ if [[ -d "$initdir/.kernelmodseen" ]]; then
+ DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
fi
- DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
-fi
-
-if [[ $initdir ]] && ! [[ -d $initdir ]]; then
- mkdir -p "$initdir"
fi
# Generic substring function. If $2 is in $1, return 0.
diff --git a/dracut-init.sh b/dracut-init.sh
new file mode 100644
index 0000000..469e42a
--- /dev/null
+++ b/dracut-init.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# functions used by dracut and other tools.
+#
+# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+export LC_MESSAGES=C
+
+if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
+ if ! [[ -d "$initdir/.kernelmodseen" ]]; then
+ mkdir -p "$initdir/.kernelmodseen"
+ fi
+ DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
+fi
+
+if [[ $initdir ]] && ! [[ -d $initdir ]]; then
+ mkdir -p "$initdir"
+fi
+
+[[ $dracutbasedir ]] || export dracutbasedir=${BASH_SOURCE%/*}
+. $dracutbasedir/dracut-functions.sh
diff --git a/dracut.sh b/dracut.sh
index 52383c0..8394cee 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -551,7 +551,7 @@ while :; do
-q|--quiet) ((verbosity_mod_l--));;
-l|--local)
allowlocal="yes"
- [[ -f "$(readlink -f "${0%/*}")/dracut-functions.sh" ]] \
+ [[ -f "$(readlink -f "${0%/*}")/dracut-init.sh" ]] \
&& dracutbasedir="$(readlink -f "${0%/*}")"
;;
-H|--hostonly|--host-only)
@@ -917,10 +917,10 @@ if [[ -f $dracutbasedir/dracut-version.sh ]]; then
. $dracutbasedir/dracut-version.sh
fi
-if [[ -f $dracutbasedir/dracut-functions.sh ]]; then
- . $dracutbasedir/dracut-functions.sh
+if [[ -f $dracutbasedir/dracut-init.sh ]]; then
+ . $dracutbasedir/dracut-init.sh
else
- printf "%s\n" "dracut: Cannot find $dracutbasedir/dracut-functions.sh." >&2
+ printf "%s\n" "dracut: Cannot find $dracutbasedir/dracut-init.sh." >&2
printf "%s\n" "dracut: Are you running from a git checkout?" >&2
printf "%s\n" "dracut: Try passing -l as an argument to $0" >&2
exit 1
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
index 4897cc9..83320e2 100755
--- a/test/TEST-01-BASIC/test.sh
+++ b/test/TEST-01-BASIC/test.sh
@@ -29,7 +29,7 @@ test_setup() {
(
export initdir=$TESTDIR/overlay/source
mkdir -p $initdir
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
@@ -58,7 +58,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple sfdisk mkfs.ext3 poweroff cp umount sync
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
@@ -87,7 +87,7 @@ test_setup() {
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
diff --git a/test/TEST-02-SYSTEMD/test.sh b/test/TEST-02-SYSTEMD/test.sh
index 3cc5d0a..16f5c26 100755
--- a/test/TEST-02-SYSTEMD/test.sh
+++ b/test/TEST-02-SYSTEMD/test.sh
@@ -25,7 +25,7 @@ test_setup() {
(
export initdir=$TESTDIR/overlay/source
mkdir -p $initdir
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
@@ -55,7 +55,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple sfdisk mkfs.ext3 poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
@@ -84,7 +84,7 @@ test_setup() {
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
diff --git a/test/TEST-03-USR-MOUNT/test.sh b/test/TEST-03-USR-MOUNT/test.sh
index cccec31..61063fd 100755
--- a/test/TEST-03-USR-MOUNT/test.sh
+++ b/test/TEST-03-USR-MOUNT/test.sh
@@ -56,7 +56,7 @@ test_setup() {
(
export initdir=$TESTDIR/overlay/source
mkdir -p $initdir
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
@@ -86,7 +86,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple sfdisk mkfs.btrfs btrfs poweroff cp umount sync
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
@@ -122,7 +122,7 @@ test_setup() {
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
diff --git a/test/TEST-04-FULL-SYSTEMD/test.sh b/test/TEST-04-FULL-SYSTEMD/test.sh
index 6e05f0d..1c12e4f 100755
--- a/test/TEST-04-FULL-SYSTEMD/test.sh
+++ b/test/TEST-04-FULL-SYSTEMD/test.sh
@@ -57,7 +57,7 @@ test_setup() {
(
export initdir=$TESTDIR/overlay/source
mkdir -p $initdir
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
for d in usr/bin usr/sbin bin etc lib "$libdir" sbin tmp usr var var/log dev proc sys sysroot root run; do
if [ -L "/$d" ]; then
@@ -222,7 +222,7 @@ EOF
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple sfdisk mkfs.btrfs btrfs poweroff cp umount sync
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
@@ -254,7 +254,7 @@ EOF
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
diff --git a/test/TEST-10-RAID/test.sh b/test/TEST-10-RAID/test.sh
index e7a1131..523b61a 100755
--- a/test/TEST-10-RAID/test.sh
+++ b/test/TEST-10-RAID/test.sh
@@ -27,7 +27,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
export initdir=$TESTDIR/overlay/source
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
@@ -56,7 +56,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple sfdisk mke2fs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
@@ -84,7 +84,7 @@ test_setup() {
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
diff --git a/test/TEST-11-LVM/test.sh b/test/TEST-11-LVM/test.sh
index 0002455..34c7736 100755
--- a/test/TEST-11-LVM/test.sh
+++ b/test/TEST-11-LVM/test.sh
@@ -24,7 +24,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
export initdir=$TESTDIR/overlay/source
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
@@ -54,7 +54,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple sfdisk mke2fs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
@@ -77,7 +77,7 @@ test_setup() {
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
diff --git a/test/TEST-12-RAID-DEG/test.sh b/test/TEST-12-RAID-DEG/test.sh
index 6c7b8b3..f4ec2d0 100755
--- a/test/TEST-12-RAID-DEG/test.sh
+++ b/test/TEST-12-RAID-DEG/test.sh
@@ -66,7 +66,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
export initdir=$TESTDIR/overlay/source
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
@@ -94,7 +94,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple sfdisk mke2fs poweroff cp umount dd grep
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
@@ -127,7 +127,7 @@ test_setup() {
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
diff --git a/test/TEST-13-ENC-RAID-LVM/test.sh b/test/TEST-13-ENC-RAID-LVM/test.sh
index 14d8196..ea81697 100755
--- a/test/TEST-13-ENC-RAID-LVM/test.sh
+++ b/test/TEST-13-ENC-RAID-LVM/test.sh
@@ -62,7 +62,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
export initdir=$TESTDIR/overlay/source
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
@@ -91,7 +91,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple sfdisk mke2fs poweroff cp umount grep
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
@@ -121,7 +121,7 @@ test_setup() {
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
diff --git a/test/TEST-14-IMSM/test.sh b/test/TEST-14-IMSM/test.sh
index 291f3c5..a05d091 100755
--- a/test/TEST-14-IMSM/test.sh
+++ b/test/TEST-14-IMSM/test.sh
@@ -54,7 +54,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
export initdir=$TESTDIR/overlay/source
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
@@ -83,7 +83,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple sfdisk mke2fs poweroff cp umount grep
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -111,7 +111,7 @@ test_setup() {
echo $MD_UUID > $TESTDIR/mduuid
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
diff --git a/test/TEST-15-BTRFSRAID/test.sh b/test/TEST-15-BTRFSRAID/test.sh
index 7f99d8b..5a9b6e1 100755
--- a/test/TEST-15-BTRFSRAID/test.sh
+++ b/test/TEST-15-BTRFSRAID/test.sh
@@ -26,7 +26,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
export initdir=$TESTDIR/overlay/source
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
@@ -55,7 +55,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple sfdisk mkfs.btrfs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
@@ -85,7 +85,7 @@ test_setup() {
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh
index 338f7f4..7e5a7de 100755
--- a/test/TEST-16-DMSQUASH/test.sh
+++ b/test/TEST-16-DMSQUASH/test.sh
@@ -30,7 +30,7 @@ test_setup() {
mkdir -p -- "$TESTDIR"/overlay
(
export initdir="$TESTDIR"/overlay
- . "$basedir"/dracut-functions.sh
+ . "$basedir"/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -49,7 +49,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
export initdir="$TESTDIR"/root-source
- . "$basedir"/dracut-functions.sh
+ . "$basedir"/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
diff --git a/test/TEST-17-LVM-THIN/test.sh b/test/TEST-17-LVM-THIN/test.sh
index 811a66c..859d4dc 100755
--- a/test/TEST-17-LVM-THIN/test.sh
+++ b/test/TEST-17-LVM-THIN/test.sh
@@ -24,7 +24,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
export initdir=$TESTDIR/overlay/source
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
@@ -54,7 +54,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple sfdisk mke2fs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
@@ -77,7 +77,7 @@ test_setup() {
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index 04616ef..61e4c1a 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -217,7 +217,7 @@ test_setup() {
(
export initdir=$TESTDIR/mnt
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
for _f in modules.builtin.bin modules.builtin; do
[[ $srcmods/$_f ]] && break
@@ -283,7 +283,7 @@ test_setup() {
# Make client root inside server root
(
export initdir=$TESTDIR/mnt/nfs/client
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple sh shutdown poweroff stty cat ps ln ip \
mount dmesg mkdir cp ping grep setsid ls vi /etc/virc less cat
@@ -331,7 +331,7 @@ test_setup() {
# Make an overlay with needed tools for the test harness
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
mkdir $TESTDIR/overlay
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index 2c082fe..59e9c5b 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/test.sh
@@ -103,7 +103,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
export initdir=$TESTDIR/overlay/source
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
@@ -128,7 +128,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple sfdisk mkfs.ext3 poweroff cp umount setsid
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
@@ -164,7 +164,7 @@ test_setup() {
rm -- $TESTDIR/client.img
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -185,7 +185,7 @@ test_setup() {
kernel=$KVERSION
(
export initdir=$TESTDIR/mnt
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
(
cd "$initdir";
mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi
diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh
index aa4b46b..39966ac 100755
--- a/test/TEST-40-NBD/test.sh
+++ b/test/TEST-40-NBD/test.sh
@@ -192,7 +192,7 @@ make_encrypted_root() {
# Create what will eventually be our root filesystem onto an overlay
(
export initdir=$TESTDIR/overlay/source
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
mkdir -p "$initdir"
(
cd "$initdir"; mkdir -p dev sys proc etc var/run tmp
@@ -217,7 +217,7 @@ make_encrypted_root() {
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
(
cd "$initdir"; mkdir -p dev sys proc etc var/run tmp
mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
@@ -263,7 +263,7 @@ make_client_root() {
kernel=$KVERSION
(
export initdir=$TESTDIR/mnt
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
mkdir -p "$initdir"
(
cd "$initdir"; mkdir -p dev sys proc etc var/run tmp
@@ -304,7 +304,7 @@ make_server_root() {
kernel=$KVERSION
(
export initdir=$TESTDIR/mnt
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
mkdir -p "$initdir"
(
cd "$initdir";
@@ -351,7 +351,7 @@ test_setup() {
# Make the test image
(
export initdir=$TESTDIR/overlay
- . $basedir/dracut-functions.sh
+ . $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh
index b292cc0..b878380 100755
--- a/test/TEST-50-MULTINIC/test.sh
+++ b/test/TEST-50-MULTINIC/test.sh
@@ -146,7 +146,7 @@ test_setup() {
(
export initdir="$TESTDIR"/mnt
- . "$basedir"/dracut-functions.sh
+ . "$basedir"/dracut-init.sh
(
cd "$initdir";
@@ -212,7 +212,7 @@ test_setup() {
# Make client root inside server root
(
export initdir="$TESTDIR"/mnt/nfs/client
- . "$basedir"/dracut-functions.sh
+ . "$basedir"/dracut-init.sh
(
cd "$initdir"
mkdir -p dev sys proc etc run
@@ -256,7 +256,7 @@ test_setup() {
# Make an overlay with needed tools for the test harness
(
export initdir="$TESTDIR"/overlay
- . "$basedir"/dracut-functions.sh
+ . "$basedir"/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules

View File

@ -1,25 +0,0 @@
From 8d09f493a634f0c6c44e99fb22618b75cbb41f0f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 2 Jul 2015 19:48:25 +0200
Subject: [PATCH] network/dhclient-script.sh: fixup lease time
---
modules.d/40network/dhclient-script.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
index a8b5b89..2550caf 100755
--- a/modules.d/40network/dhclient-script.sh
+++ b/modules.d/40network/dhclient-script.sh
@@ -21,7 +21,10 @@ setup_interface() {
search=$(printf -- "$new_domain_search")
namesrv=$new_domain_name_servers
hostname=$new_host_name
- lease_time=$new_dhcp_lease_time
+ [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
+ [ -n "$new_max_life" ] && lease_time=$new_max_life
+ preferred_lft=$lease_time
+ [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override

View File

@ -1,90 +0,0 @@
From 77403e0032c0ca8bcd4c3951e3ead3bd8c23f8e6 Mon Sep 17 00:00:00 2001
From: Dave Young <dyoung@redhat.com>
Date: Mon, 6 Jul 2015 15:31:26 +0800
Subject: [PATCH] 90multipath: add hostonly multipath.conf in case hostonly
mode
For large machine, suppose there's a lot of multipath devices, multipath layer
will use a lot of memory. For kdump kernel memory is very limited thus it causes
oom. To avoid oom, we only add necessary multipath devices in kdump kernel
multipath.conf.
This is done by use mpathconf --allow, a new option which is like whitelist.
Signed-off-by: Dave Young <dyoung@redhat.com>
---
modules.d/90multipath/module-setup.sh | 42 ++++++++++++++++++++++++++++-------
1 file changed, 34 insertions(+), 8 deletions(-)
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index 29643d4..321f13e 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -1,18 +1,28 @@
#!/bin/bash
+is_mpath() {
+ local _dev=$1
+ [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
+ [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
+ return 1
+}
+
+majmin_to_mpath_dev() {
+ local _dev
+ for i in `ls -1 /dev/mapper/mpath*`; do
+ dev=$(get_maj_min $i)
+ if [ "$dev" = "$1" ]; then
+ echo $i
+ return
+ fi
+ done
+}
# called by dracut
check() {
local _rootdev
# if there's no multipath binary, no go.
require_binaries multipath || return 1
- is_mpath() {
- local _dev=$1
- [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
- [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
- return 1
- }
-
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_and_slaves is_mpath || return 255
}
@@ -79,7 +89,18 @@ installkernel() {
# called by dracut
install() {
- local _f
+ local _f _allow
+ add_hostonly_mpath_conf() {
+ is_mpath $1 && {
+ local _dev
+
+ _dev=$(majmin_to_mpath_dev $1)
+ [ -z "$_dev" ] && return
+ strstr "$_allow" "$_dev" && return
+ _allow="$_allow --allow $_dev"
+ }
+ }
+
inst_multiple -o \
dmsetup \
kpartx \
@@ -93,6 +114,11 @@ install() {
/etc/multipath.conf \
/etc/multipath/*
+ [[ $hostonly ]] && {
+ for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
+ [ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
+ }
+
inst $(command -v partx) /sbin/partx
inst_libdir_file "libmultipath*" "multipath/*"

View File

@ -1,24 +0,0 @@
From 3d579309cde6c02a85ce7d3c396f61e7f064690b Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 7 Jul 2015 13:25:56 +0200
Subject: [PATCH] dmsquash-live/dmsquash-live-root.sh: fixup checkisomd5 for
systemd
systemd does not like a leading "-" for unit template filenames anymore.
---
modules.d/90dmsquash-live/dmsquash-live-root.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
index a0a9ab9..531617e 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
@@ -41,7 +41,7 @@ getarg rd.live.check -d check || check=""
if [ -n "$check" ]; then
type plymouth >/dev/null 2>&1 && plymouth --hide-splash
if [ -n "$DRACUT_SYSTEMD" ]; then
- p=$(str_replace "$livedev" "-" '\x2d')
+ p=$(dev_unit_name "$livedev")
systemctl start checkisomd5@${p}.service
else
checkisomd5 --verbose $livedev

View File

@ -1,25 +0,0 @@
From 6318baa45f2f09ecd821eddf401270d947664f1d Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 7 Jul 2015 13:26:38 +0200
Subject: [PATCH] skipcpio/skipcpio.c: linux kernel only accepts "070701"
signature
don't bother with other signatures
---
skipcpio/skipcpio.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/skipcpio/skipcpio.c b/skipcpio/skipcpio.c
index 445d7f6..3069981 100644
--- a/skipcpio/skipcpio.c
+++ b/skipcpio/skipcpio.c
@@ -60,8 +60,7 @@ int main(int argc, char **argv)
fseek(f, 0, SEEK_SET);
/* check, if this is a cpio archive */
- if ((buf[0] == 0x71 && buf[1] == 0xc7)
- || (buf[0] == '0' && buf[1] == '7' && buf[2] == '0' && buf[3] == '7' && buf[4] == '0' && buf[5] == '1')) {
+ if (buf[0] == '0' && buf[1] == '7' && buf[2] == '0' && buf[3] == '7' && buf[4] == '0' && buf[5] == '1') {
long pos = 0;
/* Search for CPIO_END */

View File

@ -1,30 +0,0 @@
From b8efaa00171135db1e1f09a73a2e0d8098f03867 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Fri, 26 Jun 2015 16:55:52 +0200
Subject: [PATCH] Reset IFS variable
Setting and unsetting the IFS variable is tricky. To be on the
safe side we should always reset the IFS variable to its original
value after parsing.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95fcoe/parse-fcoe.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/modules.d/95fcoe/parse-fcoe.sh b/modules.d/95fcoe/parse-fcoe.sh
index b66fa3e..a214007 100755
--- a/modules.d/95fcoe/parse-fcoe.sh
+++ b/modules.d/95fcoe/parse-fcoe.sh
@@ -26,8 +26,10 @@ initqueue --onetime modprobe -b -q bnx2fc
udevadm settle --timeout=30
parse_fcoe_opts() {
+ local OLDIFS="$IFS"
local IFS=:
set $fcoe
+ IFS="$OLDIFS"
case $# in
2)

View File

@ -1,66 +0,0 @@
From 01e60ca4f63536025d66610679a7a757907e71c8 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Fri, 26 Jun 2015 16:55:53 +0200
Subject: [PATCH] mkinitrd-suse.sh: Bail out with exit 1 if initrd cannot be
generated
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
mkinitrd-suse.sh | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/mkinitrd-suse.sh b/mkinitrd-suse.sh
index af42cbe..c2b314f 100755
--- a/mkinitrd-suse.sh
+++ b/mkinitrd-suse.sh
@@ -280,7 +280,8 @@ done
[[ $targets && $kernels ]] || default_kernel_images
if [[ ! $targets || ! $kernels ]];then
- error "No kernel found in $boot_dir"
+ error "No kernel found in $boot_dir or bad modules dir in /lib/modules"
+ exit 1
fi
# We can have several targets/kernels, transform the list to an array
@@ -301,6 +302,8 @@ fi
[[ $domu_module_list ]] || domu_module_list="${DOMU_INITRD_MODULES}"
shopt -s extglob
+failed=""
+
for ((i=0 ; $i<${#targets[@]} ; i++)); do
if [[ $img_vers ]];then
@@ -329,14 +332,18 @@ for ((i=0 ; $i<${#targets[@]} ; i++)); do
# expansion magics
if [ -n "${modules_all}" ];then
$dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel" &>/dev/null
+ [ $? -ne 0 ] && failed="$failed $target"
else
$dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null
+ [ $? -ne 0 ] && failed="$failed $target"
fi
else
if [ -n "${modules_all}" ];then
$dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel"
+ [ $? -ne 0 ] && failed="$failed $target"
else
$dracut_cmd $dracut_args "$target" "$kernel"
+ [ $? -ne 0 ] && failed="$failed $target"
fi
fi
done
@@ -345,4 +352,12 @@ if [ "$skip_update_bootloader" ] ; then
echo 2>&1 "Did not refresh the bootloader. You might need to refresh it manually."
else
update-bootloader --refresh
+ [ $? -ne 0 ] && echo "Updating bootloader failed" && exit 1
+fi
+
+if [ "$failed" != "" ]; then
+ echo "Generating $failed targets failed"
+ exit 1
fi
+
+exit 0

View File

@ -1,67 +0,0 @@
From 162daf0c978ab67131f18856c816d3dbd5ed819f Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Fri, 26 Jun 2015 16:55:54 +0200
Subject: [PATCH] Use the uncompressed kernel file on arm and aarch to detect
kernel version
This is due to file cannot read out the kernel version on these.
Many thanks to Alexander Graf finding this in old SUSE mkinitrd code.
Converted by Thomas Renninger.
Signed-off-by: Thomas Renninger <trenn@suse.de>
https://bugzilla.suse.com/show_bug.cgi?id=908454
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
mkinitrd-suse.sh | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/mkinitrd-suse.sh b/mkinitrd-suse.sh
index c2b314f..0f2b3c4 100755
--- a/mkinitrd-suse.sh
+++ b/mkinitrd-suse.sh
@@ -145,6 +145,33 @@ is_xen_kernel() {
return
}
+# kernel_image_gz_from_image() and kernel_version_from_image() are helpers
+# for arm* kernels which produce zImage files which cannot be read from
+# get_kernel_version -> get rid of this workaround if possible
+kernel_image_gz_from_image() {
+ local arch=$(uname -i)
+ local r=${1}.gz
+
+ # uImage kernels can't be extracted directly. Use the vmlinux.gz instead
+ r=${r//uImage/vmlinux}
+
+ # on ARM a zImage can't be extracted directly. Other platforms define it
+ # as a gzipped vmlinux file, but not ARM. So only on ARM, use vmlinux.gz.
+ if [[ $arch =~ arm ]] || [[ $arch =~ aarch ]]; then
+ r=${r//zImage/vmlinux}
+ fi
+
+ echo $r
+}
+
+kernel_version_from_image() {
+ local kernel_image="$1" kernel_image_gz=$(kernel_image_gz_from_image "$1")
+
+ if get_kernel_version "$kernel_image" 2>/dev/null; then
+ return
+ fi
+ get_kernel_version "$kernel_image_gz" 2>/dev/null
+}
# Taken over from SUSE mkinitrd
default_kernel_images() {
@@ -183,7 +210,8 @@ default_kernel_images() {
[ -L "$boot_dir/$kernel_image" ] && continue
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
- kernel_version=$(/usr/bin/get_kernel_version \
+
+ kernel_version=$(kernel_version_from_image \
$boot_dir/$kernel_image 2> /dev/null)
initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
if [ "$kernel_image" != "$initrd_image" -a \

View File

@ -1,48 +0,0 @@
From 6c9484f61440b71301f43cfa912fb9f1113352b1 Mon Sep 17 00:00:00 2001
From: Andrei Borzenkov <arvidjaar@gmail.com>
Date: Fri, 26 Jun 2015 16:55:56 +0200
Subject: [PATCH] ensure pre-mount (and resume) run before root fsck
References:
https://bugzilla.suse.com/show_bug.cgi?id=906592
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/98dracut-systemd/rootfs-generator.sh | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/modules.d/98dracut-systemd/rootfs-generator.sh b/modules.d/98dracut-systemd/rootfs-generator.sh
index 670613e..5e79d0b 100755
--- a/modules.d/98dracut-systemd/rootfs-generator.sh
+++ b/modules.d/98dracut-systemd/rootfs-generator.sh
@@ -65,6 +65,23 @@ generator_mount_rootfs()
fi
}
+generator_fsck_after_pre_mount()
+{
+ local _name
+
+ [ -z "$1" ] && return 0
+
+ _name=$(dev_unit_name "$1")
+ [ -d /run/systemd/generator/systemd-fsck@${_name}.service.d ] || mkdir -p /run/systemd/generator/systemd-fsck@${_name}.service.d
+ if ! [ -f /run/systemd/generator/systemd-fsck@${_name}.service.d/after-pre-mount.conf ]; then
+ {
+ echo "[Unit]"
+ echo "After=dracut-pre-mount.service"
+ } > /run/systemd/generator/systemd-fsck@${_name}.service.d/after-pre-mount.conf
+ fi
+
+}
+
root=$(getarg root=)
case "$root" in
block:LABEL=*|LABEL=*)
@@ -95,6 +112,7 @@ GENERATOR_DIR="$1"
if [ "$rootok" = "1" ]; then
generator_wait_for_dev "${root#block:}" "$RDRETRY"
+ generator_fsck_after_pre_mount "${root#block:}"
strstr "$(cat /proc/cmdline)" 'root=' || generator_mount_rootfs "${root#block:}" "$(getarg rootfstype=)" "$(getarg rootflags=)"
fi

View File

@ -1,23 +0,0 @@
From e860ef0e308364df3070d866950782544eb11950 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 7 Jul 2015 13:45:19 +0200
Subject: [PATCH] dracut-pre-mount.service should run before
systemd-fsck-root.service
---
modules.d/98dracut-systemd/dracut-pre-mount.service | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/98dracut-systemd/dracut-pre-mount.service b/modules.d/98dracut-systemd/dracut-pre-mount.service
index 96ea995..1e4e29f 100644
--- a/modules.d/98dracut-systemd/dracut-pre-mount.service
+++ b/modules.d/98dracut-systemd/dracut-pre-mount.service
@@ -11,7 +11,7 @@
Description=dracut pre-mount hook
Documentation=man:dracut-pre-mount.service(8)
DefaultDependencies=no
-Before=initrd-root-fs.target sysroot.mount
+Before=initrd-root-fs.target sysroot.mount systemd-fsck-root.service
After=dracut-initqueue.service
After=cryptsetup.target
ConditionPathExists=/usr/lib/initrd-release

View File

@ -1,47 +0,0 @@
From 9ee2f1e2358c86dce0da1a65f2352e8e3cba5ea4 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 7 Jul 2015 14:29:22 +0200
Subject: [PATCH] TEST-04-FULL-SYSTEMD: fixup loadkeys keymap loading
---
test/TEST-04-FULL-SYSTEMD/test.sh | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/test/TEST-04-FULL-SYSTEMD/test.sh b/test/TEST-04-FULL-SYSTEMD/test.sh
index 1c12e4f..6ea9281 100755
--- a/test/TEST-04-FULL-SYSTEMD/test.sh
+++ b/test/TEST-04-FULL-SYSTEMD/test.sh
@@ -171,13 +171,18 @@ EOF
inst /usr/lib/systemd/system/dbus.socket
inst /usr/lib/systemd/system/dbus.service
+ (
+ echo "FONT=latarcyrheb-sun16"
+ echo "KEYMAP=us"
+ ) >$initrd/etc/vconsole.conf
+
# install basic keyboard maps and fonts
for i in \
/usr/lib/kbd/consolefonts/eurlatgr* \
/usr/lib/kbd/consolefonts/latarcyrheb-sun16* \
- /usr/lib/kbd/keymaps/include/* \
- /usr/lib/kbd/keymaps/i386/include/* \
- /usr/lib/kbd/keymaps/i386/qwerty/us.*; do
+ /usr/lib/kbd/keymaps/{legacy/,/}include/* \
+ /usr/lib/kbd/keymaps/{legacy/,/}i386/include/* \
+ /usr/lib/kbd/keymaps/{legacy/,/}i386/qwerty/us.*; do
[[ -f $i ]] || continue
inst $i
done
@@ -260,9 +265,9 @@ EOF
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
- -a "debug systemd" \
+ -a "debug systemd i18n" \
-I "/etc/machine-id /etc/hostname" \
- -o "dash network plymouth lvm mdraid resume crypt i18n caps dm terminfo usrmount kernel-network-modules" \
+ -o "dash network plymouth lvm mdraid resume crypt caps dm terminfo usrmount kernel-network-modules" \
-d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \
--no-hostonly-cmdline -N \
-f $TESTDIR/initramfs.testing $KVERSION || return 1

View File

@ -1,32 +0,0 @@
From 3fa31c3a47be657a42640ba1669e0b77b8835534 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 7 Jul 2015 14:31:16 +0200
Subject: [PATCH] TEST-14-IMSM: remove "rd.auto"
otherwise rd.auto auto assembles the device
---
test/TEST-14-IMSM/test.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/TEST-14-IMSM/test.sh b/test/TEST-14-IMSM/test.sh
index a05d091..f4ea7ae 100755
--- a/test/TEST-14-IMSM/test.sh
+++ b/test/TEST-14-IMSM/test.sh
@@ -30,13 +30,13 @@ client_run() {
test_run() {
read MD_UUID < $TESTDIR/mduuid
client_run rd.auto rd.md.imsm=0 || return 1
- client_run rd.auto rd.md.uuid=$MD_UUID rd.dm=0 || return 1
+ client_run rd.md.uuid=$MD_UUID rd.dm=0 || return 1
# This test succeeds, because the mirror parts are found without
# assembling the mirror itsself, which is what we want
- client_run rd.auto rd.md.uuid=$MD_UUID rd.md=0 rd.md.imsm failme && return 1
- client_run rd.auto rd.md.uuid=$MD_UUID rd.md=0 failme && return 1
+ client_run rd.md.uuid=$MD_UUID rd.md=0 rd.md.imsm failme && return 1
+ client_run rd.md.uuid=$MD_UUID rd.md=0 failme && return 1
# the following test hangs on newer md
- client_run rd.auto rd.md.uuid=$MD_UUID rd.dm=0 rd.md.imsm rd.md.conf=0 || return 1
+ client_run rd.md.uuid=$MD_UUID rd.dm=0 rd.md.imsm rd.md.conf=0 || return 1
return 0
}

View File

@ -1,22 +0,0 @@
From 7ecb36aef43f7573e1ae0489731000c9c01bc481 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 7 Jul 2015 15:34:30 +0200
Subject: [PATCH] TEST-50-MULTINIC/test.sh: correctly call ldconfig
---
test/TEST-50-MULTINIC/test.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh
index b878380..fdeb840 100755
--- a/test/TEST-50-MULTINIC/test.sh
+++ b/test/TEST-50-MULTINIC/test.sh
@@ -205,7 +205,7 @@ test_setup() {
inst /etc/group /etc/group
cp -a -- /etc/ld.so.conf* "$initdir"/etc
- sudo ldconfig -r -- "$initdir"
+ ldconfig -r "$initdir"
dracut_kernel_post
)

View File

@ -1,22 +0,0 @@
From 78362bc5fea4fe640e7a767ebfbef7e3f5f57eba Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 8 Jul 2015 08:49:02 +0200
Subject: [PATCH] network/dhclient-script.sh: remove bashism
---
modules.d/40network/dhclient-script.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
index 2550caf..c75ac89 100755
--- a/modules.d/40network/dhclient-script.sh
+++ b/modules.d/40network/dhclient-script.sh
@@ -47,7 +47,7 @@ setup_interface() {
${preferred_lft:+preferred_lft ${preferred_lft}}
if [ -n "$gw" ] ; then
- if [ "$mask" == "255.255.255.255" ] ; then
+ if [ "$mask" = "255.255.255.255" ] ; then
# point-to-point connection => set explicit route to gateway
echo ip route add $gw dev $netif > /tmp/net.$netif.gw
fi

View File

@ -1,103 +0,0 @@
From 1cadc26fd44a602ffbcfb59786b400990541dc86 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 9 Jul 2015 13:18:13 +0200
Subject: [PATCH] Add all btrfs devices
We have to find them with "btrfs usage", which is cumbersome.
---
dracut-functions.sh | 13 +++++++++++++
dracut.sh | 22 ++++++++++++++++++++--
modules.d/99base/module-setup.sh | 4 +++-
3 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index f415f0d..639c5ae 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -31,6 +31,10 @@ strstr() { [[ $1 = *"$2"* ]]; }
strglobin() { [[ $1 = *$2* ]]; }
# Generic glob matching function. If glob pattern $2 matches all of $1, OK
strglob() { [[ $1 = $2 ]]; }
+# returns OK if $1 contains literal string $2 at the beginning, and isn't empty
+str_starts() { [ "${1#"$2"*}" != "$1" ]; }
+# returns OK if $1 contains literal string $2 at the end, and isn't empty
+str_ends() { [ "${1%*"$2"}" != "$1" ]; }
# helper function for check() in module-setup.sh
# to check for required installed binaries
@@ -1815,3 +1819,12 @@ lvm_internal_dev() {
[[ ${DM_LV_LAYER} ]] || [[ ! -L /dev/${DM_VG_NAME}/${DM_LV_NAME} ]]
}
+btrfs_devs() {
+ local _mp="$1"
+ btrfs device usage "$_mp" \
+ | while read _dev _rest; do
+ str_starts "$_dev" "/" || continue
+ _dev=${_dev%,}
+ printf -- "%s\n" "$_dev"
+ done
+}
diff --git a/dracut.sh b/dracut.sh
index 8394cee..bf1886f 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1146,6 +1146,11 @@ for line in "${fstab_lines[@]}"; do
;;
esac
[ -z "$dev" ] && dwarn "Bad fstab entry $@" && continue
+ if [[ "$3" == btrfs ]]; then
+ for i in $(btrfs_devs "$2"); do
+ push_host_devs "$i"
+ done
+ fi
push_host_devs "$dev"
host_fs_types["$dev"]="$3"
done
@@ -1194,8 +1199,14 @@ if [[ $hostonly ]]; then
_bdev=$(readlink -f "/dev/block/$_dev")
[[ -b $_bdev ]] && _dev=$_bdev
push_host_devs $_dev
- [[ "$mp" == "/" ]] && root_dev="$_dev"
+ [[ "$mp" == "/" ]] && push root_devs "$_dev"
push_host_devs "$_dev"
+ if [[ $(find_mp_fstype "$mp") == btrfs ]]; then
+ for i in $(btrfs_devs "$mp"); do
+ [[ "$mp" == "/" ]] && push root_devs "$i"
+ push_host_devs "$i"
+ done
+ fi
done
if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
@@ -1240,7 +1251,14 @@ if [[ $hostonly ]]; then
[[ "$_o" != *x-initrd.mount* ]] && continue
_dev=$(expand_persistent_dev "$_d")
_dev="$(readlink -f "$_dev")"
- [[ -b $_dev ]] && push_host_devs "$_dev"
+ [[ -b $_dev ]] || continue
+
+ push_host_devs "$_dev"
+ if [[ "$_t" == btrfs ]]; then
+ for i in $(find_btrfs_devs "$_m"); do
+ push_host_devs "$i"
+ done
+ fi
done < /etc/fstab
fi
diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
index bbc68ba..3fbdc41 100755
--- a/modules.d/99base/module-setup.sh
+++ b/modules.d/99base/module-setup.sh
@@ -102,7 +102,9 @@ install() {
. "$moddir/dracut-lib.sh"
for _dev in ${host_devs[@]}; do
- [[ "$_dev" == "$root_dev" ]] && continue
+ for _dev2 in ${root_devs[@]}; do
+ [[ "$_dev" == "$_dev2" ]] && continue 2
+ done
# We only actually wait for real devs - swap is only needed
# for resume and udev rules generated when parsing resume=

View File

@ -1,155 +0,0 @@
From 5a66d51102bc3522d46c60d8bd8e5d6837420063 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 9 Jul 2015 14:13:44 +0200
Subject: [PATCH] dracut.sh: remove push()
can be done with var+=(val)
---
dracut.sh | 77 +++++++++++++++++++++++----------------------------------------
1 file changed, 28 insertions(+), 49 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index bf1886f..f7609fa 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -209,30 +209,13 @@ For example:
EOF
}
-# function push()
-# push values to a stack
-# $1 = stack variable
-# $2.. values
-# example:
-# push stack 1 2 "3 4"
-push() {
- local _i
- local __stack=$1; shift
- for _i in "$@"; do
- eval ${__stack}'[${#'${__stack}'[@]}]="$_i"'
- done
-}
-
# Fills up host_devs stack variable and makes sure there are no duplicates
push_host_devs() {
local _dev
- for _dev in ${host_devs[@]}; do
- [ "$_dev" = "$1" ] && return
- done
- push host_devs "$1"
+ [[ " ${host_devs[@]} " == *" $1 "* ]] && return
+ host_devs+=( "$1" )
}
-
# function pop()
# pops the last value from a stack
# assigns value to second argument variable
@@ -486,28 +469,25 @@ while :; do
PARMS_TO_STORE+=" $1";
fi
case $1 in
- --kver) kernel="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- -a|--add) push add_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- --force-add) push force_add_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- --add-drivers) push add_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- --force-drivers) push force_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- --omit-drivers) push omit_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- -m|--modules) push dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- -o|--omit) push omit_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- -d|--drivers) push drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- --filesystems) push filesystems_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- -I|--install) push install_items_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- --install-optional)
- push install_optional_items_l \
- "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- --fwdir) push fw_dir_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- --libdirs) push libdirs_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- --fscks) push fscks_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- --add-fstab) push add_fstab_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- --mount) push fstab_lines "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- --add-device|--device)
- push add_device_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
- --kernel-cmdline) push kernel_cmdline_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
+ --kver) kernel="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
+ -a|--add) add_dracutmodules_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ --force-add) force_add_dracutmodules_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ --add-drivers) add_drivers_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ --force-drivers) force_drivers_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ --omit-drivers) omit_drivers_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ -m|--modules) dracutmodules_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ -o|--omit) omit_dracutmodules_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ -d|--drivers) drivers_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ --filesystems) filesystems_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ -I|--install) install_items_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ --install-optional) install_optional_items_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ --fwdir) fw_dir_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ --libdirs) libdirs_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ --fscks) fscks_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ --add-fstab) add_fstab_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ --mount) fstab_lines+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ --add-device|--device) add_device_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
+ --kernel-cmdline) kernel_cmdline_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
--nofscks) nofscks_l="yes";;
--ro-mnt) ro_mnt_l="yes";;
-k|--kmoddir) drivers_dir_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
@@ -566,7 +546,7 @@ while :; do
persistent_policy_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--fstab) use_fstab_l="yes" ;;
-h|--help) long_usage; exit 1 ;;
- -i|--include) push include_src "$2"; PARMS_TO_STORE+=" '$2'";
+ -i|--include) include_src+=("$2"); PARMS_TO_STORE+=" '$2'";
shift;;
--bzip2) compress_l="bzip2";;
--lzma) compress_l="lzma";;
@@ -602,8 +582,8 @@ done
while (($# > 0)); do
if [ "${1%%=*}" == "++include" ]; then
- push include_src "$2"
- push include_target "$3"
+ include_src+=("$2")
+ include_target+=("$3")
PARMS_TO_STORE+=" --include '$2' '$3'"
shift 2
fi
@@ -746,7 +726,7 @@ fi
if (( ${#fstab_lines_l[@]} )); then
while pop fstab_lines_l val; do
- push fstab_lines $val
+ fstab_lines+=($val)
done
fi
@@ -1199,11 +1179,11 @@ if [[ $hostonly ]]; then
_bdev=$(readlink -f "/dev/block/$_dev")
[[ -b $_bdev ]] && _dev=$_bdev
push_host_devs $_dev
- [[ "$mp" == "/" ]] && push root_devs "$_dev"
+ [[ "$mp" == "/" ]] && root_devs+=("$_dev")
push_host_devs "$_dev"
if [[ $(find_mp_fstype "$mp") == btrfs ]]; then
for i in $(btrfs_devs "$mp"); do
- [[ "$mp" == "/" ]] && push root_devs "$i"
+ [[ "$mp" == "/" ]] && root_devs+=("$i")
push_host_devs "$i"
done
fi
@@ -1237,7 +1217,7 @@ if [[ $hostonly ]]; then
_dev="$(readlink -f "$dev")"
push_host_devs "$_dev"
- push swap_devs "$_dev"
+ swap_devs+=("$_dev")
break
done < /etc/fstab
done < /proc/swaps
@@ -1262,7 +1242,6 @@ if [[ $hostonly ]]; then
done < /etc/fstab
fi
-
# record all host modaliases
declare -A host_modalias
find /sys/devices/ -name uevent -print > "$initdir/.modalias"

View File

@ -1,68 +0,0 @@
From e833e26137b48063df59e777fe64e495ec538d0f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 9 Jul 2015 14:31:26 +0200
Subject: [PATCH] dracut.conf: remove example parameters
---
dracut.conf | 54 +++---------------------------------------------------
1 file changed, 3 insertions(+), 51 deletions(-)
diff --git a/dracut.conf b/dracut.conf
index 8533f99..d6317a0 100644
--- a/dracut.conf
+++ b/dracut.conf
@@ -1,51 +1,3 @@
-# PUT YOUR CONFIG HERE OR IN separate files named *.conf
-# in /etc/dracut.conf.d
-# SEE man dracut.conf(5)
-
-# Sample dracut config file
-
-#logfile=/var/log/dracut.log
-#fileloglvl=6
-
-# Exact list of dracut modules to use. Modules not listed here are not going
-# to be included. If you only want to add some optional modules use
-# add_dracutmodules option instead.
-#dracutmodules+=""
-
-# dracut modules to omit
-#omit_dracutmodules+=""
-
-# dracut modules to add to the default
-#add_dracutmodules+=""
-
-# additional kernel modules to the default
-#add_drivers+=""
-
-# list of kernel filesystem modules to be included in the generic initramfs
-#filesystems+=""
-
-# build initrd only to boot current hardware
-#hostonly="yes"
-#
-
-# install local /etc/mdadm.conf
-#mdadmconf="no"
-
-# install local /etc/lvm/lvm.conf
-#lvmconf="no"
-
-# A list of fsck tools to install. If it's not specified, module's hardcoded
-# default is used, currently: "umount mount /sbin/fsck* xfs_db xfs_check
-# xfs_repair e2fsck jfs_fsck reiserfsck btrfsck". The installation is
-# opportunistic, so non-existing tools are just ignored.
-#fscks=""
-
-# inhibit installation of any fsck tools
-#nofscks="yes"
-
-# mount / and /usr read-only by default
-#ro_mnt="no"
-
-# set the directory for temporary files
-# default: /var/tmp
-#tmpdir=/tmp
+# PUT YOUR CONFIG IN separate files
+# in /etc/dracut.conf.d named "<name>.conf"
+# SEE man dracut.conf(5) for options

View File

@ -1,224 +0,0 @@
From 694725abf0d4956bb07b5f96b7887a75e0f430df Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 9 Jul 2015 14:33:24 +0200
Subject: [PATCH] dracut.sh: remove pop()
---
dracut.sh | 119 ++++++++++++++------------------------------------------------
1 file changed, 27 insertions(+), 92 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index f7609fa..54358f3 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -212,35 +212,10 @@ EOF
# Fills up host_devs stack variable and makes sure there are no duplicates
push_host_devs() {
local _dev
- [[ " ${host_devs[@]} " == *" $1 "* ]] && return
- host_devs+=( "$1" )
-}
-
-# function pop()
-# pops the last value from a stack
-# assigns value to second argument variable
-# or echo to stdout, if no second argument
-# $1 = stack variable
-# $2 = optional variable to store the value
-# example:
-# pop stack val
-# val=$(pop stack)
-pop() {
- local __stack=$1; shift
- local __resultvar=$1
- local _value;
- # check for empty stack
- eval '[[ ${#'${__stack}'[@]} -eq 0 ]] && return 1'
-
- eval _value='${'${__stack}'[${#'${__stack}'[@]}-1]}'
-
- if [[ "$__resultvar" ]]; then
- eval $__resultvar="'$_value'"
- else
- printf "%s" "$_value"
- fi
- eval unset ${__stack}'[${#'${__stack}'[@]}-1]'
- return 0
+ for _dev in "$@"; do
+ [[ " ${host_devs[@]} " == *" $_dev "* ]] && return
+ host_devs+=( "$_dev" )
+ done
}
# Little helper function for reading args from the commandline.
@@ -701,81 +676,52 @@ unset NPATH
# these optins add to the stuff in the config file
if (( ${#add_dracutmodules_l[@]} )); then
- while pop add_dracutmodules_l val; do
- add_dracutmodules+=" $val "
- done
+ add_dracutmodules+=" ${add_dracutmodules_l[@]} "
fi
if (( ${#force_add_dracutmodules_l[@]} )); then
- while pop force_add_dracutmodules_l val; do
- force_add_dracutmodules+=" $val "
- done
+ force_add_dracutmodules+=" ${force_add_dracutmodules_l[@]} "
fi
if (( ${#fscks_l[@]} )); then
- while pop fscks_l val; do
- fscks+=" $val "
- done
+ fscks+=" ${fscks_l[@]} "
fi
if (( ${#add_fstab_l[@]} )); then
- while pop add_fstab_l val; do
- add_fstab+=" $val "
- done
+ add_fstab+=" ${add_fstab_l[@]} "
fi
if (( ${#fstab_lines_l[@]} )); then
- while pop fstab_lines_l val; do
- fstab_lines+=($val)
- done
+ fstab_lines+=( "${fstab_lines_l[@]}" )
fi
if (( ${#install_items_l[@]} )); then
- while pop install_items_l val; do
- install_items+=" $val "
- done
+ install_items+=" ${install_items_l[@]} "
fi
if (( ${#install_optional_items_l[@]} )); then
- while pop install_optional_items_l val; do
- install_optional_items+=" $val "
- done
+ install_optional_items+=" ${install_optional_items_l[@]} "
fi
# these options override the stuff in the config file
if (( ${#dracutmodules_l[@]} )); then
- dracutmodules=''
- while pop dracutmodules_l val; do
- dracutmodules+="$val "
- done
+ dracutmodules="${dracutmodules_l[@]}"
fi
if (( ${#omit_dracutmodules_l[@]} )); then
- omit_dracutmodules=''
- while pop omit_dracutmodules_l val; do
- omit_dracutmodules+="$val "
- done
+ omit_dracutmodules="${omit_dracutmodules_l[@]}"
fi
if (( ${#filesystems_l[@]} )); then
- filesystems=''
- while pop filesystems_l val; do
- filesystems+="$val "
- done
+ filesystems="${filesystems_l[@]}"
fi
if (( ${#fw_dir_l[@]} )); then
- fw_dir=''
- while pop fw_dir_l val; do
- fw_dir+="$val "
- done
+ fw_dir="${fw_dir_l[@]}"
fi
if (( ${#libdirs_l[@]} )); then
- libdirs=''
- while pop libdirs_l val; do
- libdirs+="$val "
- done
+ libdirs="${libdirs_l[@]}"
fi
[[ $stdloglvl_l ]] && stdloglvl=$stdloglvl_l
@@ -925,38 +871,27 @@ dracutfunctions=$dracutbasedir/dracut-functions.sh
export dracutfunctions
if (( ${#drivers_l[@]} )); then
- drivers=''
- while pop drivers_l val; do
- drivers+="$val "
- done
+ drivers="${drivers_l[@]}"
fi
drivers=${drivers/-/_}
if (( ${#add_drivers_l[@]} )); then
- while pop add_drivers_l val; do
- add_drivers+=" $val "
- done
+ add_drivers+=" ${add_drivers_l[@]} "
fi
add_drivers=${add_drivers/-/_}
if (( ${#force_drivers_l[@]} )); then
- while pop force_drivers_l val; do
- force_drivers+=" $val "
- done
+ force_drivers+=" ${force_drivers_l[@]} "
fi
force_drivers=${force_drivers/-/_}
if (( ${#omit_drivers_l[@]} )); then
- while pop omit_drivers_l val; do
- omit_drivers+=" $val "
- done
+ omit_drivers+=" ${omit_drivers_l[@]} "
fi
omit_drivers=${omit_drivers/-/_}
if (( ${#kernel_cmdline_l[@]} )); then
- while pop kernel_cmdline_l val; do
- kernel_cmdline+=" $val "
- done
+ kernel_cmdline+=" ${kernel_cmdline_l[@]} "
fi
omit_drivers_corrected=""
@@ -1147,10 +1082,8 @@ for dev in $add_device; do
done
if (( ${#add_device_l[@]} )); then
- while pop add_device_l val; do
- add_device+=" $val "
- push_host_devs "$val"
- done
+ add_device+=" ${add_device_l[@]} "
+ push_host_devs "${add_device_l[@]}"
fi
if [[ $hostonly ]]; then
@@ -1527,7 +1460,7 @@ if [[ $kernel_only != yes ]]; then
[[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
- while pop fstab_lines line; do
+ for line in "${fstab_lines[@]}"; do
line=($line)
[ -z "${line[3]}" ] && line[3]="defaults"
[ -z "${line[4]}" ] && line[4]="0"
@@ -1566,7 +1499,9 @@ if [[ $kernel_only != yes ]]; then
done
fi
-while pop include_src src && pop include_target target; do
+for ((i=0; i < ${#include_src[@]}; i++)); do
+ src="${include_src[$i]}"
+ target="${include_target[$i]}"
if [[ $src && $target ]]; then
if [[ -f $src ]]; then
inst $src $target

View File

@ -1,182 +0,0 @@
From 3721635b2c5df033fca1e19181d7598e075f5308 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 9 Jul 2015 15:27:44 +0200
Subject: [PATCH] guard ${arrays[@]} with ""
---
dracut-functions.sh | 8 ++++----
dracut.sh | 6 +++---
lsinitrd.sh | 2 +-
modules.d/90btrfs/module-setup.sh | 2 +-
modules.d/90kernel-modules/module-setup.sh | 2 +-
modules.d/95cifs/module-setup.sh | 2 +-
modules.d/95nfs/module-setup.sh | 2 +-
modules.d/95virtfs/module-setup.sh | 2 +-
modules.d/99base/module-setup.sh | 6 +++---
9 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 639c5ae..3a0a5a2 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -596,7 +596,7 @@ for_each_host_dev_fs()
local _dev
local _ret=1
- [[ "${!host_fs_types[@]}" ]] || return 0
+ [[ "${#host_fs_types[@]}" ]] || return 0
for _dev in "${!host_fs_types[@]}"; do
$_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
@@ -657,7 +657,7 @@ for_each_host_dev_and_slaves_all()
[[ "${host_devs[@]}" ]] || return 0
- for _dev in ${host_devs[@]}; do
+ for _dev in "${host_devs[@]}"; do
[[ -b "$_dev" ]] || continue
if check_block_and_slaves_all $_func $(get_maj_min $_dev); then
_ret=0
@@ -673,7 +673,7 @@ for_each_host_dev_and_slaves()
[[ "${host_devs[@]}" ]] || return 0
- for _dev in ${host_devs[@]}; do
+ for _dev in "${host_devs[@]}"; do
[[ -b "$_dev" ]] || continue
check_block_and_slaves $_func $(get_maj_min $_dev) && return 0
done
@@ -1276,7 +1276,7 @@ check_mount() {
local _ret
local _moddep
- [ "${#host_fs_types[*]}" -le 0 ] && return 1
+ [ "${#host_fs_types[@]}" -le 0 ] && return 1
# If we are already scheduled to be loaded, no need to check again.
[[ " $mods_to_load " == *\ $_mod\ * ]] && return 0
diff --git a/dracut.sh b/dracut.sh
index 54358f3..fc84a41 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1220,7 +1220,7 @@ _get_fs_type() {
return 1
}
-for dev in ${host_devs[@]}; do
+for dev in "${host_devs[@]}"; do
_get_fs_type "$dev"
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
done
@@ -1455,8 +1455,8 @@ if [[ $no_kernel != yes ]]; then
fi
if [[ $kernel_only != yes ]]; then
- (( ${#install_items[@]} > 0 )) && inst_multiple ${install_items[@]}
- (( ${#install_optional_items[@]} > 0 )) && inst_multiple -o ${install_optional_items[@]}
+ (( ${#install_items[@]} > 0 )) && inst_multiple "${install_items[@]}"
+ (( ${#install_optional_items[@]} > 0 )) && inst_multiple -o "${install_optional_items[@]}"
[[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
diff --git a/lsinitrd.sh b/lsinitrd.sh
index 94674af..d2ddd76 100755
--- a/lsinitrd.sh
+++ b/lsinitrd.sh
@@ -117,7 +117,7 @@ dracutlibdirs() {
extract_files()
{
(( ${#filenames[@]} == 1 )) && nofileinfo=1
- for f in ${!filenames[@]}; do
+ for f in "${!filenames[@]}"; do
[[ $nofileinfo ]] || echo "initramfs:/$f"
[[ $nofileinfo ]] || echo "========================================================================"
$CAT $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
diff --git a/modules.d/90btrfs/module-setup.sh b/modules.d/90btrfs/module-setup.sh
index 0771132..9303dbe 100755
--- a/modules.d/90btrfs/module-setup.sh
+++ b/modules.d/90btrfs/module-setup.sh
@@ -8,7 +8,7 @@ check() {
require_binaries btrfs || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && {
- for fs in ${host_fs_types[@]}; do
+ for fs in "${host_fs_types[@]}"; do
[[ "$fs" == "btrfs" ]] && return 0
done
return 255
diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh
index 40803df..41bf37d 100755
--- a/modules.d/90kernel-modules/module-setup.sh
+++ b/modules.d/90kernel-modules/module-setup.sh
@@ -74,7 +74,7 @@ installkernel() {
instmods '=fs'
fi
else
- for i in $(host_fs_all); do
+ for i in "${host_fs_types[@]}"; do
hostonly='' instmods $i
done
fi
diff --git a/modules.d/95cifs/module-setup.sh b/modules.d/95cifs/module-setup.sh
index 0e69845..f711458 100755
--- a/modules.d/95cifs/module-setup.sh
+++ b/modules.d/95cifs/module-setup.sh
@@ -6,7 +6,7 @@ check() {
require_binaries mount.cifs || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && {
- for fs in ${host_fs_types[@]}; do
+ for fs in "${host_fs_types[@]}"; do
[[ "$fs" == "cifs" ]] && return 0
done
return 255
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index 8eb542c..9b5b8c8 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -7,7 +7,7 @@ check() {
require_binaries rpc.statd mount.nfs mount.nfs4 umount || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && {
- for fs in ${host_fs_types[@]}; do
+ for fs in "${host_fs_types[@]}"; do
[[ "$fs" == "nfs" ]] && return 0
[[ "$fs" == "nfs3" ]] && return 0
[[ "$fs" == "nfs4" ]] && return 0
diff --git a/modules.d/95virtfs/module-setup.sh b/modules.d/95virtfs/module-setup.sh
index 97d39b9..96036ee 100755
--- a/modules.d/95virtfs/module-setup.sh
+++ b/modules.d/95virtfs/module-setup.sh
@@ -3,7 +3,7 @@
# called by dracut
check() {
[[ $hostonly ]] || [[ $mount_needs ]] && {
- for fs in ${host_fs_types[@]}; do
+ for fs in "${host_fs_types[@]}"; do
[[ "$fs" == "9p" ]] && return 0
done
return 255
diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
index 3fbdc41..cc94d00 100755
--- a/modules.d/99base/module-setup.sh
+++ b/modules.d/99base/module-setup.sh
@@ -101,15 +101,15 @@ install() {
. "$moddir/dracut-lib.sh"
- for _dev in ${host_devs[@]}; do
- for _dev2 in ${root_devs[@]}; do
+ for _dev in "${host_devs[@]}"; do
+ for _dev2 in "${root_devs[@]}"; do
[[ "$_dev" == "$_dev2" ]] && continue 2
done
# We only actually wait for real devs - swap is only needed
# for resume and udev rules generated when parsing resume=
# argument take care of the waiting for us
- for _dev2 in ${swap_devs[@]}; do
+ for _dev2 in "${swap_devs[@]}"; do
[[ "$_dev" == "$_dev2" ]] && continue 2
done

View File

@ -1,139 +0,0 @@
From 32de4eb5d30b728c2fb42f802e5104095a4bc74c Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 9 Jul 2015 15:34:47 +0200
Subject: [PATCH] dracut-functions.sh: simplify some for loops
continue early, if condition is not met
---
dracut-functions.sh | 73 +++++++++++++++++++++++------------------------------
1 file changed, 32 insertions(+), 41 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 3a0a5a2..d559903 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -937,26 +937,23 @@ inst_rules() {
for _rule in "$@"; do
if [ "${_rule#/}" = "$_rule" ]; then
for r in ${udevdir}/rules.d ${hostonly:+/etc/udev/rules.d}; do
- if [[ -e $r/$_rule ]]; then
- _found="$r/$_rule"
- inst_rule_programs "$_found"
- inst_rule_group_owner "$_found"
- inst_rule_initqueue "$_found"
- inst_simple "$_found"
- fi
+ [[ -e $r/$_rule ]] || continue
+ _found="$r/$_rule"
+ inst_rule_programs "$_found"
+ inst_rule_group_owner "$_found"
+ inst_rule_initqueue "$_found"
+ inst_simple "$_found"
done
fi
for r in '' $dracutbasedir/rules.d/; do
# skip rules without an absolute path
[[ "${r}$_rule" != /* ]] && continue
-
- if [[ -f ${r}$_rule ]]; then
- _found="${r}$_rule"
- inst_rule_programs "$_found"
- inst_rule_group_owner "$_found"
- inst_rule_initqueue "$_found"
- inst_simple "$_found" "$_target/${_found##*/}"
- fi
+ [[ -f ${r}$_rule ]] || continue
+ _found="${r}$_rule"
+ inst_rule_programs "$_found"
+ inst_rule_group_owner "$_found"
+ inst_rule_initqueue "$_found"
+ inst_simple "$_found" "$_target/${_found##*/}"
done
[[ $_found ]] || dinfo "Skipping udev rule: $_rule"
done
@@ -968,23 +965,21 @@ inst_rules_wildcard() {
inst_dir "${udevdir}/rules.d"
inst_dir "$_target"
for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1 ; do
- if [[ -e $_rule ]]; then
+ [[ -e $_rule ]] || continue
+ inst_rule_programs "$_rule"
+ inst_rule_group_owner "$_rule"
+ inst_rule_initqueue "$_rule"
+ inst_simple "$_rule"
+ _found=$_rule
+ done
+ if [[ -n ${hostonly} ]] ; then
+ for _rule in ${_target}/$1 ; do
+ [[ -f $_rule ]] || continue
inst_rule_programs "$_rule"
inst_rule_group_owner "$_rule"
inst_rule_initqueue "$_rule"
inst_simple "$_rule"
_found=$_rule
- fi
- done
- if [[ -n ${hostonly} ]] ; then
- for _rule in ${_target}/$1 ; do
- if [[ -f $_rule ]]; then
- inst_rule_programs "$_rule"
- inst_rule_group_owner "$_rule"
- inst_rule_initqueue "$_rule"
- inst_simple "$_rule"
- _found=$_rule
- fi
done
fi
[[ $_found ]] || dinfo "Skipping udev rule: $_rule"
@@ -1051,10 +1046,9 @@ inst_any() {
[[ $1 = '-d' ]] && to="$2" && shift 2
for f in "$@"; do
- if [[ -e $f ]]; then
- [[ $to ]] && inst "$f" "$to" && return 0
- inst "$f" && return 0
- fi
+ [[ -e $f ]] || continue
+ [[ $to ]] && inst "$f" "$to" && return 0
+ inst "$f" && return 0
done
return 1
@@ -1118,8 +1112,7 @@ inst_decompress() {
inst_opt_decompress() {
local _src
- for _src in $@
- do
+ for _src in $@; do
inst_decompress "${_src}" || inst "${_src}"
done
}
@@ -1482,10 +1475,9 @@ install_kmod_with_fw() {
for _fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
_found=''
for _fwdir in $fw_dir; do
- if [[ -d $_fwdir && -f $_fwdir/$_fw ]]; then
- inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
- _found=yes
- fi
+ [[ -d $_fwdir && -f $_fwdir/$_fw ]] || continue
+ inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
+ _found=yes
done
if [[ $_found != yes ]]; then
if ! [[ -d $(echo /sys/module/${_modname//-/_}|{ read a b; echo $a; }) ]]; then
@@ -1557,10 +1549,9 @@ dracut_kernel_post() {
else
for _fw in $(xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"); do
for _fwdir in $fw_dir; do
- if [[ -d $_fwdir && -f $_fwdir/$_fw ]]; then
- inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
- break
- fi
+ [[ -d $_fwdir && -f $_fwdir/$_fw ]] || continue
+ inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
+ break
done
done
fi

View File

@ -1,117 +0,0 @@
From cb0913db0d23bb0880e525e5cb3d7a179b0c7a20 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 9 Jul 2015 18:02:44 +0200
Subject: [PATCH] dracut.sh: reduce code
---
dracut.sh | 80 ++++++++++++++-------------------------------------------------
1 file changed, 18 insertions(+), 62 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index fc84a41..21d29bf 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -674,55 +674,21 @@ done
export PATH="${NPATH#:}"
unset NPATH
-# these optins add to the stuff in the config file
-if (( ${#add_dracutmodules_l[@]} )); then
- add_dracutmodules+=" ${add_dracutmodules_l[@]} "
-fi
-
-if (( ${#force_add_dracutmodules_l[@]} )); then
- force_add_dracutmodules+=" ${force_add_dracutmodules_l[@]} "
-fi
-
-if (( ${#fscks_l[@]} )); then
- fscks+=" ${fscks_l[@]} "
-fi
-
-if (( ${#add_fstab_l[@]} )); then
- add_fstab+=" ${add_fstab_l[@]} "
-fi
-
-if (( ${#fstab_lines_l[@]} )); then
- fstab_lines+=( "${fstab_lines_l[@]}" )
-fi
-
-if (( ${#install_items_l[@]} )); then
- install_items+=" ${install_items_l[@]} "
-fi
-
-if (( ${#install_optional_items_l[@]} )); then
- install_optional_items+=" ${install_optional_items_l[@]} "
-fi
+# these options add to the stuff in the config file
+(( ${#add_dracutmodules_l[@]} )) && add_dracutmodules+=" ${add_dracutmodules_l[@]} "
+(( ${#force_add_dracutmodules_l[@]} )) && force_add_dracutmodules+=" ${force_add_dracutmodules_l[@]} "
+(( ${#fscks_l[@]} )) && fscks+=" ${fscks_l[@]} "
+(( ${#add_fstab_l[@]} )) && add_fstab+=" ${add_fstab_l[@]} "
+(( ${#fstab_lines_l[@]} )) && fstab_lines+=( "${fstab_lines_l[@]}" )
+(( ${#install_items_l[@]} )) && install_items+=" ${install_items_l[@]} "
+(( ${#install_optional_items_l[@]} )) && install_optional_items+=" ${install_optional_items_l[@]} "
# these options override the stuff in the config file
-if (( ${#dracutmodules_l[@]} )); then
- dracutmodules="${dracutmodules_l[@]}"
-fi
-
-if (( ${#omit_dracutmodules_l[@]} )); then
- omit_dracutmodules="${omit_dracutmodules_l[@]}"
-fi
-
-if (( ${#filesystems_l[@]} )); then
- filesystems="${filesystems_l[@]}"
-fi
-
-if (( ${#fw_dir_l[@]} )); then
- fw_dir="${fw_dir_l[@]}"
-fi
-
-if (( ${#libdirs_l[@]} )); then
- libdirs="${libdirs_l[@]}"
-fi
+(( ${#dracutmodules_l[@]} )) && dracutmodules="${dracutmodules_l[@]}"
+(( ${#omit_dracutmodules_l[@]} )) && omit_dracutmodules="${omit_dracutmodules_l[@]}"
+(( ${#filesystems_l[@]} )) && filesystems="${filesystems_l[@]}"
+(( ${#fw_dir_l[@]} )) && fw_dir="${fw_dir_l[@]}"
+(( ${#libdirs_l[@]} ))&& libdirs="${libdirs_l[@]}"
[[ $stdloglvl_l ]] && stdloglvl=$stdloglvl_l
[[ ! $stdloglvl ]] && stdloglvl=4
@@ -870,29 +836,19 @@ fi
dracutfunctions=$dracutbasedir/dracut-functions.sh
export dracutfunctions
-if (( ${#drivers_l[@]} )); then
- drivers="${drivers_l[@]}"
-fi
+(( ${#drivers_l[@]} )) && drivers="${drivers_l[@]}"
drivers=${drivers/-/_}
-if (( ${#add_drivers_l[@]} )); then
- add_drivers+=" ${add_drivers_l[@]} "
-fi
+(( ${#add_drivers_l[@]} )) && add_drivers+=" ${add_drivers_l[@]} "
add_drivers=${add_drivers/-/_}
-if (( ${#force_drivers_l[@]} )); then
- force_drivers+=" ${force_drivers_l[@]} "
-fi
+(( ${#force_drivers_l[@]} )) && force_drivers+=" ${force_drivers_l[@]} "
force_drivers=${force_drivers/-/_}
-if (( ${#omit_drivers_l[@]} )); then
- omit_drivers+=" ${omit_drivers_l[@]} "
-fi
+(( ${#omit_drivers_l[@]} )) && omit_drivers+=" ${omit_drivers_l[@]} "
omit_drivers=${omit_drivers/-/_}
-if (( ${#kernel_cmdline_l[@]} )); then
- kernel_cmdline+=" ${kernel_cmdline_l[@]} "
-fi
+(( ${#kernel_cmdline_l[@]} )) && kernel_cmdline+=" ${kernel_cmdline_l[@]} "
omit_drivers_corrected=""
for d in $omit_drivers; do

View File

@ -1,66 +0,0 @@
From e8f19bcf26304282301c7aa34dff10f51d5f6172 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 9 Jul 2015 18:22:15 +0200
Subject: [PATCH] dracut.sh: remember $0 for --regenerate-all
---
dracut.sh | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 21d29bf..77da887 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -23,6 +23,7 @@
# store for logging
dracut_args=( "$@" )
+readonly dracut_cmd="$(readlink -f $0)"
set -o pipefail
@@ -34,7 +35,7 @@ usage() {
# 80x25 linebreak here ^
cat << EOF
-Usage: $0 [OPTION]... [<initramfs> [<kernel-version>]]
+Usage: $dracut_cmd [OPTION]... [<initramfs> [<kernel-version>]]
Version: $DRACUT_VERSION
@@ -59,7 +60,7 @@ long_usage() {
# 80x25 linebreak here ^
cat << EOF
-Usage: $0 [OPTION]... [<initramfs> [<kernel-version>]]
+Usage: $dracut_cmd [OPTION]... [<initramfs> [<kernel-version>]]
Version: $DRACUT_VERSION
@@ -586,7 +587,7 @@ if [[ $regenerate_all == "yes" ]]; then
cd /lib/modules
for i in *; do
[[ -f $i/modules.dep ]] || [[ -f $i/modules.dep.bin ]] || continue
- dracut --kver="$i" "${dracut_args[@]}"
+ "$dracut_cmd" --kver="$i" "${dracut_args[@]}"
((ret+=$?))
done
exit $ret
@@ -814,7 +815,7 @@ if [[ -f $dracutbasedir/dracut-init.sh ]]; then
else
printf "%s\n" "dracut: Cannot find $dracutbasedir/dracut-init.sh." >&2
printf "%s\n" "dracut: Are you running from a git checkout?" >&2
- printf "%s\n" "dracut: Try passing -l as an argument to $0" >&2
+ printf "%s\n" "dracut: Try passing -l as an argument to $dracut_cmd" >&2
exit 1
fi
@@ -866,7 +867,7 @@ for ((i=0; i < ${#dracut_args[@]}; i++)); do
#" keep vim happy
done
-dinfo "Executing: $0 ${dracut_args[@]}"
+dinfo "Executing: $dracut_cmd ${dracut_args[@]}"
[[ $do_list = yes ]] && {
for mod in $dracutbasedir/modules.d/*; do

View File

@ -1,40 +0,0 @@
From ee44f6297293f895f2e446690a19e7114eff7ae8 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 9 Jul 2015 19:44:30 +0200
Subject: [PATCH] dracut.sh: early check for bash version
---
dracut.sh | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 77da887..b7456dc 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -22,6 +22,13 @@
#
# store for logging
+
+# Verify bash version, current minimum is 4
+if (( BASH_VERSINFO[0] < 4 )); then
+ printf -- 'You need at least Bash 4 to use dracut, sorry.' >&2
+ exit 1
+fi
+
dracut_args=( "$@" )
readonly dracut_cmd="$(readlink -f $0)"
@@ -828,12 +835,6 @@ if ! [[ $print_cmdline ]]; then
rm -fr -- ${initdir}/*
fi
-# Verify bash version, current minimum is 4
-if (( BASH_VERSINFO[0] < 4 )); then
- dfatal 'You need at least Bash 4 to use dracut, sorry.'
- exit 1
-fi
-
dracutfunctions=$dracutbasedir/dracut-functions.sh
export dracutfunctions

View File

@ -1,72 +0,0 @@
From df0bdd5ae9094133afa48b84189822e26d7bfecf Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 13 Jul 2015 10:14:15 +0200
Subject: [PATCH] network: add rd.peerdns=0 parameter
Add rd.peerdns=0 parameter to disable DHCP nameserver setting
---
dracut.cmdline.7.asc | 3 +++
modules.d/40network/dhclient-script.sh | 29 ++++++++++++++++-------------
2 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index 55e6f64..1a54377 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -546,6 +546,9 @@ interface name. Better name it "bootnet" or "bluesocket".
**nameserver=**__<IP>__ [**nameserver=**__<IP>__ ...]::
specify nameserver(s) to use
+**rd.peerdns=0**::
+ Disable DNS setting of DHCP parameters.
+
**biosdevname=0**::
boolean, turn off biosdevname network interface renaming
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
index c75ac89..1d891cd 100755
--- a/modules.d/40network/dhclient-script.sh
+++ b/modules.d/40network/dhclient-script.sh
@@ -54,13 +54,14 @@ setup_interface() {
echo ip route replace default via $gw dev $netif >> /tmp/net.$netif.gw
fi
- [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
- if [ -n "$namesrv" ] ; then
- for s in $namesrv; do
- echo nameserver $s
- done
- fi >> /tmp/net.$netif.resolv.conf
-
+ if getargbool 1 rd.peerdns; then
+ [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
+ if [ -n "$namesrv" ] ; then
+ for s in $namesrv; do
+ echo nameserver $s
+ done
+ fi >> /tmp/net.$netif.resolv.conf
+ fi
# Note: hostname can be fqdn OR short hostname, so chop off any
# trailing domain name and explicity add any domain if set.
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
@@ -83,12 +84,14 @@ setup_interface6() {
${lease_time:+valid_lft $lease_time} \
${preferred_lft:+preferred_lft ${preferred_lft}}
- [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
- if [ -n "$namesrv" ] ; then
- for s in $namesrv; do
- echo nameserver $s
- done
- fi >> /tmp/net.$netif.resolv.conf
+ if getargbool 1 rd.peerdns; then
+ [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
+ if [ -n "$namesrv" ] ; then
+ for s in $namesrv; do
+ echo nameserver $s
+ done
+ fi >> /tmp/net.$netif.resolv.conf
+ fi
# Note: hostname can be fqdn OR short hostname, so chop off any
# trailing domain name and explicity add any domain if set.

View File

@ -1,21 +0,0 @@
From 8c7dc032f816d13d482bccebf2f7e56a81c207fd Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 13 Jul 2015 10:38:16 +0200
Subject: [PATCH] TODO: update
---
TODO | 1 -
1 file changed, 1 deletion(-)
diff --git a/TODO b/TODO
index 4a7d959..55fe13b 100644
--- a/TODO
+++ b/TODO
@@ -7,7 +7,6 @@ Items are ordered in priority.
INITRAMFS TODO
- search domain string
-- peerdns=no
- allow dual stack configuration (IPv4, IPv6) for the same interface
- "bind-mount" kernel drivers in real root for the rescue image,
if the real root does not have any kernel modules for this kernel

View File

@ -1,47 +0,0 @@
From 968280e37053bceab47183e5aa9e7bfb34e73d37 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 13 Jul 2015 10:39:07 +0200
Subject: [PATCH] crypt: skip crypttab entries with the same device
It was only checked, if the name of the crypttab entry matched.
This patch adds checking, if the device matches.
---
modules.d/90crypt/crypt-lib.sh | 6 ++++++
modules.d/90crypt/crypt-run-generator.sh | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/modules.d/90crypt/crypt-lib.sh b/modules.d/90crypt/crypt-lib.sh
index 213003e..2e13da2 100755
--- a/modules.d/90crypt/crypt-lib.sh
+++ b/modules.d/90crypt/crypt-lib.sh
@@ -5,11 +5,17 @@ command -v getarg >/dev/null || . /lib/dracut-lib.sh
# check if the crypttab contains an entry for a LUKS UUID
crypttab_contains() {
local luks="$1"
+ local dev="$2"
local l d rest
if [ -f /etc/crypttab ]; then
while read l d rest || [ -n "$l" ]; do
strstr "${l##luks-}" "${luks##luks-}" && return 0
strstr "$d" "${luks##luks-}" && return 0
+ if [ -n "$dev" ]; then
+ for _dev in "$(devnames $d)"; do
+ [ "$dev" -ef "$_dev" ] && return 0
+ done
+ fi
done < /etc/crypttab
fi
return 1
diff --git a/modules.d/90crypt/crypt-run-generator.sh b/modules.d/90crypt/crypt-run-generator.sh
index 3c5d7b1..5bf60ec 100755
--- a/modules.d/90crypt/crypt-run-generator.sh
+++ b/modules.d/90crypt/crypt-run-generator.sh
@@ -6,7 +6,7 @@ type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
dev=$1
luks=$2
-crypttab_contains "$luks" && exit 0
+crypttab_contains "$luks" "$dev" && exit 0
allowdiscards="-"

View File

@ -1,51 +0,0 @@
From e47907cc6b6eead2ab5ef4d5015445668822612a Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 13 Jul 2015 10:51:47 +0200
Subject: [PATCH] dracut-systemd/dracut-initqueue: only start service if really
needed
Only start the dracut-initqueue.service, if the dracut_need_initqueue
command was issued on creation or later on set.
---
modules.d/90lvm/module-setup.sh | 2 ++
modules.d/90mdraid/module-setup.sh | 1 +
modules.d/98dracut-systemd/dracut-initqueue.service | 5 -----
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index 8269078..42dda57 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -140,4 +140,6 @@ install() {
cache_dump cache_restore cache_check cache_repair \
era_check era_dump era_invalidate era_restore
fi
+
+ dracut_need_initqueue
}
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index 621d0fb..cecf3bf 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -132,4 +132,5 @@ install() {
fi
fi
inst_hook pre-shutdown 30 "$moddir/mdmon-pre-shutdown.sh"
+ dracut_need_initqueue
}
diff --git a/modules.d/98dracut-systemd/dracut-initqueue.service b/modules.d/98dracut-systemd/dracut-initqueue.service
index 5d772f7..fa5ca56 100644
--- a/modules.d/98dracut-systemd/dracut-initqueue.service
+++ b/modules.d/98dracut-systemd/dracut-initqueue.service
@@ -17,11 +17,6 @@ After=systemd-udev-trigger.service
Wants=systemd-udev-trigger.service
ConditionPathExists=/usr/lib/initrd-release
ConditionPathExists=|/lib/dracut/need-initqueue
-ConditionPathExistsGlob=|/lib/dracut/hooks/initqueue/*.sh
-ConditionPathExistsGlob=|/lib/dracut/hooks/initqueue/settled/*.sh
-ConditionPathExistsGlob=|/lib/dracut/hooks/initqueue/finished/*.sh
-ConditionPathExistsGlob=|/lib/dracut/hooks/initqueue/online/*.sh
-ConditionPathExistsGlob=|/lib/dracut/hooks/initqueue/timeout/*.sh
ConditionKernelCommandLine=|rd.break=initqueue
[Service]

View File

@ -1,271 +0,0 @@
From 5899f2f5163de4d68fbb35831e1f2230c22c71b3 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Tue, 14 Jul 2015 22:22:14 -0400
Subject: [PATCH] Replace echo -n with printf in code with a /bin/sh shebang
POSIX does not mandate that echo support the -n parameter.
printf has more well-defined behavior.
---
modules.d/04watchdog/watchdog-stop.sh | 2 +-
modules.d/40network/net-lib.sh | 2 +-
modules.d/45ifcfg/write-ifcfg.sh | 2 +-
modules.d/90lvm/lvm_scan.sh | 4 ++--
modules.d/95fcoe/fcoe-up.sh | 2 +-
modules.d/98usrmount/mount-usr.sh | 2 +-
modules.d/99base/dracut-lib.sh | 6 +++---
modules.d/99base/init.sh | 2 +-
test/TEST-10-RAID/create-root.sh | 2 +-
test/TEST-10-RAID/cryptroot-ask.sh | 2 +-
test/TEST-12-RAID-DEG/create-root.sh | 2 +-
test/TEST-12-RAID-DEG/cryptroot-ask.sh | 2 +-
test/TEST-13-ENC-RAID-LVM/create-root.sh | 2 +-
test/TEST-13-ENC-RAID-LVM/cryptroot-ask.sh | 2 +-
test/TEST-14-IMSM/cryptroot-ask.sh | 2 +-
test/TEST-20-NFS/client-init.sh | 2 +-
test/TEST-40-NBD/create-root.sh | 2 +-
test/TEST-40-NBD/cryptroot-ask.sh | 2 +-
18 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/modules.d/04watchdog/watchdog-stop.sh b/modules.d/04watchdog/watchdog-stop.sh
index 91d45d6..921f969 100755
--- a/modules.d/04watchdog/watchdog-stop.sh
+++ b/modules.d/04watchdog/watchdog-stop.sh
@@ -1,2 +1,2 @@
#!/bin/sh
-[ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog
+[ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index a09cdaf..6c739e8 100755
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -189,7 +189,7 @@ set_ifname() {
fix_bootif() {
local macaddr=${1}
local IFS='-'
- macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
+ macaddr=$(printf '%s:' ${macaddr})
macaddr=${macaddr%:}
# strip hardware type field from pxelinux
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
index fa7db27..251d684 100755
--- a/modules.d/45ifcfg/write-ifcfg.sh
+++ b/modules.d/45ifcfg/write-ifcfg.sh
@@ -48,7 +48,7 @@ print_s390() {
for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
[ -e $i ] || continue
channel=$(readlink -f $i)
- echo -n "${channel##*/},"
+ printf '%s' "${channel##*/},"
done
})
[ -n "$SUBCHANNELS" ] || return 1
diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh
index 7495644..ead28aa 100755
--- a/modules.d/90lvm/lvm_scan.sh
+++ b/modules.d/90lvm/lvm_scan.sh
@@ -15,14 +15,14 @@ SNAPSIZE=$(getargs rd.lvm.snapsize -d rd_LVM_SNAPSIZE=)
lvmdevs=$(
for f in /tmp/.lvm_scan-*; do
[ -e "$f" ] || continue
- echo -n "${f##/tmp/.lvm_scan-} "
+ printf '%s' "${f##/tmp/.lvm_scan-} "
done
)
if [ ! -e /etc/lvm/lvm.conf ]; then
{
echo 'devices {';
- echo -n ' filter = [ '
+ printf ' filter = [ '
for dev in $lvmdevs; do
printf '"a|^/dev/%s$|", ' $dev;
done;
diff --git a/modules.d/95fcoe/fcoe-up.sh b/modules.d/95fcoe/fcoe-up.sh
index 43a0ad5..950e4b6 100755
--- a/modules.d/95fcoe/fcoe-up.sh
+++ b/modules.d/95fcoe/fcoe-up.sh
@@ -64,7 +64,7 @@ elif [ "$netdriver" = "bnx2x" ]; then
sleep 3
fipvlan "$netif" -c -s
else
- echo -n "$netif" > /sys/module/fcoe/parameters/create
+ printf '%s' "$netif" > /sys/module/fcoe/parameters/create
fi
need_shutdown
diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh
index c29610f..d1a629c 100755
--- a/modules.d/98usrmount/mount-usr.sh
+++ b/modules.d/98usrmount/mount-usr.sh
@@ -12,7 +12,7 @@ filtersubvol() {
while [ $# -gt 0 ]; do
case $1 in
subvol\=*) :;;
- *) echo -n "${1}," ;;
+ *) printf '%s' "${1}," ;;
esac
shift
done
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index cd1f49f..5ec7b23 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -298,7 +298,7 @@ _dogetargs() {
fi
done
if [ -n "$_found" ]; then
- [ $# -gt 0 ] && echo -n "$@"
+ [ $# -gt 0 ] && printf '%s' "$*"
return 0
fi
return 1;
@@ -329,9 +329,9 @@ getargs() {
done
if [ -n "$_gfound" ]; then
if [ $# -gt 0 ]; then
- echo -n "$@"
+ printf '%s' "$*"
else
- echo -n 1
+ printf 1
fi
debug_on
return 0
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index f96dbb5..a59e8ea 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -253,7 +253,7 @@ while :; do
done
{
- echo -n "Mounted root filesystem "
+ printf "Mounted root filesystem "
while read dev mp rest || [ -n "$dev" ]; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
} | vinfo
diff --git a/test/TEST-10-RAID/create-root.sh b/test/TEST-10-RAID/create-root.sh
index a7e56a5..7b5f2a7 100755
--- a/test/TEST-10-RAID/create-root.sh
+++ b/test/TEST-10-RAID/create-root.sh
@@ -18,7 +18,7 @@ mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sda2 /d
# randomly.
mdadm -W /dev/md0
set -e
-echo -n test >keyfile
+printf test >keyfile
cryptsetup -q luksFormat /dev/md0 /keyfile
echo "The passphrase is test"
cryptsetup luksOpen /dev/md0 dracut_crypt_test </keyfile
diff --git a/test/TEST-10-RAID/cryptroot-ask.sh b/test/TEST-10-RAID/cryptroot-ask.sh
index 407d067..c39eff6 100755
--- a/test/TEST-10-RAID/cryptroot-ask.sh
+++ b/test/TEST-10-RAID/cryptroot-ask.sh
@@ -1,5 +1,5 @@
#!/bin/sh
[ -b "/dev/mapper/$2" ] && exit 0
-echo -n test >/keyfile
+printf test >/keyfile
/sbin/cryptsetup luksOpen "$1" "$2" </keyfile
diff --git a/test/TEST-12-RAID-DEG/create-root.sh b/test/TEST-12-RAID-DEG/create-root.sh
index 7b9a171..3299aa6 100755
--- a/test/TEST-12-RAID-DEG/create-root.sh
+++ b/test/TEST-12-RAID-DEG/create-root.sh
@@ -20,7 +20,7 @@ mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sdb /de
# wait for the array to finish initailizing, otherwise this sometimes fails
# randomly.
mdadm -W /dev/md0
-echo -n test >keyfile
+printf test >keyfile
cryptsetup -q luksFormat /dev/md0 /keyfile
echo "The passphrase is test"
set -e
diff --git a/test/TEST-12-RAID-DEG/cryptroot-ask.sh b/test/TEST-12-RAID-DEG/cryptroot-ask.sh
index db27c5b..78ed7f5 100755
--- a/test/TEST-12-RAID-DEG/cryptroot-ask.sh
+++ b/test/TEST-12-RAID-DEG/cryptroot-ask.sh
@@ -1,6 +1,6 @@
#!/bin/sh
[ -b /dev/mapper/$2 ] && exit 0
-echo -n test >/keyfile
+printf test >/keyfile
/sbin/cryptsetup luksOpen $1 $2 </keyfile
diff --git a/test/TEST-13-ENC-RAID-LVM/create-root.sh b/test/TEST-13-ENC-RAID-LVM/create-root.sh
index e74fe7f..72bc765 100755
--- a/test/TEST-13-ENC-RAID-LVM/create-root.sh
+++ b/test/TEST-13-ENC-RAID-LVM/create-root.sh
@@ -14,7 +14,7 @@ sfdisk /dev/sda <<EOF
,25M
EOF
udevadm settle
-echo -n test >keyfile
+printf test >keyfile
cryptsetup -q luksFormat /dev/sda2 /keyfile
cryptsetup -q luksFormat /dev/sda3 /keyfile
cryptsetup -q luksFormat /dev/sda4 /keyfile
diff --git a/test/TEST-13-ENC-RAID-LVM/cryptroot-ask.sh b/test/TEST-13-ENC-RAID-LVM/cryptroot-ask.sh
index db27c5b..78ed7f5 100755
--- a/test/TEST-13-ENC-RAID-LVM/cryptroot-ask.sh
+++ b/test/TEST-13-ENC-RAID-LVM/cryptroot-ask.sh
@@ -1,6 +1,6 @@
#!/bin/sh
[ -b /dev/mapper/$2 ] && exit 0
-echo -n test >/keyfile
+printf test >/keyfile
/sbin/cryptsetup luksOpen $1 $2 </keyfile
diff --git a/test/TEST-14-IMSM/cryptroot-ask.sh b/test/TEST-14-IMSM/cryptroot-ask.sh
index db27c5b..78ed7f5 100755
--- a/test/TEST-14-IMSM/cryptroot-ask.sh
+++ b/test/TEST-14-IMSM/cryptroot-ask.sh
@@ -1,6 +1,6 @@
#!/bin/sh
[ -b /dev/mapper/$2 ] && exit 0
-echo -n test >/keyfile
+printf test >/keyfile
/sbin/cryptsetup luksOpen $1 $2 </keyfile
diff --git a/test/TEST-20-NFS/client-init.sh b/test/TEST-20-NFS/client-init.sh
index 2311981..a443289 100755
--- a/test/TEST-20-NFS/client-init.sh
+++ b/test/TEST-20-NFS/client-init.sh
@@ -8,7 +8,7 @@ strstr() { [ "${1##*"$2"*}" != "$1" ]; }
stty sane
if strstr "$CMDLINE" "rd.shell"; then
- [ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog
+ [ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
strstr "$(setsid --help)" "control" && CTTY="-c"
setsid $CTTY sh -i
fi
diff --git a/test/TEST-40-NBD/create-root.sh b/test/TEST-40-NBD/create-root.sh
index 391279e..20d0eff 100755
--- a/test/TEST-40-NBD/create-root.sh
+++ b/test/TEST-40-NBD/create-root.sh
@@ -5,7 +5,7 @@ for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
-echo -n test >keyfile
+printf test >keyfile
cryptsetup -q luksFormat /dev/sdb /keyfile
echo "The passphrase is test"
cryptsetup luksOpen /dev/sdb dracut_crypt_test </keyfile && \
diff --git a/test/TEST-40-NBD/cryptroot-ask.sh b/test/TEST-40-NBD/cryptroot-ask.sh
index db27c5b..78ed7f5 100755
--- a/test/TEST-40-NBD/cryptroot-ask.sh
+++ b/test/TEST-40-NBD/cryptroot-ask.sh
@@ -1,6 +1,6 @@
#!/bin/sh
[ -b /dev/mapper/$2 ] && exit 0
-echo -n test >/keyfile
+printf test >/keyfile
/sbin/cryptsetup luksOpen $1 $2 </keyfile

View File

@ -1,23 +0,0 @@
From 24f32511fc8ae616aa967446ce33ab0a7fc27077 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Tue, 14 Jul 2015 11:12:16 -0400
Subject: [PATCH] syncheck: Look for 'echo -n' usage in modules
---
Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 98a2fbf..f3a5c07 100644
--- a/Makefile
+++ b/Makefile
@@ -212,7 +212,8 @@ syncheck:
[ "$${i##*/}" = "module-setup.sh" ] && continue; \
read line < "$$i"; [ "$${line#*bash*}" != "$$line" ] && continue; \
[ $$V ] && echo "posix syntax check: $$i"; bash --posix -n "$$i" ; ret=$$(($$ret+$$?)); \
- [ $$V ] && echo "checking for [[: $$i"; if grep -Fq '[[ ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains [["; fi \
+ [ $$V ] && echo "checking for [[: $$i"; if grep -Fq '[[ ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains [["; fi; \
+ [ $$V ] && echo "checking for echo -n: $$i"; if grep -Fq 'echo -n ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains echo -n"; fi \
done;exit $$ret
@ret=0;for i in *.sh mkinitrd-dracut.sh modules.d/*/*.sh \
modules.d/*/module-setup.sh; do \

View File

@ -1,21 +0,0 @@
From 7f2ea02b4ad95f59abb73dd4690f6f5ca9191633 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 10 Jul 2015 11:21:51 +0200
Subject: [PATCH] dracut.spec: add dracut-init.sh
---
dracut.spec | 1 +
1 file changed, 1 insertion(+)
diff --git a/dracut.spec b/dracut.spec
index 4775210..08b281d 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -315,6 +315,7 @@ rm -rf -- $RPM_BUILD_ROOT
%dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/dracut-functions.sh
+%{dracutlibdir}/dracut-init.sh
%{dracutlibdir}/dracut-functions
%{dracutlibdir}/dracut-version.sh
%{dracutlibdir}/dracut-logger.sh

View File

@ -1,71 +0,0 @@
From e50f91e6004a523d745179eaa789e28a75ff06d4 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 14 Jul 2015 10:11:59 +0200
Subject: [PATCH] use mktemp "-p" instead of "--tmpdir" for busybox
---
dracut-logger.sh | 2 +-
dracut.sh | 10 +++++-----
test/test-functions | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dracut-logger.sh b/dracut-logger.sh
index 2a6019c..e5c9358 100755
--- a/dracut-logger.sh
+++ b/dracut-logger.sh
@@ -148,7 +148,7 @@ dlog_init() {
&& type -P systemd-cat &>/dev/null \
&& systemctl --quiet is-active systemd-journald.socket &>/dev/null \
&& { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &>/dev/null; } ; then
- readonly _dlogdir="$(mktemp --tmpdir="$TMPDIR/" -d -t dracut-log.XXXXXX)"
+ readonly _dlogdir="$(mktemp -p "$TMPDIR/" -d -t dracut-log.XXXXXX)"
readonly _systemdcatfile="$_dlogdir/systemd-cat"
mkfifo "$_systemdcatfile"
readonly _dlogfd=15
diff --git a/dracut.sh b/dracut.sh
index b7456dc..ee0a039 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -777,16 +777,16 @@ fi
[[ $reproducible == yes ]] && DRACUT_REPRODUCIBLE=1
readonly TMPDIR="$tmpdir"
-readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)"
+readonly initdir="$(mktemp -p "$TMPDIR/" -d -t initramfs.XXXXXX)"
[ -d "$initdir" ] || {
- printf "%s\n" "dracut: mktemp --tmpdir='$TMPDIR/' -d -t initramfs.XXXXXX failed." >&2
+ printf "%s\n" "dracut: mktemp -p '$TMPDIR/' -d -t initramfs.XXXXXX failed." >&2
exit 1
}
if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]] ); then
- readonly early_cpio_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_cpio.XXXXXX)"
+ readonly early_cpio_dir="$(mktemp -p "$TMPDIR/" -d -t early_cpio.XXXXXX)"
[ -d "$early_cpio_dir" ] || {
- printf "%s\n" "dracut: mktemp --tmpdir='$TMPDIR/' -d -t early_cpio.XXXXXX failed." >&2
+ printf "%s\n" "dracut: mktemp -p '$TMPDIR/' -d -t early_cpio.XXXXXX failed." >&2
exit 1
}
fi
@@ -1614,7 +1614,7 @@ dinfo "*** Creating image file '$outfile' ***"
if [[ $uefi = yes ]]; then
uefi_outfile="$outfile"
- readonly uefi_outdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initrd.XXXXXX)"
+ readonly uefi_outdir="$(mktemp -p "$TMPDIR/" -d -t initrd.XXXXXX)"
# redirect initrd output
outfile="$uefi_outdir/initrd"
fi
diff --git a/test/test-functions b/test/test-functions
index 1f5eed5..2b8a4d2 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -4,7 +4,7 @@ export PATH
[[ -e .testdir ]] && . .testdir
if [[ -z "$TESTDIR" ]] || [[ ! -d "$TESTDIR" ]]; then
- TESTDIR=$(mktemp -d --tmpdir="/var/tmp" -t dracut-test.XXXXXX)
+ TESTDIR=$(mktemp -d -p "/var/tmp" -t dracut-test.XXXXXX)
fi
echo "TESTDIR=\"$TESTDIR\"" > .testdir
export TESTDIR

View File

@ -1,25 +0,0 @@
From f4d64d55ea825ec0d05aaa76d58cddc37d44f719 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Sat, 18 Jul 2015 13:02:25 +0200
Subject: [PATCH] dmsquash-generator.sh: increase timeout for checkisomd5
if the checkisomd5 takes longer than 3 minutes, the device timeout for
/dev/mapper/live-rw cancels the boot process.
---
modules.d/90dmsquash-live/dmsquash-generator.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/modules.d/90dmsquash-live/dmsquash-generator.sh b/modules.d/90dmsquash-live/dmsquash-generator.sh
index e386d81..85a3592 100755
--- a/modules.d/90dmsquash-live/dmsquash-generator.sh
+++ b/modules.d/90dmsquash-live/dmsquash-generator.sh
@@ -64,3 +64,9 @@ ROOTFLAGS="$(getarg rootflags)"
echo "What=/dev/mapper/live-rw"
[ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
} > "$GENERATOR_DIR"/sysroot.mount
+
+mkdir -p "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d"
+{
+ echo "[Unit]"
+ echo "JobTimeoutSec=3000"
+} > "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d/timeout.conf"

View File

@ -1,31 +0,0 @@
From 7eeaa4ab146907eb56bc03d4aeba1feea8357c1e Mon Sep 17 00:00:00 2001
From: Chao Fan <cfan@redhat.com>
Date: Tue, 21 Jul 2015 17:18:42 +0800
Subject: [PATCH] remove the incomplete .img file
If the directory where the .img file is saved has no enough space, or in
other wrong conditions, dracut will get an incomplete file xxx.img. But
sometimes this .img file will be loaded when rebooting the system. And then
some bugs will happen because this .img file is wrong.
So I think dracut should remove the incomplete file because this .img file
with problems was made by dracut. And then the wrong file will not be loaded
anymore.
Signed-off-by: Chao Fan <cfan@redhat.com>
---
dracut.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/dracut.sh b/dracut.sh
index ee0a039..122ae0c 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1651,6 +1651,7 @@ if ! (
| $compress >> "$outfile"
); then
dfatal "dracut: creation of $outfile failed"
+ rm -f $outfile
exit 1
fi
dinfo "*** Creating initrd image file '$outfile' done ***"

View File

@ -1,148 +0,0 @@
From 693b7a32833b7c141f03d802f6bc9a767bdb11f8 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 22 Jul 2015 11:34:08 +0200
Subject: [PATCH] Cleanup compressor handling
If no compressor is specified, try to find a suitable one.
Check if kernel modules can be uncompressed.
---
dracut.sh | 78 +++++++++++++++++++++++++++++++++++++++++++++++--------------
dracut.spec | 7 +++---
2 files changed, 64 insertions(+), 21 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index ee0a039..27be54a 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -751,25 +751,53 @@ if [[ -n "$logfile" ]];then
fi
# handle compression options.
-[[ $compress ]] || compress="gzip"
+if [[ $_no_compress_l = "cat" ]]; then
+ compress="cat"
+fi
+
+if ! [[ $compress ]]; then
+ # check all known compressors, if none specified
+ for i in pigz gzip lz4 lzop lzma xz lbzip2 bzip2 cat; do
+ command -v "$i" &>/dev/null || continue
+ compress="$i"
+ break
+ done
+ if [[ $compress = cat ]]; then
+ printf "%s\n" "dracut: no compression tool available. Initramfs image is going to be big." >&2
+ fi
+fi
+
+# choose the right arguments for the compressor
case $compress in
- bzip2) compress="bzip2 -9";
- command -v lbzip2 > /dev/null 2>&1 && compress="lbzip2 -9";;
- lzma) compress="lzma -9 -T0";;
- xz) compress="xz --check=crc32 --lzma2=dict=1MiB -T0";;
- gzip) compress="gzip -n -9";
- if command -v pigz > /dev/null 2>&1; then
+ bzip2|lbzip2)
+ if [[ "$compress" = lbzip2 ]] || command -v lbzip2 &>/dev/null; then
+ compress="lbzip2 -9"
+ else
+ compress="bzip2 -9"
+ fi
+ ;;
+ lzma)
+ compress="lzma -9 -T0"
+ ;;
+ xz)
+ compress="xz --check=crc32 --lzma2=dict=1MiB -T0"
+ ;;
+ gzip|pigz)
+ if [[ "$compress" = pigz ]] || command -v pigz &>/dev/null; then
compress="pigz -9 -n -T -R"
- elif command -v gzip --help 2>&1 | grep -q rsyncable; then
+ elif command -v gzip &>/dev/null && gzip --help 2>&1 | grep -q rsyncable; then
compress="gzip -n -9 --rsyncable"
+ else
+ compress="gzip -n -9"
fi
;;
- lzo) compress="lzop -9";;
- lz4) compress="lz4 -l -9";;
+ lzo|lzop)
+ compress="lzop -9"
+ ;;
+ lz4)
+ compress="lz4 -l -9"
+ ;;
esac
-if [[ $_no_compress_l = "cat" ]]; then
- compress="cat"
-fi
[[ $hostonly = yes ]] && hostonly="-h"
[[ $hostonly != "-h" ]] && unset hostonly
@@ -887,10 +915,26 @@ esac
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
-if [[ -d $srcmods ]]; then
- [[ -f $srcmods/modules.dep ]] || {
- dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
- }
+if [[ $no_kernel != yes ]] && [[ -d $srcmods ]]; then
+ if ! [[ -f $srcmods/modules.dep ]]; then
+ dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
+ elif ! ( command -v gzip &>/dev/null && command -v xz &>/dev/null); then
+ read _mod < $srcmods/modules.dep
+ _mod=${_mod%%:*}
+ if [[ -f $srcmods/"$_mod" ]]; then
+ # Check, if kernel modules are compressed, and if we can uncompress them
+ case "$_mod" in
+ *.ko.gz) kcompress=gzip;;
+ *.ko.xz) kcompress=xz;;
+ esac
+ if [[ $kcompress ]]; then
+ if ! command -v "$kcompress" &>/dev/null; then
+ dfatal "Kernel modules are compressed with $kcompress, but $kcompress is not available."
+ exit 1
+ fi
+ fi
+ fi
+ fi
fi
if [[ ! $print_cmdline ]]; then
diff --git a/dracut.spec b/dracut.spec
index 08b281d..6ef5de7 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -60,7 +60,6 @@ BuildRequires: docbook-style-xsl docbook-dtds libxslt
BuildRequires: asciidoc
%endif
-
%if 0%{?fedora} > 12 || 0%{?rhel}
# no "provides", because dracut does not offer
# all functionality of the obsoleted packages
@@ -94,17 +93,17 @@ Requires: findutils
Requires: grep
Requires: kmod
Requires: sed
+Requires: xz
+Requires: gzip
%if 0%{?fedora} > 22
Recommends: grubby
Recommends: hardlink
-Recommends: gzip
-Recommends: xz
+Recommends: pigz
Recommends: kpartx
%else
Requires: hardlink
Requires: gzip
-Requires: xz
Requires: kpartx
%endif

View File

@ -1,22 +0,0 @@
From c1c96f2c4780bdf8ddc363ded40439cba31afa56 Mon Sep 17 00:00:00 2001
From: Stefan Reimer <it@startux.de>
Date: Sat, 25 Jul 2015 01:17:04 +0000
Subject: [PATCH] Add missing echo to output the result.
Only place this function is currently called seems from line 28 in modules.d/95nfs/nfs-lib.sh. Bug fix.
---
modules.d/40network/net-lib.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index 6c739e8..68bc095 100755
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -5,6 +5,7 @@ get_ip() {
ip=$(ip -o -f inet addr show $iface)
ip=${ip%%/*}
ip=${ip##* }
+ echo $ip
}
iface_for_remote_addr() {

View File

@ -1,30 +0,0 @@
From 2082cdf230574fa7482903730b584445ed3a2a08 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 27 Jul 2015 13:30:22 +0200
Subject: [PATCH] crypt: s/allow-discards/discard for crypttab
actually the option in crypttab is named "discard" and not
"allow-discards"
https://bugzilla.suse.com/show_bug.cgi?id=932972
---
modules.d/90crypt/crypt-run-generator.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/90crypt/crypt-run-generator.sh b/modules.d/90crypt/crypt-run-generator.sh
index 5bf60ec..8dad76b 100755
--- a/modules.d/90crypt/crypt-run-generator.sh
+++ b/modules.d/90crypt/crypt-run-generator.sh
@@ -15,10 +15,10 @@ if strstr "$(cryptsetup --help)" "allow-discards"; then
if discarduuids=$(getargs "rd.luks.allow-discards"); then
discarduuids=$(str_replace "$discarduuids" 'luks-' '')
if strstr " $discarduuids " " ${luks##luks-}"; then
- allowdiscards="allow-discards"
+ allowdiscards="discard"
fi
elif getargbool 0 rd.luks.allow-discards; then
- allowdiscards="allow-discards"
+ allowdiscards="discard"
fi
fi

View File

@ -1,21 +0,0 @@
From cce34acace5876d06946dfb1fe70004a0b5176b0 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 28 Jul 2015 11:55:04 +0200
Subject: [PATCH] qemu: add spapr-vscsi kernel module
---
modules.d/90qemu/module-setup.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules.d/90qemu/module-setup.sh b/modules.d/90qemu/module-setup.sh
index 37972e4..66ef884 100755
--- a/modules.d/90qemu/module-setup.sh
+++ b/modules.d/90qemu/module-setup.sh
@@ -25,5 +25,6 @@ installkernel() {
hostonly='' instmods \
ata_piix ata_generic pata_acpi cdrom sr_mod ahci \
virtio_blk virtio virtio_ring virtio_pci \
- virtio_scsi virtio_console virtio_rng
+ virtio_scsi virtio_console virtio_rng \
+ spapr-vscsi
}

View File

@ -1,25 +0,0 @@
From da5304aabcb7c1b541a8eeabc69627f05ad47c09 Mon Sep 17 00:00:00 2001
From: Alexander Tsoy <alexander@tsoy.me>
Date: Tue, 28 Jul 2015 14:55:59 +0300
Subject: [PATCH] dracut-initramfs-restore: make mount error nonfatal
Script enables errexit option (set -e). So if /boot is not a mount point
or is already mounted, then script dies after unsuccessful mount
command. Fix this by always returning successful result.
---
dracut-initramfs-restore.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
index 0e6a1a8..0c41a59 100644
--- a/dracut-initramfs-restore.sh
+++ b/dracut-initramfs-restore.sh
@@ -14,7 +14,7 @@ SKIP="$dracutbasedir/skipcpio"
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
-mount -o ro /boot &>/dev/null
+mount -o ro /boot &>/dev/null || true
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"

View File

@ -1,30 +0,0 @@
From 96d694c0b5949586dad8eab5491ad41521eec514 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 30 Jul 2015 12:11:42 +0200
Subject: [PATCH] dracut.sh: simplify modalias reading
---
dracut.sh | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 27be54a..77874ba 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1179,13 +1179,9 @@ if [[ $hostonly ]]; then
# record all host modaliases
declare -A host_modalias
- find /sys/devices/ -name uevent -print > "$initdir/.modalias"
- while read m || [ -n "$m" ]; do
- while read line || [ -n "$line" ]; do
- [[ "$line" != MODALIAS\=* ]] && continue
- modalias="${line##MODALIAS=}" && [[ $modalias ]] && host_modalias["$modalias"]=1
- break
- done < "$m"
+ find /sys/devices -name modalias -exec cat '{}' \; > "$initdir/.modalias"
+ while read -r modalias || [ -n "$modalias" ]; do
+ [[ $modalias ]] && host_modalias["$modalias"]=1
done < "$initdir/.modalias"
rm -f -- "$initdir/.modalias"

View File

@ -1,38 +0,0 @@
From 4135eea634b20c7f7285d134bd6dfe6b799fe226 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 31 Jul 2015 09:05:51 +0200
Subject: [PATCH] 90qemu: fixed systemd-detect-virt output parsing
redirecting systemd-detect-virt to /dev/null doesn't help with parsing
the output :-/
Also, add "Red Hat" as a vendor.
---
modules.d/90qemu/module-setup.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules.d/90qemu/module-setup.sh b/modules.d/90qemu/module-setup.sh
index 66ef884..8cae124 100755
--- a/modules.d/90qemu/module-setup.sh
+++ b/modules.d/90qemu/module-setup.sh
@@ -3,7 +3,7 @@
# called by dracut
check() {
if type -P systemd-detect-virt >/dev/null 2>&1; then
- vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
+ vm=$(systemd-detect-virt --vm 2>/dev/null)
(($? != 0)) && return 255
[[ $vm = "qemu" ]] && return 0
[[ $vm = "kvm" ]] && return 0
@@ -13,8 +13,9 @@ check() {
for i in /sys/class/dmi/id/*_vendor; do
[[ -f $i ]] || continue
read vendor < $i
- [[ "$vendor" == "QEMU" ]] && return 0
- [[ "$vendor" == "Bochs" ]] && return 0
+ [[ "$vendor" == "QEMU" ]] && return 0
+ [[ "$vendor" == "Red Hat" ]] && return 0
+ [[ "$vendor" == "Bochs" ]] && return 0
done
return 255
}

View File

@ -1,24 +0,0 @@
From b05ad85b0c46d1001945bcb8c300a34eca2dd2da Mon Sep 17 00:00:00 2001
From: Mimi Zohar <zohar@linux.vnet.ibm.com>
Date: Mon, 27 Apr 2015 18:24:11 -0400
Subject: [PATCH] Remove 98integrity's dependency on selinux
Loading the EVM key(s) is not dependent on selinux. Remove
the dependency.
---
modules.d/98integrity/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/98integrity/module-setup.sh b/modules.d/98integrity/module-setup.sh
index a838664..2d4d2ed 100755
--- a/modules.d/98integrity/module-setup.sh
+++ b/modules.d/98integrity/module-setup.sh
@@ -7,7 +7,7 @@ check() {
# called by dracut
depends() {
- echo masterkey securityfs selinux
+ echo masterkey securityfs
return 0
}

View File

@ -1,70 +0,0 @@
From 396d3cc7ff39e54ce2de1fa9389348238b0ed92e Mon Sep 17 00:00:00 2001
From: Mimi Zohar <zohar@linux.vnet.ibm.com>
Date: Mon, 27 Apr 2015 18:24:12 -0400
Subject: [PATCH] Extend evm-enable.sh to load the EVM public key
Create the _evm keyring and load the EVM public key on it.
---
modules.d/98integrity/evm-enable.sh | 42 +++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/modules.d/98integrity/evm-enable.sh b/modules.d/98integrity/evm-enable.sh
index dee1c6c..ec4f03b 100755
--- a/modules.d/98integrity/evm-enable.sh
+++ b/modules.d/98integrity/evm-enable.sh
@@ -48,6 +48,45 @@ load_evm_key()
info "integrity: failed to load the EVM encrypted key: ${EVMKEYDESC}";
return 1;
}
+ return 0
+}
+
+load_evm_x509()
+{
+ info "Load EVM IMA X509"
+
+ # override the EVM key path name from the 'evmx509=' parameter in
+ # the kernel command line
+ EVMX509ARG=$(getarg evmx509=)
+ [ $? -eq 0 ] && \
+ EVMX509=${EVMX509ARG}
+
+ # set the default value
+ [ -z "${EVMX509}" ] && \
+ EVMX509="/etc/keys/x509_evm.der";
+
+ # set the EVM public key path name
+ EVMX509PATH="${NEWROOT}${EVMX509}"
+
+ # check for EVM public key's existence
+ if [ ! -f "${EVMX509PATH}" ]; then
+ if [ "${RD_DEBUG}" = "yes" ]; then
+ info "integrity: EVM x509 cert file not found: ${EVMX509PATH}"
+ fi
+ return 1
+ fi
+
+ # load the EVM public key onto the EVM keyring
+ evm_pubid=`keyctl newring _evm @u`
+ EVMX509ID=$(evmctl import ${EVMX509PATH} ${evm_pubid})
+ [ $? -eq 0 ] || {
+ info "integrity: failed to load the EVM X509 cert ${EVMX509PATH}";
+ return 1;
+ }
+
+ if [ "${RD_DEBUG}" = "yes" ]; then
+ keyctl show @u
+ fi
return 0
}
@@ -76,6 +115,9 @@ enable_evm()
# load the EVM encrypted key
load_evm_key || return 1
+ # load the EVM public key, if it exists
+ load_evm_x509
+
# initialize EVM
info "Enabling EVM"
echo 1 > ${EVMSECFILE}

View File

@ -1,135 +0,0 @@
From 41ac16b26fe05c8291d3467b8a7bee1bc2445393 Mon Sep 17 00:00:00 2001
From: Mimi Zohar <zohar@linux.vnet.ibm.com>
Date: Wed, 29 Apr 2015 11:05:25 -0400
Subject: [PATCH] Define new script to load keys on the IMA keyring (update)
This patch supports loading keys either on the _ima keyring or, as of
Linux 3.17, on the trusted .ima keyring. Only certificates signed by
a key on the system keyring can be loaded onto the trusted .ima keyring.
Changelog:
- Update 98integrity/README
---
modules.d/98integrity/README | 28 +++++++++++++++
modules.d/98integrity/ima-keys-load.sh | 62 ++++++++++++++++++++++++++++++++++
modules.d/98integrity/module-setup.sh | 2 ++
3 files changed, 92 insertions(+)
create mode 100755 modules.d/98integrity/ima-keys-load.sh
diff --git a/modules.d/98integrity/README b/modules.d/98integrity/README
index d74e063..64de0ae 100644
--- a/modules.d/98integrity/README
+++ b/modules.d/98integrity/README
@@ -38,3 +38,31 @@ line.
------------- '/etc/sysconfig/ima' (with the default value) -------------
IMAPOLICY="/etc/sysconfig/ima-policy"
-------------------------------------------------------------------------
+
+
+# Information on loading distro, third party or local keys on the trusted IMA keyring
+
+# Loading distro, third party or local keys on the trusted IMA keyring requires
+# creating a local certificate authority(local-CA), installing the local-CA's
+# public key on the system-keyring and signing the certificates with the local-CA
+# key.
+#
+# Many directions for creating a mini certificate authority exist on the web
+# (eg. openssl, yubikey). (Reminder: safely storing the private key offline is
+# really important, especially in the case of the local-CA's private key.) The
+# local-CA's public key can be loaded onto the system keyring either by building
+# the key into the kernel or, on Fedora, storing it in the UEFI/Mok keyring. (As
+# of writing, the patches for loading the UEFI/Mok keys on the system-keyring
+# have not been upstreamed.)
+#
+# To view the system keyring: keyctl show %keyring:.system_keyring
+#
+# Most on-line directions for signing certificates requires creating a Certificate
+# Signing Request (CSR). Creating such a request requires access to the private
+# key, which would not be available when signing distro or 3rd party certificates.
+# Openssl provides the "-ss_cert" option for directly signing certificates.
+
+# 98integrity/ima-keys-load.sh script loads the signed certificates stored
+# in the $IMAKEYSDIR onto the trusted IMA keyring. The default $IMAKEYSDIR
+# directory is /etc/keys/ima, but can be specified in the /etc/sysconfig/ima
+# policy.
diff --git a/modules.d/98integrity/ima-keys-load.sh b/modules.d/98integrity/ima-keys-load.sh
new file mode 100755
index 0000000..659b722
--- /dev/null
+++ b/modules.d/98integrity/ima-keys-load.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+SECURITYFSDIR="/sys/kernel/security"
+IMASECDIR="${SECURITYFSDIR}/ima"
+IMACONFIG="${NEWROOT}/etc/sysconfig/ima"
+
+load_x509_keys()
+{
+ KEYRING_ID=$1
+
+ # override the default configuration
+ if [ -f "${IMACONFIG}" ]; then
+ . ${IMACONFIG}
+ fi
+
+ if [ -z "${IMAKEYDIR}" ]; then
+ IMAKEYSDIR="/etc/keys/ima"
+ fi
+
+ PUBKEY_LIST=`ls ${NEWROOT}${IMAKEYSDIR}/*`
+ for PUBKEY in ${PUBKEY_LIST}; do
+ # check for public key's existence
+ if [ ! -f "${PUBKEY}" ]; then
+ if [ "${RD_DEBUG}" = "yes" ]; then
+ info "integrity: IMA x509 cert file not found: ${PUBKEY}"
+ fi
+ continue
+ fi
+
+ X509ID=$(evmctl import ${PUBKEY} ${KEYRING_ID})
+ if [ $? -ne 0 ]; then
+ info "integrity: IMA x509 cert not loaded on keyring: ${PUBKEY}"
+ fi
+ done
+
+ if [ "${RD_DEBUG}" = "yes" ]; then
+ keyctl show ${KEYRING_ID}
+ fi
+ return 0
+}
+
+# check kernel support for IMA
+if [ ! -e "${IMASECDIR}" ]; then
+ if [ "${RD_DEBUG}" = "yes" ]; then
+ info "integrity: IMA kernel support is disabled"
+ fi
+ return 0
+fi
+
+# get the IMA keyring id
+line=$(keyctl describe %keyring:.ima)
+if [ $? -eq 0 ]; then
+ _ima_id=${line%%:*}
+else
+ _ima_id=`keyctl search @u keyring _ima`
+ if [ -z "${_ima_id}" ]; then
+ _ima_id=`keyctl newring _ima @u`
+ fi
+fi
+
+# load the IMA public key(s)
+load_x509_keys ${_ima_id}
diff --git a/modules.d/98integrity/module-setup.sh b/modules.d/98integrity/module-setup.sh
index 2d4d2ed..34b33cd 100755
--- a/modules.d/98integrity/module-setup.sh
+++ b/modules.d/98integrity/module-setup.sh
@@ -13,6 +13,8 @@ depends() {
# called by dracut
install() {
+ dracut_install evmctl keyctl ls
inst_hook pre-pivot 61 "$moddir/evm-enable.sh"
+ inst_hook pre-pivot 61 "$moddir/ima-keys-load.sh"
inst_hook pre-pivot 62 "$moddir/ima-policy-load.sh"
}

View File

@ -1,24 +0,0 @@
From 4f50a9bfb109f1705ca987db6301c3c66a00ea75 Mon Sep 17 00:00:00 2001
From: Mimi Zohar <zohar@linux.vnet.ibm.com>
Date: Mon, 27 Apr 2015 18:24:14 -0400
Subject: [PATCH] Revert securitfs change
Commit 5e60145 use findmnt with "--source" or "--target" broke
mounting securityfs. This patch reverts only the securityfs
portion of the patch.
---
modules.d/96securityfs/securityfs.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/96securityfs/securityfs.sh b/modules.d/96securityfs/securityfs.sh
index 8ccb151..8e57571 100755
--- a/modules.d/96securityfs/securityfs.sh
+++ b/modules.d/96securityfs/securityfs.sh
@@ -3,6 +3,6 @@
SECURITYFSDIR="/sys/kernel/security"
export SECURITYFSDIR
-if ! findmnt --target "${SECURITYFSDIR}" >/dev/null 2>&1; then
+if ! findmnt "${SECURITYFSDIR}" >/dev/null 2>&1; then
mount -t securityfs -o nosuid,noexec,nodev securityfs ${SECURITYFSDIR} >/dev/null 2>&1
fi

View File

@ -1,67 +0,0 @@
From e6a2555c7ddde2ed542b2aae01d78a5c9309bf80 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 10 Aug 2015 13:40:43 +0200
Subject: [PATCH] base/dracut-lib.sh: Dup stdout and stderr
Dup stdout and stderr, so that subshell redirection does not affect
logging.
Also gets rid of systemd printing info() to the console on "quiet".
---
modules.d/99base/dracut-lib.sh | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 5ec7b23..200c263 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -51,29 +51,45 @@ str_ends() {
[ "${1%*"$2"}" != "$1" ]
}
+# Dup stdout and stderr, so that subshell redirection does not affect logging.
+if [ -z "$DRACUT_STDOUT" ]; then
+ if [ -n "$BASH" ]; then
+ readonly DRACUT_STDOUT=98
+ readonly DRACUT_STDERR=98
+ exec 98>&1
+ exec 99>&2
+ else
+ readonly DRACUT_STDOUT=8
+ readonly DRACUT_STDERR=9
+ exec 8>&1
+ exec 9>&2
+ fi
+fi
+
+
if [ -z "$DRACUT_SYSTEMD" ]; then
warn() {
check_quiet
echo "<28>dracut Warning: $*" > /dev/kmsg
- echo "dracut Warning: $*" >&2
+ echo "dracut Warning: $*" >&$DRACUT_STDERR
}
info() {
check_quiet
echo "<30>dracut: $*" > /dev/kmsg
[ "$DRACUT_QUIET" != "yes" ] && \
- echo "dracut: $*" >&2
+ echo "dracut: $*" >&$DRACUT_STDERR
}
else
warn() {
- echo "Warning: $*" >&2
+ echo "Warning: $*" >&$DRACUT_STDERR
}
info() {
- echo "$*" >&2
+ echo "$*" >&$DRACUT_STDOUT
}
fi

View File

@ -1,26 +0,0 @@
From 3c00189988f6921c1affdd61a0f5025ee9b93bda Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 10 Aug 2015 14:05:15 +0200
Subject: [PATCH] dracut.sh: remove quotes from install_items and
install_optional_items
Unfortunately these are lists with whitespaces.
---
dracut.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 77874ba..f7d31a4 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1453,8 +1453,8 @@ if [[ $no_kernel != yes ]]; then
fi
if [[ $kernel_only != yes ]]; then
- (( ${#install_items[@]} > 0 )) && inst_multiple "${install_items[@]}"
- (( ${#install_optional_items[@]} > 0 )) && inst_multiple -o "${install_optional_items[@]}"
+ (( ${#install_items[@]} > 0 )) && inst_multiple ${install_items[@]}
+ (( ${#install_optional_items[@]} > 0 )) && inst_multiple -o ${install_optional_items[@]}
[[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"

View File

@ -1,32 +0,0 @@
From 01b23b6900eabefbfd1f589b9f12c8ff38c5afc0 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 12 Aug 2015 14:24:05 +0200
Subject: [PATCH] network/net-lib.sh: add is_ip()
add function to test if string is a valid IP
---
modules.d/40network/net-lib.sh | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index 68bc095..5c65a2e 100755
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -1,5 +1,17 @@
#!/bin/sh
+is_ip() {
+ echo "$1" | {
+ IFS=. read a b c d
+ test "$a" -ge 0 -a "$a" -le 255 \
+ -a "$b" -ge 0 -a "$b" -le 255 \
+ -a "$c" -ge 0 -a "$c" -le 255 \
+ -a "$d" -ge 0 -a "$d" -le 255 \
+ 2> /dev/null
+ } && return 0
+ return 1
+}
+
get_ip() {
local iface="$1" ip=""
ip=$(ip -o -f inet addr show $iface)

View File

@ -1,21 +0,0 @@
From b1b704bd67d0b397585618affcf12ad30ceae183 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 12 Aug 2015 14:24:45 +0200
Subject: [PATCH] systemd: add systemd-run and systemd-escape
---
modules.d/00systemd/module-setup.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh
index e763d9f..da95aee 100755
--- a/modules.d/00systemd/module-setup.sh
+++ b/modules.d/00systemd/module-setup.sh
@@ -129,6 +129,7 @@ install() {
echo swapoff \
kmod insmod rmmod modprobe modinfo depmod lsmod \
mount umount reboot poweroff \
+ systemd-run systemd-escape \
systemd-cgls systemd-tmpfiles
inst_multiple -o \

View File

@ -1,37 +0,0 @@
From 4e9ba952bfa607ac47bfe3cf4943ae3386da22bc Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 12 Aug 2015 14:25:23 +0200
Subject: [PATCH] network/parse-ip-opts.sh: assume rd.neednet for multiple ip
options
set rd.neednet on the kernel cmdline to disable this behaviour
---
modules.d/40network/parse-ip-opts.sh | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/modules.d/40network/parse-ip-opts.sh b/modules.d/40network/parse-ip-opts.sh
index a481b46..33bb068 100755
--- a/modules.d/40network/parse-ip-opts.sh
+++ b/modules.d/40network/parse-ip-opts.sh
@@ -36,8 +36,10 @@ unset count
# If needed, check if bootdev= contains anything usable
BOOTDEV=$(getarg bootdev=)
-if [ -n "$NEEDBOOTDEV" ] ; then
- [ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
+if [ -n "$NEEDBOOTDEV" ] && getargbool 1 rd.neednet; then
+ #[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
+ echo "rd.neednet=1" > /etc/cmdline.d/dracut-neednet.conf
+ info "Multiple ip= arguments: assuming rd.neednet=1"
fi
# Check ip= lines
@@ -48,7 +50,7 @@ for p in $(getargs ip=); do
# make first device specified the BOOTDEV
if [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
BOOTDEV="$dev"
- [ -n "$NEEDBOOTDEV" ] && warn "Setting bootdev to '$BOOTDEV'"
+ [ -n "$NEEDBOOTDEV" ] && info "Setting bootdev to '$BOOTDEV'"
fi
# skip ibft since we did it above

View File

@ -1,23 +0,0 @@
From 50e86bf02be003f3de6214f8012e62edde0085fc Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 12 Aug 2015 14:27:01 +0200
Subject: [PATCH] nfs/parse-nfsroot.sh: silence useless warning if netroot is
not nfs
---
modules.d/95nfs/parse-nfsroot.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/95nfs/parse-nfsroot.sh b/modules.d/95nfs/parse-nfsroot.sh
index 2200cad..54f73d8 100755
--- a/modules.d/95nfs/parse-nfsroot.sh
+++ b/modules.d/95nfs/parse-nfsroot.sh
@@ -38,7 +38,7 @@ if [ -n "$netroot" ] ; then
[ "$n" = "$netroot" ] && break
done
if [ "$n" = "$netroot" ]; then
- warn "Ignoring netroot argument for NFS"
+ #warn "Ignoring netroot argument for NFS"
netroot=$root
fi
else

View File

@ -1,22 +0,0 @@
From 8ba684be1c04976204d2b671ab90cb27791f467b Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 12 Aug 2015 14:27:39 +0200
Subject: [PATCH] dracut-systemd/dracut-initqueue.sh: be verbose about timeout
Issue a warning, if timeout scripts are executed
---
modules.d/98dracut-systemd/dracut-initqueue.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules.d/98dracut-systemd/dracut-initqueue.sh b/modules.d/98dracut-systemd/dracut-initqueue.sh
index af9cec2..881f639 100755
--- a/modules.d/98dracut-systemd/dracut-initqueue.sh
+++ b/modules.d/98dracut-systemd/dracut-initqueue.sh
@@ -55,6 +55,7 @@ while :; do
done
if [ $main_loop -gt $((2*$RDRETRY/3)) ]; then
+ warn "dracut-initqueue timeout - starting timeout scripts"
for job in $hookdir/initqueue/timeout/*.sh; do
[ -e "$job" ] || break
job=$job . $job

View File

@ -1,65 +0,0 @@
From f41720c3115011afb9577ed063a4bc521dc707ec Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 12 Aug 2015 14:28:45 +0200
Subject: [PATCH] base/dracut-lib.sh: forget about the idea of output
redirection
It's just not working :-/
---
modules.d/99base/dracut-lib.sh | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 200c263..1eaf4b3 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -51,45 +51,29 @@ str_ends() {
[ "${1%*"$2"}" != "$1" ]
}
-# Dup stdout and stderr, so that subshell redirection does not affect logging.
-if [ -z "$DRACUT_STDOUT" ]; then
- if [ -n "$BASH" ]; then
- readonly DRACUT_STDOUT=98
- readonly DRACUT_STDERR=98
- exec 98>&1
- exec 99>&2
- else
- readonly DRACUT_STDOUT=8
- readonly DRACUT_STDERR=9
- exec 8>&1
- exec 9>&2
- fi
-fi
-
-
if [ -z "$DRACUT_SYSTEMD" ]; then
warn() {
check_quiet
echo "<28>dracut Warning: $*" > /dev/kmsg
- echo "dracut Warning: $*" >&$DRACUT_STDERR
+ echo "dracut Warning: $*" >&2
}
info() {
check_quiet
echo "<30>dracut: $*" > /dev/kmsg
[ "$DRACUT_QUIET" != "yes" ] && \
- echo "dracut: $*" >&$DRACUT_STDERR
+ echo "dracut: $*" >&2
}
else
warn() {
- echo "Warning: $*" >&$DRACUT_STDERR
+ echo "Warning: $*" >&2
}
info() {
- echo "$*" >&$DRACUT_STDOUT
+ echo "$*"
}
fi

View File

@ -1,295 +0,0 @@
From d94050ddaea8343d8adb8f151c8f4cad591d29d9 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 12 Aug 2015 14:33:49 +0200
Subject: [PATCH] iscsi: integrate with systemd and improve robustness
parse-cmdline sets up an initial initiator-name to let iscsid start.
iscsid is started before doing any iscsistart business.
iscsistart is done with systemd-run asynchrone to do things in
paralllel. Also restarted for every new interface which shows up.
If rd.iscsi.waitnet (default) is set, iscsistart is done only
after all interfaces are up.
If not all interfaces are up and rd.iscsi.testroute (default) is set,
the route to a iscsi target IP is checked and skipped, if there is none.
If all things fail, we issue a "dummy" interface iscsiroot to retry
everything in the initqueue/timeout.
---
modules.d/95iscsi/cleanup-iscsi.sh | 2 +-
modules.d/95iscsi/iscsiroot.sh | 116 ++++++++++++++++++++++++-----------
modules.d/95iscsi/module-setup.sh | 31 ++++++++++
modules.d/95iscsi/parse-iscsiroot.sh | 13 +++-
4 files changed, 125 insertions(+), 37 deletions(-)
diff --git a/modules.d/95iscsi/cleanup-iscsi.sh b/modules.d/95iscsi/cleanup-iscsi.sh
index e97d65a..bfc8aef 100755
--- a/modules.d/95iscsi/cleanup-iscsi.sh
+++ b/modules.d/95iscsi/cleanup-iscsi.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-[ -e /sys/module/bnx2i ] && killproc iscsiuio
+[ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && killproc iscsiuio
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index 460e438..fc62425 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -36,7 +36,7 @@ iroot=${iroot#:}
# figured out a way how to check whether this is built-in or not
modprobe crc32c 2>/dev/null
-if [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then
+if [ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then
iscsiuio
> /tmp/iscsiuio-started
fi
@@ -105,28 +105,47 @@ handle_netroot()
parse_iscsi_root "$1" || return 1
+ # Bail out early, if there is no route to the destination
+ if is_ip "$iscsi_target_ip" && [ "$netif" != "dummy" ] && ! all_ifaces_up && getargbool 1 rd.iscsi.testroute; then
+ ip route get "$iscsi_target_ip" >/dev/null 2>&1 || return 0
+ fi
+
# XXX is this needed?
getarg ro && iscsirw=ro
getarg rw && iscsirw=rw
fsopts=${fsopts:+$fsopts,}${iscsirw}
+ if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
+ iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
+ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
+ rm -f /etc/iscsi/initiatorname.iscsi
+ mkdir -p /etc/iscsi
+ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
+ systemctl restart iscsid
+ sleep 1
+ > /tmp/iscsi_set_initiator
+ fi
+
if [ -z $iscsi_initiator ]; then
- # XXX Where are these from?
+ [ -f /run/initiatorname.iscsi ] && . /run/initiatorname.iscsi
[ -f /etc/initiatorname.iscsi ] && . /etc/initiatorname.iscsi
[ -f /etc/iscsi/initiatorname.iscsi ] && . /etc/iscsi/initiatorname.iscsi
iscsi_initiator=$InitiatorName
-
- # XXX rfc3720 says 'SCSI Initiator Name: The iSCSI Initiator Name specifies
- # the worldwide unique name of the initiator.' Could we use hostname/ip
- # if missing?
fi
if [ -z $iscsi_initiator ]; then
- if [ -f /sys/firmware/ibft/initiator/initiator-name ]; then
- iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
- fi
+ iscsi_initiator=$(iscsi-iname)
+ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
+ rm -f /etc/iscsi/initiatorname.iscsi
+ mkdir -p /etc/iscsi
+ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
+ systemctl restart iscsid
+ > /tmp/iscsi_set_initiator
+ # FIXME: iscsid is not yet ready, when the service is :-/
+ sleep 1
fi
+
if [ -z $iscsi_target_port ]; then
iscsi_target_port=3260
fi
@@ -135,23 +154,21 @@ handle_netroot()
iscsi_target_group=1
fi
- if [ -z $iscsi_initiator ]; then
- # XXX is this correct?
- iscsi_initiator=$(iscsi-iname)
- fi
-
if [ -z $iscsi_lun ]; then
iscsi_lun=0
fi
- echo "InitiatorName='$iscsi_initiator'" > /run/initiatorname.iscsi
+ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
-
+ if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then
+ mkdir -p /etc/iscsi
+ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
+ fi
# FIXME $iscsi_protocol??
- if [ "$root" = "dhcp" ]; then
+ if [ "$root" = "dhcp" ] || [ "$netroot" = "dhcp" ]; then
# if root is not specified try to mount the whole iSCSI LUN
- printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules
+ printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' "$iscsi_lun" >> /etc/udev/rules.d/99-iscsi-root.rules
udevadm control --reload
write_fs_tab /dev/root
wait_for_dev -n /dev/root
@@ -161,29 +178,58 @@ handle_netroot()
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
fi
- # force udevsettle to break
- > $hookdir/initqueue/work
-
- iscsistart -i $iscsi_initiator -t $iscsi_target_name \
- -g $iscsi_target_group -a $iscsi_target_ip \
- -p $iscsi_target_port \
- ${iscsi_username:+-u $iscsi_username} \
- ${iscsi_password:+-w $iscsi_password} \
- ${iscsi_in_username:+-U $iscsi_in_username} \
- ${iscsi_in_password:+-W $iscsi_in_password} \
- ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
- ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
- ${iscsi_param} \
- || :
-
+ if [ -n "$DRACUT_SYSTEMD" ] && command -v systemd-run >/dev/null 2>&1; then
+ netroot_enc=$(systemd-escape "iscsistart_${1}")
+ status=$(systemctl is-active "$netroot_enc" 2>/dev/null)
+ is_active=$?
+ if [ $is_active -ne 0 ]; then
+ if [ "$status" != "activating" ] && ! systemctl is-failed "$netroot_enc" >/dev/null 2>&1; then
+ systemd-run --no-block --service-type=oneshot --remain-after-exit --quiet \
+ --description="Login iSCSI Target $iscsi_target_name" \
+ --unit="$netroot_enc" -- \
+ $(command -v iscsistart) \
+ -i $iscsi_initiator -t $iscsi_target_name \
+ -g $iscsi_target_group -a $iscsi_target_ip \
+ -p $iscsi_target_port \
+ ${iscsi_username:+-u $iscsi_username} \
+ ${iscsi_password:+-w $iscsi_password} \
+ ${iscsi_in_username:+-U $iscsi_in_username} \
+ ${iscsi_in_password:+-W $iscsi_in_password} \
+ ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
+ ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
+ ${iscsi_param} >/dev/null 2>&1
+ else
+ systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1
+ fi
+ fi
+ else
+ > $hookdir/initqueue/work
+ iscsistart -i $iscsi_initiator -t $iscsi_target_name \
+ -g $iscsi_target_group -a $iscsi_target_ip \
+ -p $iscsi_target_port \
+ ${iscsi_username:+-u $iscsi_username} \
+ ${iscsi_password:+-w $iscsi_password} \
+ ${iscsi_in_username:+-U $iscsi_in_username} \
+ ${iscsi_in_password:+-W $iscsi_in_password} \
+ ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
+ ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
+ ${iscsi_param} \
+ || :
+ fi
netroot_enc=$(str_replace "$1" '/' '\2f')
echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
+ return 0
}
ret=0
+if [ "$netif" != "dummy" ] && getargbool 1 rd.iscsi.waitnet; then
+ all_ifaces_up || exit 0
+fi
+
# loop over all netroot parameter
-if getarg netroot; then
+netroot=$(getarg netroot)
+if [ $? -eq 0 ] && [ "$netroot" != "dhcp" ]; then
for nroot in $(getargs netroot); do
[ "${nroot%%:*}" = "iscsi" ] || continue
nroot="${nroot##iscsi:}"
@@ -210,6 +256,6 @@ fi
need_shutdown
-# now we have a root filesystem somewhere in /dev/sda*
+# now we have a root filesystem somewhere in /dev/sd*
# let the normal block handler handle root=
exit $ret
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 406a9da..3002591 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -226,6 +226,37 @@ install() {
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
if ! dracut_module_included "systemd"; then
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
+ else
+ inst_multiple -o \
+ $systemdsystemunitdir/iscsi.service \
+ $systemdsystemunitdir/iscsid.service \
+ $systemdsystemunitdir/iscsid.socket \
+ $systemdsystemunitdir/iscsiuio.service \
+ $systemdsystemunitdir/iscsiuio.socket \
+ iscsiadm iscsid
+
+ mkdir -p "${initdir}/$systemdsystemunitdir/sockets.target.wants"
+ for i in \
+ iscsiuio.socket \
+ ; do
+ ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/sockets.target.wants/${i}"
+ done
+
+ mkdir -p "${initdir}/$systemdsystemunitdir/basic.target.wants"
+ for i in \
+ iscsid.service \
+ ; do
+ ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/basic.target.wants/${i}"
+ done
+
+ # Make sure iscsid is started after dracut-cmdline and ready for the initqueue
+ mkdir -p "${initdir}/$systemdsystemunitdir/iscsid.service.d"
+ (
+ echo "[Unit]"
+ echo "After=dracut-cmdline.service"
+ echo "Before=dracut-initqueue.service"
+ ) > "${initdir}/$systemdsystemunitdir/iscsid.service.d/dracut.conf"
fi
+
dracut_need_initqueue
}
diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
index 52f7a97..2532ada 100755
--- a/modules.d/95iscsi/parse-iscsiroot.sh
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
@@ -62,9 +62,10 @@ if [ -n "$iscsi_firmware" ] ; then
[ -z "$netroot" ] && netroot=iscsi:
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
modprobe -b -q iscsi_ibft
- initqueue --onetime --timeout /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
fi
+initqueue --onetime --timeout /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
+
# If it's not iscsi we don't continue
[ "${netroot%%:*}" = "iscsi" ] || return
@@ -86,6 +87,16 @@ if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; the
fi
fi
+if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ]; then
+ iscsi_initiator=$arg
+ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
+ ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
+ if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then
+ mkdir -p /etc/iscsi
+ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
+ fi
+fi
+
if [ -n "$iscsi_firmware" ] ; then
echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
else

View File

@ -1,23 +0,0 @@
From 52b91b66980d0de18a52c6c1c5334364b115fee2 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 12 Aug 2015 14:40:42 +0200
Subject: [PATCH] TEST-30-ISCSI/dhcpd.conf: set the LUN
set the LUN, so the udev rule to mount the disk matches
---
test/TEST-30-ISCSI/dhcpd.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/TEST-30-ISCSI/dhcpd.conf b/test/TEST-30-ISCSI/dhcpd.conf
index 6eb035b..22c1790 100644
--- a/test/TEST-30-ISCSI/dhcpd.conf
+++ b/test/TEST-30-ISCSI/dhcpd.conf
@@ -15,7 +15,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
# NFSv3: last octect starts at 0x00 and works up
group {
- option root-path "iscsi:192.168.50.1::::iqn.2009-06.dracut:target0";
+ option root-path "iscsi:192.168.50.1:::1:iqn.2009-06.dracut:target0";
host iscsi-1 {
hardware ethernet 52:54:00:12:34:00;

View File

@ -1,226 +0,0 @@
From c22c43f81a5f15c8759e6aa69773d0e9010c4741 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 12 Aug 2015 14:42:03 +0200
Subject: [PATCH] TEST-30-ISCSI: switch to scsi-target-utils
netbsd-iscsi is not available on RHEL
Beef up the testsuite to use the two targets over different
interfaces.
Test the new iSCSI parameters rd.iscsi.waitnet and rd.iscsi.testroute.
---
README.testsuite | 2 +-
test/TEST-30-ISCSI/server-init.sh | 17 ++++++++++-
test/TEST-30-ISCSI/targets | 25 ----------------
test/TEST-30-ISCSI/test.sh | 62 ++++++++++++++++++++++++++-------------
4 files changed, 59 insertions(+), 47 deletions(-)
delete mode 100644 test/TEST-30-ISCSI/targets
diff --git a/README.testsuite b/README.testsuite
index b539d90..f9f60d4 100644
--- a/README.testsuite
+++ b/README.testsuite
@@ -6,9 +6,9 @@ mdadm \
lvm2 \
cryptsetup \
nfs-utils \
-netbsd-iscsi \
nbd \
dhcp-server \
+scsi-target-utils \
iscsi-initiator-utils
diff --git a/test/TEST-30-ISCSI/server-init.sh b/test/TEST-30-ISCSI/server-init.sh
index 0407b17..64a4755 100755
--- a/test/TEST-30-ISCSI/server-init.sh
+++ b/test/TEST-30-ISCSI/server-init.sh
@@ -12,10 +12,25 @@ ip link set lo up
ip link set dev eth0 name ens3
ip addr add 192.168.50.1/24 dev ens3
ip link set ens3 up
+ip link set dev eth1 name ens4
+ip addr add 192.168.51.1/24 dev ens4
+ip link set ens4 up
>/var/lib/dhcpd/dhcpd.leases
chmod 777 /var/lib/dhcpd/dhcpd.leases
dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
-/usr/sbin/iscsi-target -D -t iqn.2009-06.dracut &
+
+tgtd
+tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2009-06.dracut:target0
+tgtadm --lld iscsi --mode target --op new --tid 2 --targetname iqn.2009-06.dracut:target1
+tgtadm --lld iscsi --mode target --op new --tid 3 --targetname iqn.2009-06.dracut:target2
+tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/sdb
+tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/sdc
+tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/sdd
+tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101
+tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101
+tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101
+
+
# Wait forever for the VM to die
echo "Serving iSCSI"
while :; do
diff --git a/test/TEST-30-ISCSI/targets b/test/TEST-30-ISCSI/targets
deleted file mode 100644
index 6a6872e..0000000
--- a/test/TEST-30-ISCSI/targets
+++ /dev/null
@@ -1,25 +0,0 @@
-# $NetBSD: targets,v 1.2 2006/03/04 21:53:16 agc Exp $
-#
-# Structure of this file:
-#
-# + an extent is a straight (offset, length) pair of a file or device
-# it's the lowest common storage denominator
-# at least one is needed
-# + a device is made up of one or more extents or other devices
-# devices can be added in a hierachical manner, to enhance resilience
-# + in this example, no device definitions are necessary, as the target
-# will just use a simple extent for persistent storage
-# + a target is made up of 1 or more devices
-# The code does not support RAID1 recovery at present
-
-# Simple file showing 1 extent, mapped straight into 1 target
-
-# extents file start length
-extent0 /dev/sdb 0 20971520
-extent1 /dev/sdc 0 20971520
-extent2 /dev/sdd 0 20971520
-
-# target flags storage netmask
-target0 rw extent0 192.168.50.0/24
-target1 rw extent1 192.168.50.0/24
-target2 rw extent2 192.168.50.0/24
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index 59e9c5b..cc6ec4e 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/test.sh
@@ -3,8 +3,10 @@ TEST_DESCRIPTION="root filesystem over iSCSI"
KVERSION=${KVERSION-$(uname -r)}
-#DEBUGFAIL="rd.shell"
-#SERIAL="tcp:127.0.0.1:9999"
+#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 "
+DEBUGFAIL="loglevel=1"
+#SERVER_DEBUG="rd.debug loglevel=7"
+SERIAL="tcp:127.0.0.1:9999"
SERIAL="null"
run_server() {
@@ -16,12 +18,13 @@ run_server() {
-drive format=raw,index=1,media=disk,file=$TESTDIR/root.ext3 \
-drive format=raw,index=2,media=disk,file=$TESTDIR/iscsidisk2.img \
-drive format=raw,index=3,media=disk,file=$TESTDIR/iscsidisk3.img \
- -m 256M -smp 2 \
+ -m 512M -smp 2 \
-display none \
-serial $SERIAL \
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
+ -net nic,macaddr=52:54:00:12:34:57,model=e1000 \
-net socket,listen=127.0.0.1:12330 \
- -append "root=/dev/sda rootfstype=ext3 rw rd.debug loglevel=77 console=ttyS0,115200n81 selinux=0" \
+ -append "root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
-initrd $TESTDIR/initramfs.server \
-pidfile $TESTDIR/server.pid -daemonize || return 1
sudo chmod 644 $TESTDIR/server.pid || return 1
@@ -41,10 +44,11 @@ run_client() {
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/client.img \
- -m 256M -smp 2 -nographic \
+ -m 512M -smp 2 -nographic \
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
+ -net nic,macaddr=52:54:00:12:34:01,model=e1000 \
-net socket,connect=127.0.0.1:12330 \
- -append "$* rw quiet rd.auto rd.retry=5 rd.debug rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
+ -append "$* rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL" \
-initrd $TESTDIR/initramfs.testing
if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then
echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
@@ -56,20 +60,39 @@ run_client() {
}
do_test_run() {
+ run_client "root=dhcp" \
+ "root=/dev/root netroot=dhcp ip=ens3:dhcp" \
+ || return 1
-#
-# run_client "root=dhcp" \
-# "root=dhcp" \
-# || return 1
+ run_client "netroot=iscsi target0"\
+ "root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \
+ "ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \
+ || return 1
- run_client "netroot=iscsi target0"\
- "root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \
- "ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \
+ run_client "netroot=iscsi target1 target2" \
+ "root=LABEL=sysroot" \
+ "ip=192.168.50.101:::255.255.255.0::ens3:off" \
+ "ip=192.168.51.101:::255.255.255.0::ens4:off" \
+ "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
+ "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+ || return 1
+
+ run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \
+ "root=LABEL=sysroot" \
+ "ip=192.168.50.101:::255.255.255.0::ens3:off" \
+ "ip=192.168.51.101:::255.255.255.0::ens4:off" \
+ "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
+ "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+ "rd.waitnet=0" \
|| return 1
- run_client "netroot=iscsi target1 target2" \
- "root=LABEL=sysroot ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \
- "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+ run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
+ "root=LABEL=sysroot" \
+ "ip=192.168.50.101:::255.255.255.0::ens3:off" \
+ "ip=192.168.51.101:::255.255.255.0::ens4:off" \
+ "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
+ "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+ "rd.waitnet=0 rd.iscsi.testroute=0" \
|| return 1
return 0
}
@@ -170,7 +193,7 @@ test_setup() {
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
- -o "dash plymouth dmraid" \
+ -o "dash plymouth dmraid nfs" \
-a "debug" \
-d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod" \
--no-hostonly-cmdline -N \
@@ -195,13 +218,12 @@ test_setup() {
dmesg mkdir cp ping \
modprobe tcpdump setsid \
/etc/services sleep mount chmod
- inst_multiple /usr/sbin/iscsi-target
+ inst_multiple tgtd tgtadm
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[ -f ${_terminfodir}/l/linux ] && break
done
inst_multiple -o ${_terminfodir}/l/linux
instmods iscsi_tcp crc32c ipv6
- inst ./targets /etc/iscsi/targets
[ -f /etc/netconfig ] && inst_multiple /etc/netconfig
type -P dhcpd >/dev/null && inst_multiple dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
@@ -223,7 +245,7 @@ test_setup() {
# Make server's dracut image
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-a "dash udev-rules base rootfs-block fs-lib debug kernel-modules" \
- -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000" \
+ -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 drbg" \
--no-hostonly-cmdline -N \
-f $TESTDIR/initramfs.server $KVERSION || return 1

View File

@ -1,27 +0,0 @@
From 69171aa8fa4bdd196709318582d73076677bd16c Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 12 Aug 2015 15:11:17 +0200
Subject: [PATCH] dracut.cmdline.7.asc: document rd.iscsi.waitnet and
rd.iscsi.testroute
---
dracut.cmdline.7.asc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index 1a54377..8c7e965 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -713,6 +713,12 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
**rd.iscsi.ibft** **rd.iscsi.ibft=1**:
Turn on iBFT autoconfiguration for the interfaces
+**rd.iscsi.waitnet=0**:
+ Turn off waiting for all interfaces to be up before trying to login to the iSCSI targets.
+
+**rd.iscsi.testroute=0**:
+ Turn off checking, if the route to the iSCSI target IP is possible before trying to login.
+
FCoE
~~~~
**fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__::

View File

@ -1,41 +0,0 @@
From feb8dc685dca1229c517de9ec9854367b8c49524 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 12 Aug 2015 15:14:11 +0200
Subject: [PATCH] iscsi/parse-iscsiroot.sh: use iBFT initiator name
---
modules.d/95iscsi/parse-iscsiroot.sh | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
index 2532ada..a889da1 100755
--- a/modules.d/95iscsi/parse-iscsiroot.sh
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
@@ -58,7 +58,7 @@ if [ -n "$iscsiroot" ] ; then
fi
# iscsi_firmware does not need argument checking
-if [ -n "$iscsi_firmware" ] ; then
+if [ -n "$iscsi_firmware" ] || getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then
[ -z "$netroot" ] && netroot=iscsi:
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
modprobe -b -q iscsi_ibft
@@ -97,6 +97,18 @@ if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ]; then
fi
fi
+# If not given on the cmdline and initiator-name available via iBFT
+if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
+ iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
+ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
+ rm -f /etc/iscsi/initiatorname.iscsi
+ mkdir -p /etc/iscsi
+ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
+ systemctl restart iscsid
+ sleep 1
+ > /tmp/iscsi_set_initiator
+fi
+
if [ -n "$iscsi_firmware" ] ; then
echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
else

View File

@ -1,56 +0,0 @@
From 6802cf23499b05544079b26a39e339bb3476d38d Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 13 Aug 2015 11:53:21 +0200
Subject: [PATCH] iscsi/iscsiroot.sh: handle timeout with all interfaces up
restart iscsid, because it may disbehaved
---
modules.d/95iscsi/iscsiroot.sh | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index fc62425..ad95812 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -197,13 +197,14 @@ handle_netroot()
${iscsi_in_password:+-W $iscsi_in_password} \
${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
- ${iscsi_param} >/dev/null 2>&1
+ ${iscsi_param} >/dev/null 2>&1 \
+ && { > $hookdir/initqueue/work ; }
else
- systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1
+ systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1 \
+ && { > $hookdir/initqueue/work ; }
fi
fi
else
- > $hookdir/initqueue/work
iscsistart -i $iscsi_initiator -t $iscsi_target_name \
-g $iscsi_target_group -a $iscsi_target_ip \
-p $iscsi_target_port \
@@ -214,7 +215,7 @@ handle_netroot()
${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
${iscsi_param} \
- || :
+ && { > $hookdir/initqueue/work ; }
fi
netroot_enc=$(str_replace "$1" '/' '\2f')
echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
@@ -227,6 +228,14 @@ if [ "$netif" != "dummy" ] && getargbool 1 rd.iscsi.waitnet; then
all_ifaces_up || exit 0
fi
+if [ "$netif" = "dummy" ] && all_ifaces_up; then
+ # s.th. went wrong and the timeout script hits
+ # restart
+ systemctl restart iscsid
+ # damn iscsid is not ready after unit says it's ready
+ sleep 2
+fi
+
# loop over all netroot parameter
netroot=$(getarg netroot)
if [ $? -eq 0 ] && [ "$netroot" != "dhcp" ]; then

View File

@ -1,91 +0,0 @@
From 0a66b74b51f7d58916504e0e8bb01b6e981b489b Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 13 Aug 2015 11:54:24 +0200
Subject: [PATCH] TEST-30-ISCSI: test more and set static initiator name
---
test/TEST-30-ISCSI/test.sh | 42 ++++++++++++++++++++++++++++++------------
1 file changed, 30 insertions(+), 12 deletions(-)
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index cc6ec4e..be3399a 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/test.sh
@@ -48,7 +48,7 @@ run_client() {
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
-net nic,macaddr=52:54:00:12:34:01,model=e1000 \
-net socket,connect=127.0.0.1:12330 \
- -append "$* rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL" \
+ -append "rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL $*" \
-initrd $TESTDIR/initramfs.testing
if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then
echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
@@ -60,22 +60,27 @@ run_client() {
}
do_test_run() {
+ initiator=$(iscsi-iname)
+
run_client "root=dhcp" \
- "root=/dev/root netroot=dhcp ip=ens3:dhcp" \
+ "root=/dev/root netroot=dhcp ip=ens3:dhcp" \
+ "rd.iscsi.initiator=$initiator" \
|| return 1
run_client "netroot=iscsi target0"\
- "root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \
- "ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \
+ "root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \
+ "ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \
+ "rd.iscsi.initiator=$initiator" \
|| return 1
run_client "netroot=iscsi target1 target2" \
- "root=LABEL=sysroot" \
- "ip=192.168.50.101:::255.255.255.0::ens3:off" \
- "ip=192.168.51.101:::255.255.255.0::ens4:off" \
- "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
- "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
- || return 1
+ "root=LABEL=sysroot" \
+ "ip=192.168.50.101:::255.255.255.0::ens3:off" \
+ "ip=192.168.51.101:::255.255.255.0::ens4:off" \
+ "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
+ "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+ "rd.iscsi.initiator=$initiator" \
+ || return 1
run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \
"root=LABEL=sysroot" \
@@ -83,7 +88,8 @@ do_test_run() {
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
- "rd.waitnet=0" \
+ "rd.iscsi.initiator=$initiator" \
+ "rd.waitnet=0 rd.retry=30" \
|| return 1
run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
@@ -92,8 +98,20 @@ do_test_run() {
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
- "rd.waitnet=0 rd.iscsi.testroute=0" \
+ "rd.iscsi.initiator=$initiator" \
+ "rd.waitnet=0 rd.iscsi.testroute=0 rd.retry=30" \
|| return 1
+
+ run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0 default GW" \
+ "root=LABEL=sysroot" \
+ "ip=192.168.50.101::192.168.50.1:255.255.255.0::ens3:off" \
+ "ip=192.168.51.101::192.168.51.1:255.255.255.0::ens4:off" \
+ "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
+ "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+ "rd.iscsi.initiator=$initiator" \
+ "rd.waitnet=0 rd.iscsi.testroute=0 rd.retry=30" \
+ || return 1
+
return 0
}

View File

@ -1,30 +0,0 @@
From 110858025aab221d135335d85dba9317f5ef15c6 Mon Sep 17 00:00:00 2001
From: Stijn Hoop <stijn@sandcat.nl>
Date: Sun, 23 Aug 2015 14:45:53 +0200
Subject: [PATCH] The default gateway might need a static route
Some hosting providers need a static route set in order to be
able to reach the default gateway. Be sure to retry adding
the default gateway after setting the static routes.
---
modules.d/40network/net-lib.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index 5c65a2e..2e79619 100755
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -129,6 +129,13 @@ setup_net() {
fi
done
+ # If a static route was necessary to reach the gateway, the
+ # first gateway setup call will have failed with
+ # RTNETLINK answers: Network is unreachable
+ # Replace the default route again after static routes to cover
+ # this scenario.
+ [ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
+
# Handle STP Timeout: arping the default gateway.
# (or the root server, if a) it's local or b) there's no gateway.)
# Note: This assumes that if no router is present the

View File

@ -1,23 +0,0 @@
From 9918afd244cbee479af4380c1fa2a7a81fba6bed Mon Sep 17 00:00:00 2001
From: Lidong Zhong <lzhong@suse.com>
Date: Mon, 24 Aug 2015 18:02:10 +0800
Subject: [PATCH] dracut-functions.sh: remove duplicate declaratio of local
variable
---
dracut-functions.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index d559903..cb88078 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -429,7 +429,7 @@ shorten_persistent_dev() {
# $ find_block_device /usr
# 8:4
find_block_device() {
- local _majmin _dev _majmin _find_mpt
+ local _dev _majmin _find_mpt
_find_mpt="$1"
if [[ $use_fstab != yes ]]; then
[[ -d $_find_mpt/. ]]

View File

@ -1,22 +0,0 @@
From aa169b3bd37b74bdf1e15318ab423ef4b9001fd2 Mon Sep 17 00:00:00 2001
From: Lidong Zhong <lzhong@suse.com>
Date: Mon, 24 Aug 2015 18:27:54 +0800
Subject: [PATCH] dracut.sh: remove duplicate call of push_host_devs
There is no way exit between the two places that call push_host_devs
---
dracut.sh | 1 -
1 file changed, 1 deletion(-)
diff --git a/dracut.sh b/dracut.sh
index f7d31a4..8ca319b 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1113,7 +1113,6 @@ if [[ $hostonly ]]; then
_dev=$(find_block_device "$mp")
_bdev=$(readlink -f "/dev/block/$_dev")
[[ -b $_bdev ]] && _dev=$_bdev
- push_host_devs $_dev
[[ "$mp" == "/" ]] && root_devs+=("$_dev")
push_host_devs "$_dev"
if [[ $(find_mp_fstype "$mp") == btrfs ]]; then

View File

@ -1,23 +0,0 @@
From ea877ac6cc3df38d22728437b8a70bedee558f6a Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 3 Sep 2015 12:31:34 +0200
Subject: [PATCH] dracut-functions.sh: fixed dracutbasedir, when sourced
directly
---
dracut-functions.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index d559903..3982fc8 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -96,7 +96,7 @@ find_binary() {
if ! [[ $dracutbasedir ]]; then
dracutbasedir=${BASH_SOURCE[0]%/*}
- [[ $dracutbasedir = "dracut-functions" ]] && dracutbasedir="."
+ [[ $dracutbasedir = dracut-functions* ]] && dracutbasedir="."
[[ $dracutbasedir ]] || dracutbasedir="."
dracutbasedir="$(readlink -f $dracutbasedir)"
fi

View File

@ -1,22 +0,0 @@
From 5cb1e0efea5a331a743a6abac130003ad08b50ff Mon Sep 17 00:00:00 2001
From: yuwata <watanabe.yu+github@gmail.com>
Date: Mon, 7 Sep 2015 17:58:00 +0900
Subject: [PATCH] systemd-initrd: fix typo in error message.
---
modules.d/01systemd-initrd/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/01systemd-initrd/module-setup.sh b/modules.d/01systemd-initrd/module-setup.sh
index e313967..fb6a9ea 100755
--- a/modules.d/01systemd-initrd/module-setup.sh
+++ b/modules.d/01systemd-initrd/module-setup.sh
@@ -5,7 +5,7 @@ check() {
[[ $mount_needs ]] && return 1
if ! dracut_module_included "systemd"; then
- derror "dracut-systemd needs systemd in the initramfs"
+ derror "systemd-initrd needs systemd in the initramfs"
return 1
fi

View File

@ -1,22 +0,0 @@
From 0888cf51ab82659ba71bca5ae6c5b6abe9a5ef06 Mon Sep 17 00:00:00 2001
From: yuwata <watanabe.yu+github@gmail.com>
Date: Mon, 7 Sep 2015 17:58:40 +0900
Subject: [PATCH] systemd-networkd: fix typo in error message
---
modules.d/02systemd-networkd/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/02systemd-networkd/module-setup.sh b/modules.d/02systemd-networkd/module-setup.sh
index df4661f..58842c0 100755
--- a/modules.d/02systemd-networkd/module-setup.sh
+++ b/modules.d/02systemd-networkd/module-setup.sh
@@ -5,7 +5,7 @@ check() {
[[ $mount_needs ]] && return 1
if ! dracut_module_included "systemd"; then
- derror "dracut-systemd needs systemd in the initramfs"
+ derror "systemd-networkd needs systemd in the initramfs"
return 1
fi

View File

@ -1,23 +0,0 @@
From fc212358dab07011398c002849b2ebf8a412ffc8 Mon Sep 17 00:00:00 2001
From: yuwata <watanabe.yu+github@gmail.com>
Date: Mon, 7 Sep 2015 18:00:16 +0900
Subject: [PATCH] install blob: fix typos in usage.
---
install/dracut-install.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/install/dracut-install.c b/install/dracut-install.c
index 0ff5c49..a7bfdb8 100644
--- a/install/dracut-install.c
+++ b/install/dracut-install.c
@@ -709,7 +709,8 @@ static void usage(int status)
" -L --logdir <DIR> Log files, which were installed from the host to <DIR>\n"
" -R --resolvelazy Only install shebang executables and libraries\n"
" for all SOURCE files\n"
- " -H --fips Also install all '.SOURCE.hmac' files\n"
+ " -H --hostonly Mark all SOURCE files as hostonly\n\n"
+ " -f --fips Also install all '.SOURCE.hmac' files\n"
" -v --verbose Show more output\n"
" --debug Show debug output\n"
" --version Show package version\n"

View File

@ -1,19 +0,0 @@
From 820f81016a31f069dc8ef9d7a6b65ffc1166daa5 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 9 Sep 2015 11:30:52 +0200
Subject: [PATCH] dracut.8.asc: mention lsinitrd(1) in see also
---
dracut.8.asc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut.8.asc b/dracut.8.asc
index 7a7ef9d..1fbbda4 100644
--- a/dracut.8.asc
+++ b/dracut.8.asc
@@ -536,4 +536,4 @@ Will Woods
SEE ALSO
--------
-*dracut.cmdline*(7) *dracut.conf*(5)
+*dracut.cmdline*(7) *dracut.conf*(5) *lsinitrd*(1)

View File

@ -1,23 +0,0 @@
From 10d03bbfbc30a4ff596ffc77b73acdceef5a7826 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Thu, 17 Sep 2015 11:33:40 -0400
Subject: [PATCH] dir-locals: Avoid use of setq which triggers Emacs warning
Emacs has a whitelist of "safe" variables, using `setq` overrides
that and causes it to warn when opening any file by default.
Dropping the `setq` makes Emacs do the right thing.
---
.dir-locals.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.dir-locals.el b/.dir-locals.el
index cbbcec4..8130058 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -1,3 +1,3 @@
-((nil . ((setq sh-basic-offset: 4)
- (setq indent-tabs-mode nil)
+((nil . ((sh-basic-offset . 4)
+ (indent-tabs-mode . nil)
)))

View File

@ -1,121 +0,0 @@
From 3ce142861d88c357864d3a3bef7ec453826d737d Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Date: Wed, 4 Nov 2015 11:31:10 +0900
Subject: [PATCH] lsinitrd: Suppress "cat: write error: Broken pipe"
On systemd, SIGPIPE is ignored by default; see man 5 systemd.exec for
IgnoreSIGPIPE=. As a result, lsinitrd.sh under a systemd service
outputs "cat: write error: Broken pipe" in the processing of
determining a compression format of a given initramfs file using cat
command in the write part of a pipeline processing.
For example, this is a log message of kdump.service in RHEL7.1,
-- Logs begin at Wed 2015-11-04 09:57:33 JST, end at Wed 2015-11-04 09:58:28 JST. --
Nov 04 09:57:33 localhost systemd[1]: Stopping Crash recovery kernel arming...
Nov 04 09:57:33 localhost kdumpctl[22545]: kexec: unloaded kdump kernel
Nov 04 09:57:33 localhost kdumpctl[22545]: Stopping kdump: [OK]
Nov 04 09:57:33 localhost systemd[1]: Starting Crash recovery kernel arming...
Nov 04 09:57:36 localhost kdumpctl[22553]: Detected change(s) in the following file(s):
Nov 04 09:57:36 localhost kdumpctl[22553]: /etc/kdump.conf
Nov 04 09:57:36 localhost kdumpctl[22553]: Rebuilding /boot/initramfs-3.10.0-229.el7.x86_64kdump.img
Nov 04 09:57:40 localhost dracut[24914]: Executing: /usr/sbin/dracut --hostonly --hostonly-cmdline -o "plymouth dash resume" -f /boot/initramfs-3.10.0-229.el7.x86_64kdump.img 3.10.0-229.el7.x86_64
...<cut>...
Nov 04 09:58:12 localhost dracut[24914]: *** Creating image file done ***
Nov 04 09:58:12 localhost dracut[24914]: Image: /boot/initramfs-3.10.0-229.el7.x86_64kdump.img: 18M
Nov 04 09:58:12 localhost kdumpctl[22553]: cat: write error: Broken pipe
Nov 04 09:58:12 localhost dracut[24914]: ========================================================================
Nov 04 09:58:12 localhost dracut[24914]: Version: dracut-033-240.el7
Nov 04 09:58:12 localhost dracut[24914]:
Nov 04 09:58:12 localhost dracut[24914]: Arguments: --hostonly --hostonly-cmdline -o 'plymouth dash resume' -f
Nov 04 09:58:13 localhost dracut[24914]:
Nov 04 09:58:13 localhost dracut[24914]: dracut modules:
Nov 04 09:58:13 localhost dracut[24914]: bash
kdump.service builds and loads an initramfs for kdump kernel using
kdumpctl command which uses dracut command and so lsinitrd command,
too.
Although there's no actual harm except for the error message, there
has been several inquiries from customers about this message so
far. We should suppress this message to reduce needless
communications.
To suppress the message, this commit cleans up the processing of
reading the first 6 bytes of a given initramfs file without cat
command.
---
lsinitrd.sh | 59 ++++++++++++++++++++++++++++-------------------------------
1 file changed, 28 insertions(+), 31 deletions(-)
diff --git a/lsinitrd.sh b/lsinitrd.sh
index d2ddd76..441fb92 100755
--- a/lsinitrd.sh
+++ b/lsinitrd.sh
@@ -176,38 +176,35 @@ case $bin in
;;
esac
-CAT=$({
- if [[ $SKIP ]]; then
- $SKIP "$image"
+if [[ $SKIP ]] ; then
+ bin="$($SKIP "$image" | { read -N 6 bin && echo "$bin" ; })"
+else
+ read -N 6 bin < "$image"
+fi
+case $bin in
+ $'\x1f\x8b'*)
+ CAT="zcat --"
+ ;;
+ BZh*)
+ CAT="bzcat --"
+ ;;
+ $'\x71\xc7'*|070701)
+ CAT="cat --"
+ ;;
+ $'\x02\x21'*)
+ CAT="lz4 -d -c"
+ ;;
+ $'\x89'LZO$'\0'*)
+ CAT="lzop -d -c"
+ ;;
+ *)
+ if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
+ CAT="xzcat --single-stream --"
else
- cat "$image"
- fi } | {
- read -N 6 bin
- case $bin in
- $'\x1f\x8b'*)
- echo "zcat --"
- ;;
- BZh*)
- echo "bzcat --"
- ;;
- $'\x71\xc7'*|070701)
- echo "cat --"
- ;;
- $'\x02\x21'*)
- echo "lz4 -d -c"
- ;;
- $'\x89'LZO$'\0'*)
- echo "lzop -d -c"
- ;;
- *)
- if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
- echo "xzcat --single-stream --"
- else
- echo "xzcat --"
- fi
- ;;
- esac
- })
+ CAT="xzcat --"
+ fi
+ ;;
+esac
skipcpio()
{

View File

@ -1,26 +0,0 @@
From eb150a4feedf5ae3d8393ce365357bc40cced1b8 Mon Sep 17 00:00:00 2001
From: Silvio Fricke <silvio.fricke@gmail.com>
Date: Sun, 8 Nov 2015 12:48:26 +0100
Subject: [PATCH] PKGFILE: update to latest makepkg
makepkg needs now a package-section.
Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
---
PKGBUILD | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/PKGBUILD b/PKGBUILD
index f7c3664..a9f1b5a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -17,5 +17,9 @@ md5sums=()
build() {
cd ..
make sysconfdir=/etc || return 1
+}
+
+package() {
+ cd ..
make DESTDIR="${pkgdir}" sysconfdir=/etc install || return 1
}

View File

@ -1,42 +0,0 @@
From 4cca17eeeca4254248d58562f2ae6b56a885b91e Mon Sep 17 00:00:00 2001
From: Silvio Fricke <silvio.fricke@gmail.com>
Date: Sun, 8 Nov 2015 12:49:45 +0100
Subject: [PATCH] PKGFILE: version is now completely constructed from git
`pkgver` and `pkgrel` now hard coded to 1. The PKGFILE will getting
changed on a `makepkg`-run.
To prevent some version crashes no commit with changes to `pkgver` and
`pkgrel` should be accepted.
Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
---
PKGBUILD | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/PKGBUILD b/PKGBUILD
index a9f1b5a..c625bdb 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=dracut-git
-pkgver=$(date +%s)
-pkgrel=$(git log --pretty=format:%h |head -n 1)
+pkgver=1
+pkgrel=1
pkgdesc="Initramfs generation utility"
arch=('i686' 'x86_64')
url="https://dracut.wiki.kernel.org/"
@@ -14,6 +14,12 @@ backup=(etc/dracut.conf)
source=()
md5sums=()
+pkgver() {
+ cd ..
+ desc="$(git describe)"
+ printf "%s.%s.%s" ${desc//-/ }
+}
+
build() {
cd ..
make sysconfdir=/etc || return 1

View File

@ -1,32 +0,0 @@
From 0d5c02d3ab7b71a09d5d7b52a771f0fe0f32e4e2 Mon Sep 17 00:00:00 2001
From: Silvio Fricke <silvio.fricke@gmail.com>
Date: Sun, 8 Nov 2015 12:53:36 +0100
Subject: [PATCH] PKGFILE: prevent out of tree builds
With makepkg is it possible to build sources away from the PKGFILE. The
previous behavior was crash on build if this was setup. With this
patch we prevent this possibility.
Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
---
PKGBUILD | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/PKGBUILD b/PKGBUILD
index c625bdb..05a32b0 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -14,6 +14,13 @@ backup=(etc/dracut.conf)
source=()
md5sums=()
+# out of tree builds disallowed for this PKGFILE
+BUILDDIR="${PWD}"
+PKGDEST="${PWD}"
+SRCDEST=""
+SRCPKGDEST=""
+LOGDEST=""
+
pkgver() {
cd ..
desc="$(git describe)"

View File

@ -1,25 +0,0 @@
From 8e1c4b354cdc01f32d7903fbd7564c2ea2a5a7a1 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 9 Nov 2015 15:33:27 +0100
Subject: [PATCH] dracut-logger: prefix stderr output with "dracut: "
dnf updates of the kernel execute dracut in %post.
For the user it is not possible to distinguish the dracut output from
other error messages.
---
dracut-logger.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-logger.sh b/dracut-logger.sh
index e5c9358..d1cee98 100755
--- a/dracut-logger.sh
+++ b/dracut-logger.sh
@@ -324,7 +324,7 @@ _do_dlog() {
local msg="$*"
local lmsg="$lvlc: $*"
- (( $lvl <= $stdloglvl )) && echo "$msg" >&2
+ (( $lvl <= $stdloglvl )) && printf -- 'dracut: %s\n' "$msg" >&2
if (( $lvl <= $sysloglvl )); then
if [[ "$_dlogfd" ]]; then

View File

@ -1,23 +0,0 @@
From 97be933592a00289fba3755cf3a9aa3c5d3c4ee9 Mon Sep 17 00:00:00 2001
From: Frederick Grose <fgrose@sugarlabs.org>
Date: Mon, 9 Nov 2015 09:45:07 -0800
Subject: [PATCH] dmsquash-live-root: Request overflow support for persistent
snapshot.
---
modules.d/90dmsquash-live/dmsquash-live-root.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
index 531617e..714e1dc 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
@@ -171,7 +171,7 @@ do_live_overlay() {
# Create a snapshot of the base image
echo 0 $sz thin /dev/mapper/live-overlay-pool 0 $base | dmsetup create live-rw
else
- echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
+ echo 0 $sz snapshot $base $over PO 8 | dmsetup create live-rw
fi
# Create a device that always points to a ro base image

View File

@ -1,45 +0,0 @@
From 49c9d8174ff7c25158861872bc0ea04a8cf2d242 Mon Sep 17 00:00:00 2001
From: Frederick Grose <fgrose@sugarlabs.org>
Date: Mon, 9 Nov 2015 10:46:27 -0800
Subject: [PATCH] dmsquash-live-root: Use non-persistent metadata snapshots.
Transient snapshots can take advantage of smaller,
non-persistent metadata structures.
Make the --readonly option explicit rather than inferred
for the readonly_overlay target.
Assure that the live-base target is on the BASE_LOOPDEV.
---
modules.d/90dmsquash-live/dmsquash-live-root.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
index 531617e..caf473b 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
@@ -141,7 +141,7 @@ do_live_overlay() {
# set up the snapshot
sz=$(blockdev --getsz $BASE_LOOPDEV)
if [ -n "$readonly_overlay" ]; then
- echo 0 $sz snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create $readonly_overlay live-ro
+ echo 0 $sz snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV N 8 | dmsetup create --readonly live-ro
base="/dev/mapper/live-ro"
over=$RO_OVERLAY_LOOPDEV
else
@@ -175,7 +175,7 @@ do_live_overlay() {
fi
# Create a device that always points to a ro base image
- echo 0 $sz linear $base 0 | dmsetup create --readonly live-base
+ echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base
}
# live cd helper function
@@ -259,7 +259,7 @@ fi
if [ -b "$OSMIN_LOOPDEV" ]; then
# set up the devicemapper snapshot device, which will merge
# the normal live fs image, and the delta, into a minimzied fs image
- echo "0 $( blockdev --getsz $BASE_LOOPDEV ) snapshot $BASE_LOOPDEV $OSMIN_LOOPDEV p 8" | dmsetup create --readonly live-osimg-min
+ echo "0 $( blockdev --getsz $BASE_LOOPDEV ) snapshot $BASE_LOOPDEV $OSMIN_LOOPDEV N 8" | dmsetup create --readonly live-osimg-min
fi
ROOTFLAGS="$(getarg rootflags)"

View File

@ -1,23 +0,0 @@
From 8019e0eef3d36a4933ab96a8a8edfef5f3685593 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 30 Sep 2015 14:10:05 +0200
Subject: [PATCH] Makefile: fix VERSION and GITVERSION
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index f3a5c07..8454c63 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
-include dracut-version.sh
-VERSION = $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION))
-GITVERSION = $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
+VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION))
+GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
-include Makefile.inc

View File

@ -1,33 +0,0 @@
From 9befacf0c51e15fe8a199242c3bfd97d1adf455c Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 30 Sep 2015 14:10:20 +0200
Subject: [PATCH] dracut.spec: omit pkg-config from dependencies
---
dracut.spec | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dracut.spec b/dracut.spec
index 6ef5de7..d0bb9bd 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -1,6 +1,11 @@
%define dracutlibdir %{_prefix}/lib/dracut
%bcond_without doc
+# We ship a .pc file but don't want to have a dep on pkg-config. We
+# strip the automatically generated dep here and instead co-own the
+# directory.
+%global __requires_exclude pkg-config
+
# Variables must be defined
%define with_nbd 1
@@ -327,6 +332,7 @@ rm -rf -- $RPM_BUILD_ROOT
%endif
%dir %{_sysconfdir}/dracut.conf.d
%dir %{dracutlibdir}/dracut.conf.d
+%dir %{_datadir}/pkgconfig
%{_datadir}/pkgconfig/dracut.pc
%if %{with doc}

View File

@ -1,23 +0,0 @@
From c97209fe69dbbacb1f87acf5ec8a0e558e553ddc Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 10 Nov 2015 17:35:27 +0100
Subject: [PATCH] fips: add authenc and authencesn kernel modules
https://bugzilla.redhat.com/show_bug.cgi?id=1115112#c5
---
modules.d/01fips/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh
index 758bf6b..7278347 100755
--- a/modules.d/01fips/module-setup.sh
+++ b/modules.d/01fips/module-setup.sh
@@ -13,7 +13,7 @@ depends() {
# called by dracut
installkernel() {
local _fipsmodules _mod
- _fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
+ _fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 authenc authencesn blowfish camellia cast6 cbc ccm "
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "

View File

@ -1,98 +0,0 @@
From 53a738465371db3cb7df533a3ae2b5648dfd13e4 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 10 Nov 2015 17:55:50 +0100
Subject: [PATCH] lvm: remove all quirk arguments
https://bugzilla.redhat.com/show_bug.cgi?id=742564
Once lvm2 starts using /run (bug 742554), it should be no longer
necessary to disable file-based locking in the vgchange call in
fedora-storage-init.
Removing '--sysinit' will make it safe to call LVM operations
concurrently from other units.
The --sysinit is a compound option consisting of:
-> --ignorelockingfailure - not needed anymore, the /run/lock/lvm is
available rw soon in boot process
-> --ignoremonitoring - not needed since /run is available, this would
require the dm-event.service to be run before
fedora-storage-init.service (and new lvm2-activation.service when
deployed). But that's a one line change - I'll have a look whether it
plays well with other services and if yes, I'll commit the change. N.B.:
This has a consequence that all volumes activated on vgchange -ay will
be monitored at the same time they're activated (which is a plus I
think). The lvm2-monitor will just grab all the other volumes not
activated at the time of the boot's vgchange -ay call. But that's not an
issue (for already monitored volumes, calling vgchange --monitor y will
just be a NOOP).
-> --poll n - not needed, we can run the polldaemon as the /run is
available and rw (in case there's unfinished merge or mirror sync from
previous system run, the poll-daemon will be triggered at boot now).
Actually, the polldaemon should be triggered as a service like dmeventd
is, not forked off from the LVM command itself, like from vgchange in
this case - we still need to change this - there's a bug open for this
request already (bug #814857). However, we don't have this feature ready
yet so I need to check whether this is OK with the early boot process
with the current state.
---
modules.d/90lvm/lvm_scan.sh | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh
index ead28aa..8bf0864 100755
--- a/modules.d/90lvm/lvm_scan.sh
+++ b/modules.d/90lvm/lvm_scan.sh
@@ -69,11 +69,19 @@ min=$2
sub=${3%% *}
sub=${sub%%\(*};
+lvm_ignorelockingfailure="--ignorelockingfailure"
+lvm_quirk_args="--ignorelockingfailure --ignoremonitoring"
+
check_lvm_ver 2 2 57 $maj $min $sub && \
- nopoll="--poll n"
+ lvm_quirk_args="$lvm_quirk_args --poll n"
if check_lvm_ver 2 2 65 $maj $min $sub; then
- sysinit=" --sysinit $extraargs"
+ lvm_quirk_args=" --sysinit $extraargs"
+fi
+
+if check_lvm_ver 2 2 221 $maj $min $sub; then
+ lvm_quirk_args=" $extraargs"
+ unset lvm_ignorelockingfailure
fi
unset extraargs
@@ -104,24 +112,16 @@ fi
if [ -n "$LVS" ] ; then
info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
- lvm lvscan --ignorelockingfailure 2>&1 | vinfo
+ lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo
for LV in $LVS; do
- if [ -z "$sysinit" ]; then
- lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LV 2>&1 | vinfo
- else
- lvm lvchange --yes -ay $sysinit $LV 2>&1 | vinfo
- fi
+ lvm lvchange --yes -ay $lvm_quirk_args $LV 2>&1 | vinfo
done
fi
if [ -z "$LVS" -o -n "$VGS" ]; then
info "Scanning devices $lvmdevs for LVM volume groups $VGS"
- lvm vgscan --ignorelockingfailure 2>&1 | vinfo
- if [ -z "$sysinit" ]; then
- lvm vgchange -ay --ignorelockingfailure $nopoll --ignoremonitoring $VGS 2>&1 | vinfo
- else
- lvm vgchange -ay $sysinit $VGS 2>&1 | vinfo
- fi
+ lvm vgscan $lvm_ignorelockingfailure 2>&1 | vinfo
+ lvm vgchange -ay $lvm_quirk_args $VGS 2>&1 | vinfo
fi
if [ "$lvmwritten" ]; then

View File

@ -1,38 +0,0 @@
From 875426f2fc1360401ddb5f97c67df031e54958d5 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 11 Nov 2015 11:38:56 +0100
Subject: [PATCH] dracut.sh: remove "_EARLY" from CONFIG_MICROCODE_* checks
EARLY is merged in the main driver
---
dracut.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 2712e9e..9ba481b 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1016,18 +1016,18 @@ fi
if [[ $early_microcode = yes ]]; then
if [[ $hostonly ]]; then
[[ $(get_cpu_vendor) == "AMD" ]] \
- && ! check_kernel_config CONFIG_MICROCODE_AMD_EARLY \
+ && ! check_kernel_config CONFIG_MICROCODE_AMD \
&& unset early_microcode
[[ $(get_cpu_vendor) == "Intel" ]] \
- && ! check_kernel_config CONFIG_MICROCODE_INTEL_EARLY \
+ && ! check_kernel_config CONFIG_MICROCODE_INTEL \
&& unset early_microcode
else
- ! check_kernel_config CONFIG_MICROCODE_AMD_EARLY \
- && ! check_kernel_config CONFIG_MICROCODE_INTEL_EARLY \
+ ! check_kernel_config CONFIG_MICROCODE_AMD \
+ && ! check_kernel_config CONFIG_MICROCODE_INTEL \
&& unset early_microcode
fi
[[ $early_microcode != yes ]] \
- && dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]_EARLY!=y"
+ && dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]!=y"
fi
# Need to be able to have non-root users read stuff (rpcbind etc)

View File

@ -1,25 +0,0 @@
From 2cc5e92e210d8eba1bce3068ca2be96b2427862d Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 11 Nov 2015 11:49:34 +0100
Subject: [PATCH] dracut.sh: quote $outfile on error removal
---
dracut.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dracut.sh b/dracut.sh
index 9ba481b..1169037 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1690,9 +1690,10 @@ if ! (
| $compress >> "$outfile"
); then
dfatal "dracut: creation of $outfile failed"
- rm -f $outfile
+ rm -f "$outfile"
exit 1
fi
+
dinfo "*** Creating initrd image file '$outfile' done ***"
if (( maxloglvl >= 5 )); then

View File

@ -1,34 +0,0 @@
From 64c34f34593984d93d4781f1e5fa008871e11963 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 11 Nov 2015 12:16:13 +0100
Subject: [PATCH] dracut-systemd/module-setup.sh: remove duplicate vconsole
wants
Adding the dependency on vconsole is already done in the 00systemd
module and the rescue.service has this already in the unit file.
---
modules.d/98dracut-systemd/module-setup.sh | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/modules.d/98dracut-systemd/module-setup.sh b/modules.d/98dracut-systemd/module-setup.sh
index d917557..900162c 100755
--- a/modules.d/98dracut-systemd/module-setup.sh
+++ b/modules.d/98dracut-systemd/module-setup.sh
@@ -43,17 +43,6 @@ install() {
inst_script "$moddir/rootfs-generator.sh" $systemdutildir/system-generators/dracut-rootfs-generator
- for i in \
- emergency.target \
- rescue.service \
- systemd-ask-password-console.service \
- systemd-ask-password-plymouth.service \
- ; do
- mkdir -p "${initdir}${systemdsystemunitdir}/${i}.wants"
- ln_r "${systemdsystemunitdir}/systemd-vconsole-setup.service" \
- "${systemdsystemunitdir}/${i}.wants/systemd-vconsole-setup.service"
- done
-
mkdir -p "${initdir}/$systemdsystemunitdir/initrd.target.wants"
for i in \
dracut-cmdline.service \

View File

@ -1,49 +0,0 @@
From 3e1c531b4ebfcca8850b5fa56ea7ce2eeacb2cc9 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 11 Nov 2015 12:33:07 +0100
Subject: [PATCH] Makefile: remove output file before creating it
---
Makefile | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 8454c63..44c58cc 100644
--- a/Makefile
+++ b/Makefile
@@ -82,20 +82,24 @@ all: doc
endif
%: %.xml
- xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+ @rm -f -- "$@"
+ xsltproc -o "$@" -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
%.xml: %.asc
- asciidoc -d manpage -b docbook -o $@ $<
+ @rm -f -- "$@"
+ asciidoc -d manpage -b docbook -o "$@" $<
dracut.8: dracut.usage.asc dracut.8.asc
dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
+ @rm -f -- dracut.xml
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
+ @rm -f -- dracut.html
xsltproc -o dracut.html --xinclude -nonet \
--stringparam custom.css.source dracut.css \
--stringparam generate.css.header 1 \
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
- rm -f -- dracut.xml
+ @rm -f -- dracut.xml
dracut.pc: Makefile.inc Makefile
@echo "Name: dracut" > dracut.pc
@@ -169,6 +173,7 @@ endif
install -m 0644 dracut.pc $(DESTDIR)${pkgconfigdatadir}/dracut.pc
dracut-version.sh:
+ @rm -f dracut-version.sh
@echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
clean:

View File

@ -1,65 +0,0 @@
From 6251f82c6fee64461fcccf820a5d12e144f714d3 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 25 Aug 2015 11:12:59 +0200
Subject: [PATCH] TEST-30-ISCSI: add rd.scsi.firmware
(cherry picked from commit 310574f7eaf68412035eb19855afe4ce2973b784)
---
test/TEST-30-ISCSI/test.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index be3399a..ffdb77f 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/test.sh
@@ -3,8 +3,9 @@ TEST_DESCRIPTION="root filesystem over iSCSI"
KVERSION=${KVERSION-$(uname -r)}
-#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 "
DEBUGFAIL="loglevel=1"
+#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 "
+#DEBUGFAIL="rd.debug loglevel=7 "
#SERVER_DEBUG="rd.debug loglevel=7"
SERIAL="tcp:127.0.0.1:9999"
SERIAL="null"
@@ -70,6 +71,7 @@ do_test_run() {
run_client "netroot=iscsi target0"\
"root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \
"ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \
+ "rd.iscsi.firmware" \
"rd.iscsi.initiator=$initiator" \
|| return 1
@@ -79,6 +81,7 @@ do_test_run() {
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+ "rd.iscsi.firmware" \
"rd.iscsi.initiator=$initiator" \
|| return 1
@@ -88,6 +91,7 @@ do_test_run() {
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+ "rd.iscsi.firmware" \
"rd.iscsi.initiator=$initiator" \
"rd.waitnet=0 rd.retry=30" \
|| return 1
@@ -98,6 +102,7 @@ do_test_run() {
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+ "rd.iscsi.firmware" \
"rd.iscsi.initiator=$initiator" \
"rd.waitnet=0 rd.iscsi.testroute=0 rd.retry=30" \
|| return 1
@@ -108,6 +113,7 @@ do_test_run() {
"ip=192.168.51.101::192.168.51.1:255.255.255.0::ens4:off" \
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+ "rd.iscsi.firmware" \
"rd.iscsi.initiator=$initiator" \
"rd.waitnet=0 rd.iscsi.testroute=0 rd.retry=30" \
|| return 1

Some files were not shown because too many files have changed in this diff Show More