diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2024-08-26 21:04:37 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-08-27 08:59:11 +0200 |
commit | ebc3837b0a28cfb1c337cba3172b6ca11b1fba53 (patch) | |
tree | 1e06ecb9b0944eef8690b0001fe01bbe4a5d8f6b | |
parent | 7d73359038197622bf8b619f57a2a82cee1469bd (diff) | |
download | mbuto-ebc3837b0a28cfb1c337cba3172b6ca11b1fba53.tar mbuto-ebc3837b0a28cfb1c337cba3172b6ca11b1fba53.tar.gz mbuto-ebc3837b0a28cfb1c337cba3172b6ca11b1fba53.tar.bz2 mbuto-ebc3837b0a28cfb1c337cba3172b6ca11b1fba53.tar.lz mbuto-ebc3837b0a28cfb1c337cba3172b6ca11b1fba53.tar.xz mbuto-ebc3837b0a28cfb1c337cba3172b6ca11b1fba53.tar.zst mbuto-ebc3837b0a28cfb1c337cba3172b6ca11b1fba53.zip |
mbuto: Fix handling of binaries in /usr/libexec
The FHS says that binaries under /usr/libexec are not intended to run
directly on the host, and not, as I incorrectly assumed (probably from
some outdated distribution guidelines), on other hosts only:
https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s07.html
If we move them to /usr/bin in the guest image, the helpers or
programs that are supposed to run those binaries might not find them.
We have, however, cases like /usr/libexec/qemu-kvm on some
distributions where we might have programs, on the host, which are
meant to run them, but we don't want to copy those to the guest image,
and we want to run the binary we copied from /usr/libexec directly.
This was the reason why I initially added this special handling.
Instead of doing that, simply add /usr/libexec to the guest's $PATH,
from the $FIXUP script.
Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
-rwxr-xr-x | mbuto | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -48,10 +48,13 @@ COPIES="${COPIES:-}" # Workers for time-consuming tasks such as stripping modules, see workers() THREADS="$(nproc)" -# Fix-up script to run before /init, can be omitted +# Fix-up script to run before /init, can be omitted. Note that we're adding +# /usr/libexec to PATH because, while a given program might not be intended to +# directly run on the host (that's what /usr/libexec is for), we might need to +# run it directly on the guest instead. [ -z "${FIXUP}" ] && FIXUP='#!/bin/sh -export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/sbin: +export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/sbin:/usr/libexec: mount -t proc proc /proc mount -t sysfs sys /sys @@ -752,14 +755,7 @@ prog_add() { unset IFS [ -z "${__bin}" ] && err "Can't source ${1}" - # Binaries in /usr/libexec are meant to run on other hosts only, so they - # can't reside in /usr/libexec on the target image. Move to /usr/bin. - if [ "$("${DIRNAME}" "${__bin}")" = "/usr/libexec" ]; then - __bindir="${wd}/usr/bin" - else - __bindir="${wd}$("${DIRNAME}" "${__bin}")" - fi - + __bindir="${wd}$("${DIRNAME}" "${__bin}")" "${MKDIR}" -p "${__bindir}" "${CP}" --preserve=all "${__bin}" "${__bindir}" |