summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2022-05-15 21:57:54 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2022-05-15 21:57:54 -0700
commit78968ce2101c68eabe38956495ba9d7b7f095875 (patch)
tree5c5a33e39071ceff1303dbc9095c543ea6022d77
parentgen_initramfs.sh: append devicemanager only for dmraid, luks, or lvm (diff)
parentgkbuild/cryptsetup: Install the correct binaries with slibtool (diff)
downloadgenkernel-78968ce2101c68eabe38956495ba9d7b7f095875.tar.gz
genkernel-78968ce2101c68eabe38956495ba9d7b7f095875.tar.bz2
genkernel-78968ce2101c68eabe38956495ba9d7b7f095875.zip
gkbuild: Install the correct binaries with slibtool
Closes: https://github.com/gentoo/genkernel/pull/33 Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-xgen_funcs.sh23
-rw-r--r--gkbuilds/cryptsetup.gkbuild3
-rw-r--r--gkbuilds/util-linux.gkbuild7
3 files changed, 26 insertions, 7 deletions
diff --git a/gen_funcs.sh b/gen_funcs.sh
index db396e3e..176fa140 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -1983,6 +1983,29 @@ check_distfiles() {
fi
}
+# @FUNCTION: install_exe
+# @USAGE: <file> <destination>
+# @DESCRIPTION:
+# Finds an executable binary file and installs it in cases where there may be
+# similarly named shell wrapper scripts. This happens when GNU libtool creates
+# an executable named 'foo' while slibtool creates '.libs/foo' and 'foo' is a
+# shell script that should not be installed.
+install_exe() {
+ local file="${1##*/}"
+ local dest="${2}"
+
+ local dir
+ [[ "${1%/*}" == "${file}" ]] || dir="${1%/*}/"
+
+ [[ -f "${dir}${file}" ]] || gen_die "File '${dir}${file}' does not exist!"
+
+ # Ensure only the binaries are installed and not a similarly named wrapper script
+ find "${S}/${dir}" -type f -name "${file}" -print0 |
+ xargs -0 file | grep executable | grep ELF | cut -f 1 -d : |
+ xargs -I '{}' cp -a '{}' "${dest}" ||
+ gen_die "Failed to copy '${S}/${dir}${file}' to '${dest}'!"
+}
+
# @FUNCTION: expand_file
# @USAGE: <file>
# @DESCRIPTION:
diff --git a/gkbuilds/cryptsetup.gkbuild b/gkbuilds/cryptsetup.gkbuild
index 007874d1..816df609 100644
--- a/gkbuilds/cryptsetup.gkbuild
+++ b/gkbuilds/cryptsetup.gkbuild
@@ -34,8 +34,7 @@ src_install() {
"${D}"/sbin/* \
"${D}"/usr/share/
- cp -a cryptsetup.static "${D}"/sbin/cryptsetup \
- || die "Failed to copy '${S}/cryptsetup.static' to '${D}/sbin/cryptsetup'!"
+ install_exe 'cryptsetup.static' "${D}"/sbin/cryptsetup
"${STRIP}" --strip-all "${D}"/sbin/cryptsetup \
|| die "Failed to strip '${D}/sbin/cryptsetup'!"
diff --git a/gkbuilds/util-linux.gkbuild b/gkbuilds/util-linux.gkbuild
index 40ea1fbb..5addbb1d 100644
--- a/gkbuilds/util-linux.gkbuild
+++ b/gkbuilds/util-linux.gkbuild
@@ -47,11 +47,8 @@ src_install() {
mkdir "${D}"/sbin || die "Failed to create '${D}/sbin'!"
- cp -a blkid.static "${D}"/sbin/blkid \
- || die "Failed to copy '${S}/blkid.static' to '${D}/sbin/blkid'!"
-
- cp -a switch_root "${D}"/sbin/switch_root \
- || die "Failed to copy '${S}/switch_root' to '${D}/sbin/switch_root'!"
+ install_exe 'blkid.static' "${D}"/sbin/blkid
+ install_exe 'switch_root' "${D}"/sbin/switch_root
local sbin
for sbin in \