From 8db2b6ad75fcfaebcf5d1d4911840810bf31f384 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 18 May 2021 10:30:23 +0200 Subject: [PATCH] fix for `str_replace: command not found` --- 0004.patch | 1 + 0005.patch | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ dracut.spec | 6 +++++- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 0005.patch diff --git a/0004.patch b/0004.patch index 9736fbe..7cd4449 100644 --- a/0004.patch +++ b/0004.patch @@ -36,3 +36,4 @@ index bfb7a1ac..24e1c2e7 100755 [[ -c ${initdir}/dev/null ]] || mknod "${initdir}"/dev/null c 1 3 [[ -c ${initdir}/dev/kmsg ]] || mknod "${initdir}"/dev/kmsg c 1 11 [[ -c ${initdir}/dev/console ]] || mknod "${initdir}"/dev/console c 5 1 + diff --git a/0005.patch b/0005.patch new file mode 100644 index 0000000..9da286d --- /dev/null +++ b/0005.patch @@ -0,0 +1,57 @@ +From 805599442110985dfee83ea826d35b5943805313 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 18 May 2021 10:13:56 +0200 +Subject: [PATCH] fix(base): add missing `str_replace` to `dracut-dev-lib.sh` + +``` +dracut-dev-lib.sh: line 92: str_replace: command not found +dracut-dev-lib.sh: line 98: /var/tmp/dracut.sabKZg/initramfs/initqueue/finished/devexists-.sh: No such file or directory +dracut-dev-lib.sh: line 83: /var/tmp/dracut.sabKZg/initramfs/emergency/80-.sh: No such file or directory +``` +--- + modules.d/99base/dracut-dev-lib.sh | 20 ++++++++++++++++++++ + modules.d/99base/module-setup.sh | 1 + + 2 files changed, 21 insertions(+) + +diff --git a/modules.d/99base/dracut-dev-lib.sh b/modules.d/99base/dracut-dev-lib.sh +index 5083f4f2..0df22b82 100755 +--- a/modules.d/99base/dracut-dev-lib.sh ++++ b/modules.d/99base/dracut-dev-lib.sh +@@ -1,5 +1,25 @@ + #!/bin/sh + ++# replaces all occurrences of 'search' in 'str' with 'replacement' ++# ++# str_replace str search replacement ++# ++# example: ++# str_replace ' one two three ' ' ' '_' ++str_replace() { ++ local in="$1" ++ local s="$2" ++ local r="$3" ++ local out='' ++ ++ while [ "${in##*"$s"*}" != "$in" ]; do ++ chop="${in%%"$s"*}" ++ out="${out}${chop}$r" ++ in="${in#*"$s"}" ++ done ++ echo "${out}${in}" ++} ++ + # get a systemd-compatible unit name from a path + # (mimicks unit_name_from_path_instance()) + dev_unit_name() { +diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh +index 7eb0a277..07c33eef 100755 +--- a/modules.d/99base/module-setup.sh ++++ b/modules.d/99base/module-setup.sh +@@ -117,6 +117,7 @@ install() { + export DRACUT_SYSTEMD=1 + fi + export PREFIX="$initdir" ++ export hookdir=/lib/dracut/hooks + + # shellcheck source=dracut-dev-lib.sh + . "$moddir/dracut-dev-lib.sh" diff --git a/dracut.spec b/dracut.spec index 683454b..499c844 100644 --- a/dracut.spec +++ b/dracut.spec @@ -5,7 +5,7 @@ # strip the automatically generated dep here and instead co-own the # directory. %global __requires_exclude pkg-config -%define dist_free_release 5.git20210517 +%define dist_free_release 6.git20210518 Name: dracut Version: 054 @@ -33,6 +33,7 @@ Patch1: 0001.patch Patch2: 0002.patch Patch3: 0003.patch Patch4: 0004.patch +Patch5: 0005.patch Source1: https://www.gnu.org/licenses/lgpl-2.1.txt @@ -488,6 +489,9 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ %{_prefix}/lib/kernel/install.d/51-dracut-rescue.install %changelog +* Tue May 18 2021 Harald Hoyer - 054-6.git20210518 +- fix for `str_replace: command not found` + * Mon May 17 2021 Harald Hoyer - 054-4.git20210517 - version 054