summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2020-07-23 22:59:33 +0200
committerThomas Deutschmann <whissi@gentoo.org>2020-07-24 00:56:48 +0200
commitfe4f505dab7c4c1420c54d493d638445d95dc742 (patch)
tree99c194376595e2b917f461b7813ebda54e90c7f7 /gen_initramfs.sh
parentbcache: Switch to UDEV usage (diff)
downloadgenkernel-fe4f505dab7c4c1420c54d493d638445d95dc742.tar.gz
genkernel-fe4f505dab7c4c1420c54d493d638445d95dc742.tar.bz2
genkernel-fe4f505dab7c4c1420c54d493d638445d95dc742.zip
multipath: Switch to UDEV usage
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'gen_initramfs.sh')
-rwxr-xr-xgen_initramfs.sh31
1 files changed, 28 insertions, 3 deletions
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index af0ff44..1b8c829 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -701,15 +701,40 @@ append_multipath() {
mkdir -p "${TDIR}"/etc || gen_die "Failed to create '${TDIR}/etc'!"
+ mkdir -p "${TDIR}"/usr/lib/udev/rules.d || gen_die "Failed to create '${TDIR}/usr/lib/udev/rules.d'!"
+
local libdir=$(get_chost_libdir)
+ if [[ "${libdir}" =~ ^/usr ]]
+ then
+ libdir=${libdir/\/usr/}
+ fi
copy_binaries \
- "${TDIR}"\
+ "${TDIR}" \
/sbin/multipath \
/sbin/kpartx \
/sbin/mpathpersist \
- ${libdir}/multipath/lib*.so \
- /lib/udev/scsi_id
+ ${libdir}/multipath/lib*.so
+
+ local udevdir=$(get_udevdir)
+ local udevdir_initramfs="/usr/lib/udev"
+ local udev_files=( $(qlist -e sys-fs/multipath-tools:0 \
+ | xargs --no-run-if-empty realpath \
+ | grep -E -- "^${udevdir}")
+ )
+
+ if [ ${#udev_files[@]} -eq 0 ]
+ then
+ gen_die "Something went wrong: Did not found any udev-related files for sys-fs/multipath-tools!"
+ fi
+
+ local udev_files
+ for udev_file in "${udev_files[@]}"
+ do
+ 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}'"
+ done
cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"