commit:     cbe66396bdcfdcecd0bbd933c1c94704fd43a13e
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 26 22:57:50 2021 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Mar 26 22:57:50 2021 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=cbe66396

gen_initramfs.sh: append_zfs(): Update UDEV dir in UDEV rules

Because we are copying UDEV rules from host system, we have
to ensure that used UDEV dir matches our initramfs environment to
prevent errors like

  failed to execute '/lib/udev/vdev_id' '/lib/udev/vdev_id -e': No such file or 
directory

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 gen_initramfs.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 9a9f07d..aedd038 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -1111,6 +1111,15 @@ append_zfs() {
                local 
dest_file="${TDIR%/}${udev_file/${udevdir}/${udevdir_initramfs}}"
                cp -aL "${udev_file}" "${dest_file}" \
                        || gen_die "Failed to copy '${udev_file}' to 
'${dest_file}'"
+
+               if [[ "${dest_file}" == *.rules ]]
+               then
+                       print_info 5 "Updating UDEV dir in '${dest_file}' ..."
+                       sed -i \
+                               -e "s|${udevdir}|${udevdir_initramfs}|g" \
+                               "${dest_file}" \
+                               || gen_die "Failed to update UDEV dir in 
'${dest_file}'"
+               fi
        done
 
        cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"

Reply via email to