Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-kernel/dracut/files/, sys-kernel/dracut/
Date: Sun, 29 Dec 2019 19:40:00
Message-Id: 1577648183.980830b7e4a2953550338f13dd8525bcad28d8fc.floppym@gentoo
1 commit: 980830b7e4a2953550338f13dd8525bcad28d8fc
2 Author: Alexander Tsoy <alexander <AT> tsoy <DOT> me>
3 AuthorDate: Thu Dec 26 14:26:15 2019 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 29 19:36:23 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=980830b7
7
8 sys-kernel/dracut: Add a bunch of upstream patches
9
10 * fix dracut-install crashes
11 * install kernel module dependencies of dependencies
12 * add support for compressed firmware files
13 * add support for rngd service
14 * bash-5 compatibility
15 * add fts-standalone dependency and configure check for musl
16 * fix udevdir detection
17
18 Closes: https://bugs.gentoo.org/676268
19 Closes: https://bugs.gentoo.org/677788
20 Closes: https://bugs.gentoo.org/687602
21 Bug: https://bugs.gentoo.org/703438
22 Signed-off-by: Alexander Tsoy <alexander <AT> tsoy.me>
23 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
24
25 sys-kernel/dracut/dracut-049-r3.ebuild | 176 +++++++++++++++++++++
26 ...gure-find-cflags-and-libs-for-fts-on-musl.patch | 97 ++++++++++++
27 ...t-create-locking-directory-run-cryptsetup.patch | 32 ++++
28 ...all-Support-the-compressed-firmware-files.patch | 63 ++++++++
29 .../049-dracut.sh-Fix-udevdir-detection.patch | 38 +++++
30 .../dracut/files/049-fs-lib-drop-a-bashism.patch | 99 ++++++++++++
31 ...cut-install.c-install-module-dependencies.patch | 79 +++++++++
32 ...ing_hash_func-should-not-be-fed-with-NULL.patch | 38 +++++
33 ...g-the-systemdutildir-variable-before-it-s.patch | 55 +++++++
34 ...ager-call-the-online-hook-for-connected-d.patch | 32 ++++
35 ...ager-fix-getting-of-ifname-from-the-sysfs.patch | 37 +++++
36 ...rk-manager-remove-useless-use-of-basename.patch | 26 +++
37 ...dule-running-early-during-boot-to-help-ge.patch | 88 +++++++++++
38 13 files changed, 860 insertions(+)
39
40 diff --git a/sys-kernel/dracut/dracut-049-r3.ebuild b/sys-kernel/dracut/dracut-049-r3.ebuild
41 new file mode 100644
42 index 00000000000..326820abb62
43 --- /dev/null
44 +++ b/sys-kernel/dracut/dracut-049-r3.ebuild
45 @@ -0,0 +1,176 @@
46 +# Copyright 1999-2019 Gentoo Authors
47 +# Distributed under the terms of the GNU General Public License v2
48 +
49 +EAPI=7
50 +
51 +inherit bash-completion-r1 eutils linux-info systemd toolchain-funcs
52 +
53 +if [[ ${PV} == 9999 ]] ; then
54 + inherit git-r3
55 + EGIT_REPO_URI="https://github.com/dracutdevs/dracut"
56 +else
57 + [[ "${PV}" = *_rc* ]] || \
58 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
59 + SRC_URI="https://github.com/dracutdevs/dracut/archive/${PV}.tar.gz -> ${P}.tar.gz"
60 +fi
61 +
62 +DESCRIPTION="Generic initramfs generation tool"
63 +HOMEPAGE="https://dracut.wiki.kernel.org"
64 +
65 +LICENSE="GPL-2"
66 +SLOT="0"
67 +IUSE="selinux"
68 +
69 +# Tests need root privileges, bug #298014
70 +RESTRICT="test"
71 +
72 +RDEPEND="
73 + app-arch/cpio
74 + >=app-shells/bash-4.0:0
75 + sys-apps/coreutils[xattr(-)]
76 + >=sys-apps/kmod-23[tools]
77 + || (
78 + >=sys-apps/sysvinit-2.87-r3
79 + sys-apps/openrc[sysv-utils,selinux?]
80 + sys-apps/systemd[sysv-utils]
81 + )
82 + >=sys-apps/util-linux-2.21
83 + virtual/pkgconfig
84 + virtual/udev
85 +
86 + elibc_musl? ( sys-libs/fts-standalone )
87 + selinux? (
88 + sec-policy/selinux-dracut
89 + sys-libs/libselinux
90 + sys-libs/libsepol
91 + )
92 +"
93 +DEPEND="
94 + >=sys-apps/kmod-23
95 + elibc_musl? ( sys-libs/fts-standalone )
96 +"
97 +
98 +BDEPEND="
99 + app-text/asciidoc
100 + app-text/docbook-xml-dtd:4.5
101 + >=app-text/docbook-xsl-stylesheets-1.75.2
102 + >=dev-libs/libxslt-1.1.26
103 + virtual/pkgconfig
104 +"
105 +
106 +DOCS=( AUTHORS HACKING NEWS README README.generic README.kernel README.modules
107 + README.testsuite TODO )
108 +
109 +QA_MULTILIB_PATHS="usr/lib/dracut/.*"
110 +
111 +PATCHES=(
112 + "${FILESDIR}"/048-dracut-install-simplify-ldd-parsing-logic.patch
113 + "${FILESDIR}"/049-40network-Don-t-include-40network-by-default.patch
114 + "${FILESDIR}"/049-remove-bashism-in-various-boot-scripts.patch
115 + "${FILESDIR}"/049-network-manager-call-the-online-hook-for-connected-d.patch
116 + "${FILESDIR}"/049-install-dracut-install.c-install-module-dependencies.patch
117 + "${FILESDIR}"/049-install-string_hash_func-should-not-be-fed-with-NULL.patch
118 + "${FILESDIR}"/049-dracut.sh-Fix-udevdir-detection.patch
119 + "${FILESDIR}"/049-rngd-new-module-running-early-during-boot-to-help-ge.patch
120 + "${FILESDIR}"/049-fs-lib-drop-a-bashism.patch
121 + "${FILESDIR}"/049-network-manager-remove-useless-use-of-basename.patch
122 + "${FILESDIR}"/049-move-setting-the-systemdutildir-variable-before-it-s.patch
123 + "${FILESDIR}"/049-dracut-install-Support-the-compressed-firmware-files.patch
124 + "${FILESDIR}"/049-crypt-create-locking-directory-run-cryptsetup.patch
125 + "${FILESDIR}"/049-network-manager-fix-getting-of-ifname-from-the-sysfs.patch
126 + "${FILESDIR}"/049-configure-find-cflags-and-libs-for-fts-on-musl.patch
127 +)
128 +
129 +src_configure() {
130 + local myconf=(
131 + --prefix="${EPREFIX}/usr"
132 + --sysconfdir="${EPREFIX}/etc"
133 + --bashcompletiondir="$(get_bashcompdir)"
134 + --systemdsystemunitdir="$(systemd_get_systemunitdir)"
135 + )
136 +
137 + tc-export CC PKG_CONFIG
138 +
139 + echo ./configure "${myconf[@]}"
140 + ./configure "${myconf[@]}" || die
141 +
142 + if [[ ${PV} != 9999 ]] ; then
143 + # Source tarball from github doesn't include this file
144 + echo "DRACUT_VERSION=${PV}" > dracut-version.sh || die
145 + fi
146 +}
147 +
148 +src_install() {
149 + default
150 +
151 + insinto /etc/logrotate.d
152 + newins dracut.logrotate dracut
153 +
154 + docinto html
155 + dodoc dracut.html
156 +}
157 +
158 +pkg_postinst() {
159 + if linux-info_get_any_version && linux_config_exists; then
160 + ewarn ""
161 + ewarn "If the following test report contains a missing kernel"
162 + ewarn "configuration option, you should reconfigure and rebuild your"
163 + ewarn "kernel before booting image generated with this Dracut version."
164 + ewarn ""
165 +
166 + local CONFIG_CHECK="~BLK_DEV_INITRD ~DEVTMPFS"
167 +
168 + # Kernel configuration options descriptions:
169 + local ERROR_DEVTMPFS='CONFIG_DEVTMPFS: "Maintain a devtmpfs filesystem to mount at /dev" '
170 + ERROR_DEVTMPFS+='is missing and REQUIRED'
171 + local ERROR_BLK_DEV_INITRD='CONFIG_BLK_DEV_INITRD: "Initial RAM filesystem and RAM disk '
172 + ERROR_BLK_DEV_INITRD+='(initramfs/initrd) support" is missing and REQUIRED'
173 +
174 + check_extra_config
175 + echo
176 + else
177 + ewarn ""
178 + ewarn "Your kernel configuration couldn't be checked."
179 + ewarn "Please check manually if following options are enabled:"
180 + ewarn ""
181 + ewarn " CONFIG_BLK_DEV_INITRD"
182 + ewarn " CONFIG_DEVTMPFS"
183 + ewarn ""
184 + fi
185 +
186 + elog "To get additional features, a number of optional runtime"
187 + elog "dependencies may be installed:"
188 + elog ""
189 + optfeature "Networking support" net-misc/networkmanager
190 + optfeature "Legacy networking support" net-misc/curl "net-misc/dhcp[client]" \
191 + sys-apps/iproute2 "net-misc/iputils[arping]"
192 + optfeature \
193 + "Measure performance of the boot process for later visualisation" \
194 + app-benchmarks/bootchart2 app-admin/killproc sys-process/acct
195 + optfeature "Scan for Btrfs on block devices" sys-fs/btrfs-progs
196 + optfeature "Load kernel modules and drop this privilege for real init" \
197 + sys-libs/libcap
198 + optfeature "Support CIFS" net-fs/cifs-utils
199 + optfeature "Decrypt devices encrypted with cryptsetup/LUKS" \
200 + "sys-fs/cryptsetup[-static-libs]"
201 + optfeature "Support for GPG-encrypted keys for crypt module" \
202 + app-crypt/gnupg
203 + optfeature \
204 + "Allows use of dash instead of default bash (on your own risk)" \
205 + app-shells/dash
206 + optfeature "Support iSCSI" sys-block/open-iscsi
207 + optfeature "Support Logical Volume Manager" sys-fs/lvm2
208 + optfeature "Support MD devices, also known as software RAID devices" \
209 + sys-fs/mdadm
210 + optfeature "Support Device Mapper multipathing" sys-fs/multipath-tools
211 + optfeature "Plymouth boot splash" '>=sys-boot/plymouth-0.8.5-r5'
212 + optfeature "Support network block devices" sys-block/nbd
213 + optfeature "Support NFS" net-fs/nfs-utils net-nds/rpcbind
214 + optfeature \
215 + "Install ssh and scp along with config files and specified keys" \
216 + net-misc/openssh
217 + optfeature "Enable logging with rsyslog" app-admin/rsyslog
218 + optfeature \
219 + "Enable rngd service to help generating entropy early during boot" \
220 + sys-apps/rng-tools
221 +}
222
223 diff --git a/sys-kernel/dracut/files/049-configure-find-cflags-and-libs-for-fts-on-musl.patch b/sys-kernel/dracut/files/049-configure-find-cflags-and-libs-for-fts-on-musl.patch
224 new file mode 100644
225 index 00000000000..cd74564adb5
226 --- /dev/null
227 +++ b/sys-kernel/dracut/files/049-configure-find-cflags-and-libs-for-fts-on-musl.patch
228 @@ -0,0 +1,97 @@
229 +From 62f27ee6f145b5f8ca571887602cd9b0715b9e9d Mon Sep 17 00:00:00 2001
230 +From: Doan Tran Cong Danh <congdanhqx@×××××.com>
231 +Date: Wed, 6 Nov 2019 18:35:12 +0700
232 +Subject: [PATCH] configure: find cflags and libs for fts on musl
233 +To: <initramfs@×××××××××××.org>
234 +
235 +Signed-off-by: Doan Tran Cong Danh <congdanhqx@×××××.com>
236 +---
237 + Makefile | 2 +-
238 + configure | 44 ++++++++++++++++++++++++++++++++++++++++++++
239 + 2 files changed, 45 insertions(+), 1 deletion(-)
240 +
241 +diff --git a/Makefile b/Makefile
242 +index 31545899..f9b42b96 100644
243 +--- a/Makefile
244 ++++ b/Makefile
245 +@@ -62,7 +62,7 @@ install/util.o: install/util.c install/util.h install/macro.h install/log.h
246 + install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h
247 +
248 + install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
249 +- $(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS)
250 ++ $(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(FTS_LIBS) $(KMOD_LIBS)
251 +
252 + logtee: logtee.c
253 + $(CC) $(LDFLAGS) -o $@ $<
254 +diff --git a/configure b/configure
255 +index b55fb609..3f724ef2 100755
256 +--- a/configure
257 ++++ b/configure
258 +@@ -7,6 +7,7 @@ prefix=/usr
259 +
260 + enable_documentation=yes
261 +
262 ++CC="${CC:-cc}"
263 + PKG_CONFIG="${PKG_CONFIG:-pkg-config}"
264 +
265 + # Little helper function for reading args from the commandline.
266 +@@ -57,6 +58,48 @@ if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
267 + exit 1
268 + fi
269 +
270 ++cat <<EOF >conftest.c
271 ++#include <fts.h>
272 ++int main() {
273 ++ return 0;
274 ++}
275 ++EOF
276 ++
277 ++${CC} $CFLAGS $LDFLAGS conftest.c >/dev/null 2>&1
278 ++ret=$?
279 ++rm -f conftest.c a.out
280 ++
281 ++# musl doesn't have fts.h included
282 ++if test $ret -ne 0; then
283 ++ echo "dracut needs fts development files." >&2
284 ++ exit 1
285 ++fi
286 ++
287 ++cat <<EOF >conftest.c
288 ++#include <fts.h>
289 ++int main(void) {
290 ++ fts_open(0, 0, 0);
291 ++ return 0;
292 ++}
293 ++EOF
294 ++
295 ++found=no
296 ++for lib in "-lc" "-lfts"; do
297 ++ ${CC} $CFLAGS -Wl,$lib $LDFLAGS conftest.c >/dev/null 2>&1
298 ++ ret=$?
299 ++ if test $ret -eq 0; then
300 ++ FTS_LIBS="$lib"
301 ++ found=yes
302 ++ break;
303 ++ fi
304 ++done
305 ++rm -f conftest.c a.out
306 ++
307 ++if test $found = no; then
308 ++ echo "dracut couldn't find usable fts library" >&2
309 ++ exit 1
310 ++fi
311 ++
312 + cat > Makefile.inc.$$ <<EOF
313 + prefix ?= ${prefix}
314 + libdir ?= ${libdir:-${prefix}/lib}
315 +@@ -68,6 +111,7 @@ enable_documentation ?= ${enable_documentation:-yes}
316 + bindir ?= ${bindir:-${prefix}/bin}
317 + KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 23 ")
318 + KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ")
319 ++FTS_LIBS ?= ${FTS_LIBS}
320 + EOF
321 +
322 + {
323 +--
324 +2.24.1
325 +
326
327 diff --git a/sys-kernel/dracut/files/049-crypt-create-locking-directory-run-cryptsetup.patch b/sys-kernel/dracut/files/049-crypt-create-locking-directory-run-cryptsetup.patch
328 new file mode 100644
329 index 00000000000..be964c03746
330 --- /dev/null
331 +++ b/sys-kernel/dracut/files/049-crypt-create-locking-directory-run-cryptsetup.patch
332 @@ -0,0 +1,32 @@
333 +From f39aa529c59c533ce5e75e31be1b0cce4513b3d7 Mon Sep 17 00:00:00 2001
334 +From: Jonas Witschel <diabonas@×××.de>
335 +Date: Sat, 31 Aug 2019 17:45:11 +0200
336 +Subject: [PATCH] crypt: create locking directory /run/cryptsetup
337 +To: <initramfs@×××××××××××.org>
338 +
339 +For LUKS2 partitions cryptsetup needs a locking directory. If it does
340 +not exist, cryptsetup will create it, but produce a warning
341 +
342 +WARNING: Locking directory /run/cryptsetup is missing!
343 +
344 +in the process that we do not want to see in the dracut output.
345 +---
346 + modules.d/90crypt/cryptroot-ask.sh | 2 ++
347 + 1 file changed, 2 insertions(+)
348 +
349 +diff --git a/modules.d/90crypt/cryptroot-ask.sh b/modules.d/90crypt/cryptroot-ask.sh
350 +index 33a823c7..e1f17975 100755
351 +--- a/modules.d/90crypt/cryptroot-ask.sh
352 ++++ b/modules.d/90crypt/cryptroot-ask.sh
353 +@@ -8,6 +8,8 @@ NEWROOT=${NEWROOT:-"/sysroot"}
354 +
355 + . /lib/dracut-lib.sh
356 +
357 ++mkdir -m 0700 /run/cryptsetup
358 ++
359 + # if device name is /dev/dm-X, convert to /dev/mapper/name
360 + if [ "${1##/dev/dm-}" != "$1" ]; then
361 + device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
362 +--
363 +2.24.1
364 +
365
366 diff --git a/sys-kernel/dracut/files/049-dracut-install-Support-the-compressed-firmware-files.patch b/sys-kernel/dracut/files/049-dracut-install-Support-the-compressed-firmware-files.patch
367 new file mode 100644
368 index 00000000000..85c0ea09972
369 --- /dev/null
370 +++ b/sys-kernel/dracut/files/049-dracut-install-Support-the-compressed-firmware-files.patch
371 @@ -0,0 +1,63 @@
372 +From 999cfa84582ab4ce4cc602242cb71d0af0b7d4ac Mon Sep 17 00:00:00 2001
373 +From: Takashi Iwai <tiwai@××××.de>
374 +Date: Thu, 22 Aug 2019 12:37:56 +0200
375 +Subject: [PATCH] dracut-install: Support the compressed firmware files
376 + correctly
377 +To: <initramfs@×××××××××××.org>
378 +
379 +The compressed firmware support was supposed to be already
380 +implemented, but it didn't work as expected in the end, because dracut
381 +moved to use dracut-install binary. This patch adds the support of
382 +XZ-compressed firmware installation to dracut-install for fixing the
383 +missing piece.
384 +
385 +At best the firmware files should be uncompressed in initrd, but this
386 +patch simply copies the compressed file as-is, as a quick workaround.
387 +
388 +BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1146769
389 +Signed-off-by: Takashi Iwai <tiwai@××××.de>
390 +---
391 + install/dracut-install.c | 17 ++++++++++++++---
392 + 1 file changed, 14 insertions(+), 3 deletions(-)
393 +
394 +diff --git a/install/dracut-install.c b/install/dracut-install.c
395 +index 9e415b5e..7cda499d 100644
396 +--- a/install/dracut-install.c
397 ++++ b/install/dracut-install.c
398 +@@ -1151,6 +1151,8 @@ static int install_firmware(struct kmod_module *mod)
399 + ret = -1;
400 + STRV_FOREACH(q, firmwaredirs) {
401 + _cleanup_free_ char *fwpath = NULL;
402 ++ _cleanup_free_ char *fwpath_xz = NULL;
403 ++ const char *fw;
404 + struct stat sb;
405 + int r;
406 +
407 +@@ -1160,12 +1162,21 @@ static int install_firmware(struct kmod_module *mod)
408 + exit(EXIT_FAILURE);
409 + }
410 +
411 ++ fw = fwpath;
412 + if (stat(fwpath, &sb) != 0) {
413 +- log_debug("stat(%s) != 0", fwpath);
414 +- continue;
415 ++ r = asprintf(&fwpath_xz, "%s.xz", fwpath);
416 ++ if (r < 0) {
417 ++ log_error("Out of memory!");
418 ++ exit(EXIT_FAILURE);
419 ++ }
420 ++ if (stat(fwpath_xz, &sb) != 0) {
421 ++ log_debug("stat(%s) != 0", fwpath);
422 ++ continue;
423 ++ }
424 ++ fw = fwpath_xz;
425 + }
426 +
427 +- ret = dracut_install(fwpath, fwpath, false, false, true);
428 ++ ret = dracut_install(fw, fw, false, false, true);
429 + if (ret == 0)
430 + log_debug("dracut_install '%s' OK", fwpath);
431 + }
432 +--
433 +2.24.1
434 +
435
436 diff --git a/sys-kernel/dracut/files/049-dracut.sh-Fix-udevdir-detection.patch b/sys-kernel/dracut/files/049-dracut.sh-Fix-udevdir-detection.patch
437 new file mode 100644
438 index 00000000000..ec7d4802370
439 --- /dev/null
440 +++ b/sys-kernel/dracut/files/049-dracut.sh-Fix-udevdir-detection.patch
441 @@ -0,0 +1,38 @@
442 +From dddcb809459b7a75906d4b90cf7a5ac291dc74c1 Mon Sep 17 00:00:00 2001
443 +From: Hongxu Jia <hongxu.jia@×××××××××.com>
444 +Date: Wed, 3 Apr 2019 15:24:47 +0800
445 +Subject: [PATCH] dracut.sh: Fix udevdir detection
446 +To: <initramfs@×××××××××××.org>
447 +
448 +In commit [9d1b81c dracut.sh: improve udevdir and systemdutildir
449 +fallback logic] , it checked a common binary `collect' to location
450 +udevdir.
451 +
452 +But upstream systemd drop binary `collect' since systemd v240
453 +[https://github.com/systemd/systemd/commit/a168792c2d95695fd30c0371d4b3890a9df1eafb]
454 +
455 +So check binary `ata_id' to instead.
456 +
457 +Signed-off-by: Hongxu Jia <hongxu.jia@×××××××××.com>
458 +---
459 + dracut.sh | 4 ++--
460 + 1 file changed, 2 insertions(+), 2 deletions(-)
461 +
462 +diff --git a/dracut.sh b/dracut.sh
463 +index 9098571d..fd9903b6 100755
464 +--- a/dracut.sh
465 ++++ b/dracut.sh
466 +@@ -1311,8 +1311,8 @@ done
467 + [[ -d $udevdir ]] \
468 + || udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
469 + if ! [[ -d "$udevdir" ]]; then
470 +- [[ -e /lib/udev/collect ]] && udevdir=/lib/udev
471 +- [[ -e /usr/lib/udev/collect ]] && udevdir=/usr/lib/udev
472 ++ [[ -e /lib/udev/ata_id ]] && udevdir=/lib/udev
473 ++ [[ -e /usr/lib/udev/ata_id ]] && udevdir=/usr/lib/udev
474 + fi
475 +
476 + [[ -d $systemdutildir ]] \
477 +--
478 +2.24.1
479 +
480
481 diff --git a/sys-kernel/dracut/files/049-fs-lib-drop-a-bashism.patch b/sys-kernel/dracut/files/049-fs-lib-drop-a-bashism.patch
482 new file mode 100644
483 index 00000000000..a44b8f31651
484 --- /dev/null
485 +++ b/sys-kernel/dracut/files/049-fs-lib-drop-a-bashism.patch
486 @@ -0,0 +1,99 @@
487 +From 43c8c4ce0471abbb8c0fc4b8be2515cebc636030 Mon Sep 17 00:00:00 2001
488 +From: Lubomir Rintel <lkundrak@××.sk>
489 +Date: Fri, 21 Jun 2019 18:39:48 +0200
490 +Subject: [PATCH] fs-lib: drop a bashism
491 +To: <initramfs@×××××××××××.org>
492 +
493 +Bash 5 apparently longer propagates variable assignments to local variables
494 +in front of function calls when in POSIX mode:
495 +
496 + [lkundrak@demiurge ~]$ cat feh.sh
497 + print_VAR () {
498 + echo "$VAR";
499 + }
500 +
501 + testfunc () {
502 + local VAR="OLD"
503 + VAR=NEW print_VAR
504 + }
505 +
506 + testfunc
507 + [lkundrak@demiurge ~]$ bash4 --posix feh.sh
508 + NEW
509 + [lkundrak@demiurge ~]$ bash5 --posix feh.sh
510 + OLD
511 + [lkundrak@demiurge ~]$ bash5 feh.sh
512 + NEW
513 + [lkundrak@demiurge ~]$
514 +
515 +It works the way it did in Bash 4 in non-POSIX mode, for external programs,
516 +or for non-local variables. Don't ask me why -- it's probably some
517 +compatibility thing for some sad old people.
518 +
519 +However, this precisely happens when fsck_single() is calling into the
520 +fsck_drv_com(), assigned to _drv by fsck_able(). That ruins the
521 +TEST-70-BONDBRIDGETEAMVLAN test's server and probably more.
522 +
523 +Let's pass the fsck driver binary via the function argument instead. It's
524 +less messy anyway.
525 +---
526 + modules.d/99fs-lib/fs-lib.sh | 13 +++++++------
527 + 1 file changed, 7 insertions(+), 6 deletions(-)
528 +
529 +diff --git a/modules.d/99fs-lib/fs-lib.sh b/modules.d/99fs-lib/fs-lib.sh
530 +index d39ca1b7..11e795d9 100755
531 +--- a/modules.d/99fs-lib/fs-lib.sh
532 ++++ b/modules.d/99fs-lib/fs-lib.sh
533 +@@ -44,22 +44,22 @@ fsck_able() {
534 + ;;
535 + ext?)
536 + type e2fsck >/dev/null 2>&1 &&
537 +- _drv="_drv=e2fsck fsck_drv_com" &&
538 ++ _drv="fsck_drv_com e2fsck" &&
539 + return 0
540 + ;;
541 + f2fs)
542 + type fsck.f2fs >/dev/null 2>&1 &&
543 +- _drv="_drv=fsck.f2fs fsck_drv_com" &&
544 ++ _drv="fsck_drv_com fsck.f2fs" &&
545 + return 0
546 + ;;
547 + jfs)
548 + type jfs_fsck >/dev/null 2>&1 &&
549 +- _drv="_drv=jfs_fsck fsck_drv_com" &&
550 ++ _drv="fsck_drv_com jfs_fsck" &&
551 + return 0
552 + ;;
553 + reiserfs)
554 + type reiserfsck >/dev/null 2>&1 &&
555 +- _drv="_drv=reiserfsck fsck_drv_com" &&
556 ++ _drv="fsck_drv_com reiserfsck" &&
557 + return 0
558 + ;;
559 + btrfs)
560 +@@ -70,12 +70,12 @@ fsck_able() {
561 + ;;
562 + nfs*)
563 + # nfs can be a nop, returning success
564 +- _drv="_drv=none :" &&
565 ++ _drv=":" &&
566 + return 0
567 + ;;
568 + *)
569 + type fsck >/dev/null 2>&1 &&
570 +- _drv="_drv=fsck fsck_drv_std" &&
571 ++ _drv="fsck_drv_std fsck" &&
572 + return 0
573 + ;;
574 + esac
575 +@@ -97,6 +97,7 @@ fsck_drv_btrfs() {
576 +
577 + # common code for checkers that follow usual subset of options and return codes
578 + fsck_drv_com() {
579 ++ local _drv="$1"
580 + local _ret
581 + local _out
582 +
583 +--
584 +2.24.1
585 +
586
587 diff --git a/sys-kernel/dracut/files/049-install-dracut-install.c-install-module-dependencies.patch b/sys-kernel/dracut/files/049-install-dracut-install.c-install-module-dependencies.patch
588 new file mode 100644
589 index 00000000000..ec3e903765a
590 --- /dev/null
591 +++ b/sys-kernel/dracut/files/049-install-dracut-install.c-install-module-dependencies.patch
592 @@ -0,0 +1,79 @@
593 +From c38f9e980c1ee03151dd1c6602907c6228b78d30 Mon Sep 17 00:00:00 2001
594 +From: Harald Hoyer <harald@××××××.com>
595 +Date: Tue, 4 Dec 2018 10:02:45 +0100
596 +Subject: [PATCH] install/dracut-install.c: install module dependencies of
597 + dependencies
598 +To: <initramfs@×××××××××××.org>
599 +
600 +---
601 + install/dracut-install.c | 28 +++++++++++++++++++++++++---
602 + 1 file changed, 25 insertions(+), 3 deletions(-)
603 +
604 +diff --git a/install/dracut-install.c b/install/dracut-install.c
605 +index 5f352b36..d64de545 100644
606 +--- a/install/dracut-install.c
607 ++++ b/install/dracut-install.c
608 +@@ -84,6 +84,11 @@ static bool arg_mod_filter_noname = false;
609 + static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst);
610 +
611 +
612 ++static inline void kmod_module_unrefp(struct kmod_module **p) {
613 ++ if (*p)
614 ++ kmod_module_unref(*p);
615 ++}
616 ++#define _cleanup_kmod_module_unref_ _cleanup_(kmod_module_unrefp)
617 +
618 + static inline void kmod_module_unref_listp(struct kmod_list **p) {
619 + if (*p)
620 +@@ -1230,28 +1235,45 @@ static bool check_module_path(const char *path)
621 + static int install_dependent_modules(struct kmod_list *modlist)
622 + {
623 + struct kmod_list *itr;
624 +- struct kmod_module *mod;
625 + const char *path = NULL;
626 + const char *name = NULL;
627 + int ret = 0;
628 +
629 + kmod_list_foreach(itr, modlist) {
630 ++ _cleanup_kmod_module_unref_ struct kmod_module *mod = NULL;
631 + mod = kmod_module_get_module(itr);
632 + path = kmod_module_get_path(mod);
633 +
634 ++ if (check_hashmap(items_failed, path))
635 ++ return -1;
636 ++
637 ++ if (check_hashmap(items, path)) {
638 ++ continue;
639 ++ }
640 ++
641 + name = kmod_module_get_name(mod);
642 ++
643 + if ((path == NULL) || (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0))) {
644 +- kmod_module_unref(mod);
645 + continue;
646 + }
647 ++
648 + ret = dracut_install(path, &path[kerneldirlen], false, false, true);
649 + if (ret == 0) {
650 ++ _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
651 ++ _cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
652 ++ _cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
653 + log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
654 + install_firmware(mod);
655 ++ modlist = kmod_module_get_dependencies(mod);
656 ++ ret = install_dependent_modules(modlist);
657 ++ if (ret == 0) {
658 ++ ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
659 ++ if (ret == 0)
660 ++ ret = install_dependent_modules(modpre);
661 ++ }
662 + } else {
663 + log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
664 + }
665 +- kmod_module_unref(mod);
666 + }
667 +
668 + return ret;
669 +--
670 +2.24.1
671 +
672
673 diff --git a/sys-kernel/dracut/files/049-install-string_hash_func-should-not-be-fed-with-NULL.patch b/sys-kernel/dracut/files/049-install-string_hash_func-should-not-be-fed-with-NULL.patch
674 new file mode 100644
675 index 00000000000..80f0c2b0186
676 --- /dev/null
677 +++ b/sys-kernel/dracut/files/049-install-string_hash_func-should-not-be-fed-with-NULL.patch
678 @@ -0,0 +1,38 @@
679 +From fc141f22869bad2e5409d1cc555c1a42ea738343 Mon Sep 17 00:00:00 2001
680 +From: Lukas Nykryn <lnykryn@××××××.com>
681 +Date: Thu, 14 Feb 2019 20:18:04 +0100
682 +Subject: [PATCH] install: string_hash_func should not be fed with NULL
683 +To: <initramfs@×××××××××××.org>
684 +
685 +If kmod_module_get_path returns NULL, we should skip that entry,
686 +the hash function does not like NULL pointers.
687 +---
688 + install/dracut-install.c | 5 ++++-
689 + 1 file changed, 4 insertions(+), 1 deletion(-)
690 +
691 +diff --git a/install/dracut-install.c b/install/dracut-install.c
692 +index d64de545..9e415b5e 100644
693 +--- a/install/dracut-install.c
694 ++++ b/install/dracut-install.c
695 +@@ -1244,6 +1244,9 @@ static int install_dependent_modules(struct kmod_list *modlist)
696 + mod = kmod_module_get_module(itr);
697 + path = kmod_module_get_path(mod);
698 +
699 ++ if (path == NULL)
700 ++ continue;
701 ++
702 + if (check_hashmap(items_failed, path))
703 + return -1;
704 +
705 +@@ -1253,7 +1256,7 @@ static int install_dependent_modules(struct kmod_list *modlist)
706 +
707 + name = kmod_module_get_name(mod);
708 +
709 +- if ((path == NULL) || (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0))) {
710 ++ if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) {
711 + continue;
712 + }
713 +
714 +--
715 +2.24.1
716 +
717
718 diff --git a/sys-kernel/dracut/files/049-move-setting-the-systemdutildir-variable-before-it-s.patch b/sys-kernel/dracut/files/049-move-setting-the-systemdutildir-variable-before-it-s.patch
719 new file mode 100644
720 index 00000000000..585f47add02
721 --- /dev/null
722 +++ b/sys-kernel/dracut/files/049-move-setting-the-systemdutildir-variable-before-it-s.patch
723 @@ -0,0 +1,55 @@
724 +From c8b35bf96af1859c0c254db34a16b9cc5a2aa46b Mon Sep 17 00:00:00 2001
725 +From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=98=D0=B0=D0=BD=20=D0=93=D0=B5=D0=BE?=
726 + =?UTF-8?q?=D1=80=D0=B3=D0=B8=D0=B5=D0=B2=D1=81=D0=BA=D0=B8?=
727 + <gdamjan@×××××.com>
728 +Date: Mon, 27 May 2019 18:22:14 +0200
729 +Subject: [PATCH] move setting the "systemdutildir" variable before it's used
730 +To: <initramfs@×××××××××××.org>
731 +
732 +on line 1086 it's used to check for the uefi_stub:
733 +"${systemdutildir}/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"
734 +
735 +so it needs to be defined before that
736 +---
737 + dracut.sh | 18 ++++++++++--------
738 + 1 file changed, 10 insertions(+), 8 deletions(-)
739 +
740 +diff --git a/dracut.sh b/dracut.sh
741 +index 183b892f..a3618f89 100755
742 +--- a/dracut.sh
743 ++++ b/dracut.sh
744 +@@ -1009,6 +1009,16 @@ esac
745 +
746 + abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
747 +
748 ++
749 ++[[ -d $systemdutildir ]] \
750 ++ || systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
751 ++
752 ++if ! [[ -d "$systemdutildir" ]]; then
753 ++ [[ -e /lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
754 ++ [[ -e /usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
755 ++fi
756 ++
757 ++
758 + if [[ $no_kernel != yes ]] && [[ -d $srcmods ]]; then
759 + if ! [[ -f $srcmods/modules.dep ]]; then
760 + if [[ -n "$(find "$srcmods" -name '*.ko*')" ]]; then
761 +@@ -1325,14 +1335,6 @@ if ! [[ -d "$udevdir" ]]; then
762 + [[ -e /usr/lib/udev/ata_id ]] && udevdir=/usr/lib/udev
763 + fi
764 +
765 +-[[ -d $systemdutildir ]] \
766 +- || systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
767 +-
768 +-if ! [[ -d "$systemdutildir" ]]; then
769 +- [[ -e /lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
770 +- [[ -e /usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
771 +-fi
772 +-
773 + [[ -d $systemdsystemunitdir ]] \
774 + || systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2>/dev/null)
775 +
776 +--
777 +2.24.1
778 +
779
780 diff --git a/sys-kernel/dracut/files/049-network-manager-call-the-online-hook-for-connected-d.patch b/sys-kernel/dracut/files/049-network-manager-call-the-online-hook-for-connected-d.patch
781 new file mode 100644
782 index 00000000000..7f5fc6a0385
783 --- /dev/null
784 +++ b/sys-kernel/dracut/files/049-network-manager-call-the-online-hook-for-connected-d.patch
785 @@ -0,0 +1,32 @@
786 +From 79a17b0112995eb60c85c64d15070c52f213b28d Mon Sep 17 00:00:00 2001
787 +From: Lubomir Rintel <lkundrak@××.sk>
788 +Date: Tue, 27 Nov 2018 15:30:48 +0100
789 +Subject: [PATCH] network-manager: call the online hook for connected devices
790 +To: <initramfs@×××××××××××.org>
791 +
792 +Look for "connection-uuid" instead of "managed" to determine the devices
793 +that are actually activated with a connection and call the online hook.
794 +
795 +This fixes the anaconda-net root mount, which utilizes the online hook.
796 +---
797 + modules.d/35network-manager/nm-run.sh | 3 ++-
798 + 1 file changed, 2 insertions(+), 1 deletion(-)
799 +
800 +diff --git a/modules.d/35network-manager/nm-run.sh b/modules.d/35network-manager/nm-run.sh
801 +index f6defa99..0f943631 100755
802 +--- a/modules.d/35network-manager/nm-run.sh
803 ++++ b/modules.d/35network-manager/nm-run.sh
804 +@@ -9,8 +9,9 @@ fi
805 + for _i in /sys/class/net/*/
806 + do
807 + state=/run/NetworkManager/devices/$(cat $_i/ifindex)
808 +- grep -q managed=true $state 2>/dev/null || continue
809 ++ grep -q connection-uuid= $state 2>/dev/null || continue
810 + ifname=$(basename $_i)
811 + sed -n 's/root-path/new_root_path/p' <$state >/tmp/dhclient.$ifname.dhcpopts
812 ++ source_hook initqueue/online $ifname
813 + /sbin/netroot $ifname
814 + done
815 +--
816 +2.24.1
817 +
818
819 diff --git a/sys-kernel/dracut/files/049-network-manager-fix-getting-of-ifname-from-the-sysfs.patch b/sys-kernel/dracut/files/049-network-manager-fix-getting-of-ifname-from-the-sysfs.patch
820 new file mode 100644
821 index 00000000000..430b93f93de
822 --- /dev/null
823 +++ b/sys-kernel/dracut/files/049-network-manager-fix-getting-of-ifname-from-the-sysfs.patch
824 @@ -0,0 +1,37 @@
825 +From 687e17aa7f2f40d21717be9a04302c749e139d4a Mon Sep 17 00:00:00 2001
826 +From: Lubomir Rintel <lkundrak@××.sk>
827 +Date: Wed, 30 Oct 2019 19:25:51 +0100
828 +Subject: [PATCH] network-manager: fix getting of ifname from the sysfs path
829 +To: <initramfs@×××××××××××.org>
830 +
831 +commit 5e0f8c8a4ced ('network-manager: remove useless use of basename')
832 +somewhat carelessly didn't take into account that $_i has a slash at
833 +the end which made the result of the ## substitution be just an empty
834 +string.
835 +
836 +The slash was put to the end of /sys/class/net/*/ to make sure we're only
837 +iterating directories, but it's not strictly necessary. In an unlikely case
838 +something else than a directory appears in /sys/class/net/, we'll already deal
839 +with it gracefully. Remove it.
840 +
841 +This fixes the TEST-30-ISCSI test.
842 +---
843 + modules.d/35network-manager/nm-run.sh | 2 +-
844 + 1 file changed, 1 insertion(+), 1 deletion(-)
845 +
846 +diff --git a/modules.d/35network-manager/nm-run.sh b/modules.d/35network-manager/nm-run.sh
847 +index a539d5b2..b33e0992 100755
848 +--- a/modules.d/35network-manager/nm-run.sh
849 ++++ b/modules.d/35network-manager/nm-run.sh
850 +@@ -6,7 +6,7 @@ else
851 + /usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
852 + fi
853 +
854 +-for _i in /sys/class/net/*/
855 ++for _i in /sys/class/net/*
856 + do
857 + state=/run/NetworkManager/devices/$(cat $_i/ifindex)
858 + grep -q connection-uuid= $state 2>/dev/null || continue
859 +--
860 +2.24.1
861 +
862
863 diff --git a/sys-kernel/dracut/files/049-network-manager-remove-useless-use-of-basename.patch b/sys-kernel/dracut/files/049-network-manager-remove-useless-use-of-basename.patch
864 new file mode 100644
865 index 00000000000..1650c9a767e
866 --- /dev/null
867 +++ b/sys-kernel/dracut/files/049-network-manager-remove-useless-use-of-basename.patch
868 @@ -0,0 +1,26 @@
869 +From 5e0f8c8a4ced36268d0077acafa1db2402776fa6 Mon Sep 17 00:00:00 2001
870 +From: Lubomir Rintel <lkundrak@××.sk>
871 +Date: Mon, 17 Jun 2019 10:07:38 +0200
872 +Subject: [PATCH] network-manager: remove useless use of basename
873 +To: <initramfs@×××××××××××.org>
874 +
875 +---
876 + modules.d/35network-manager/nm-run.sh | 2 +-
877 + 1 file changed, 1 insertion(+), 1 deletion(-)
878 +
879 +diff --git a/modules.d/35network-manager/nm-run.sh b/modules.d/35network-manager/nm-run.sh
880 +index 0f943631..5f4b38ca 100755
881 +--- a/modules.d/35network-manager/nm-run.sh
882 ++++ b/modules.d/35network-manager/nm-run.sh
883 +@@ -10,7 +10,7 @@ for _i in /sys/class/net/*/
884 + do
885 + state=/run/NetworkManager/devices/$(cat $_i/ifindex)
886 + grep -q connection-uuid= $state 2>/dev/null || continue
887 +- ifname=$(basename $_i)
888 ++ ifname=${_i##*/}
889 + sed -n 's/root-path/new_root_path/p' <$state >/tmp/dhclient.$ifname.dhcpopts
890 + source_hook initqueue/online $ifname
891 + /sbin/netroot $ifname
892 +--
893 +2.24.1
894 +
895
896 diff --git a/sys-kernel/dracut/files/049-rngd-new-module-running-early-during-boot-to-help-ge.patch b/sys-kernel/dracut/files/049-rngd-new-module-running-early-during-boot-to-help-ge.patch
897 new file mode 100644
898 index 00000000000..5ea342df78a
899 --- /dev/null
900 +++ b/sys-kernel/dracut/files/049-rngd-new-module-running-early-during-boot-to-help-ge.patch
901 @@ -0,0 +1,88 @@
902 +From adee5b97bc5418b6e357342bb3be20568668aa55 Mon Sep 17 00:00:00 2001
903 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@××××××.com>
904 +Date: Thu, 11 Jul 2019 10:50:40 +0200
905 +Subject: [PATCH] rngd: new module running early during boot to help generating
906 + entropy when system's default entropy sources are poor (e.g. use of SSD disks
907 + or UEFI RNG not available)
908 +MIME-Version: 1.0
909 +Content-Type: text/plain; charset=UTF-8
910 +Content-Transfer-Encoding: 8bit
911 +To: <initramfs@×××××××××××.org>
912 +
913 +On systems with low entropy at boot, the boot can take up to several
914 +hours, specially when NBDE is used (e.g. clevis) which makes use of
915 +the random number generator.
916 +
917 +Enabling rngd service at boot early, because dracut-initqueue runs,
918 +enables to initialize the random number generator in a couple of seconds
919 +instead of minutes or hours.
920 +
921 +Signed-off-by: Renaud Métrich <rmetrich@××××××.com>
922 +---
923 + modules.d/06rngd/module-setup.sh | 39 ++++++++++++++++++++++++++++++++
924 + modules.d/06rngd/rngd.service | 7 ++++++
925 + 2 files changed, 46 insertions(+)
926 + create mode 100644 modules.d/06rngd/module-setup.sh
927 + create mode 100644 modules.d/06rngd/rngd.service
928 +
929 +diff --git a/modules.d/06rngd/module-setup.sh b/modules.d/06rngd/module-setup.sh
930 +new file mode 100644
931 +index 00000000..43d5c2d3
932 +--- /dev/null
933 ++++ b/modules.d/06rngd/module-setup.sh
934 +@@ -0,0 +1,39 @@
935 ++#!/bin/bash
936 ++# vim: set tabstop=8 shiftwidth=4 softtabstop=4 expandtab smarttab colorcolumn=80:
937 ++#
938 ++# Copyright (c) 2019 Red Hat, Inc.
939 ++# Author: Renaud Métrich <rmetrich@××××××.com>
940 ++#
941 ++# This program is free software: you can redistribute it and/or modify
942 ++# it under the terms of the GNU General Public License as published by
943 ++# the Free Software Foundation, either version 3 of the License, or
944 ++# (at your option) any later version.
945 ++#
946 ++# This program is distributed in the hope that it will be useful,
947 ++# but WITHOUT ANY WARRANTY; without even the implied warranty of
948 ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
949 ++# GNU General Public License for more details.
950 ++#
951 ++# You should have received a copy of the GNU General Public License
952 ++# along with this program. If not, see <http://www.gnu.org/licenses/>.
953 ++#
954 ++
955 ++depends() {
956 ++ echo systemd
957 ++ return 0
958 ++}
959 ++
960 ++check() {
961 ++ # if there's no rngd binary, no go.
962 ++ require_binaries rngd || return 1
963 ++
964 ++ return 0
965 ++}
966 ++
967 ++install() {
968 ++ inst rngd
969 ++ inst_simple "${moddir}/rngd.service" "${systemdsystemunitdir}/rngd.service"
970 ++ mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.wants"
971 ++ ln -rfs "${initdir}${systemdsystemunitdir}/rngd.service" \
972 ++ "${initdir}${systemdsystemunitdir}/sysinit.target.wants/rngd.service"
973 ++}
974 +diff --git a/modules.d/06rngd/rngd.service b/modules.d/06rngd/rngd.service
975 +new file mode 100644
976 +index 00000000..570fbedb
977 +--- /dev/null
978 ++++ b/modules.d/06rngd/rngd.service
979 +@@ -0,0 +1,7 @@
980 ++[Unit]
981 ++Description=Hardware RNG Entropy Gatherer Daemon
982 ++DefaultDependencies=no
983 ++Before=systemd-udevd.service
984 ++
985 ++[Service]
986 ++ExecStart=/usr/sbin/rngd -f
987 +--
988 +2.24.1
989 +