summaryrefslogtreecommitdiffstats
path: root/builder
diff options
context:
space:
mode:
authorJonathan Bauer2019-08-13 10:38:36 +0200
committerJonathan Bauer2019-08-13 10:38:36 +0200
commitdf199394bcca85b13d668dd79213eb991d2c7016 (patch)
treed54f51d9286e91b62b0e1063a5f67c62bbb92952 /builder
parent[dnbd3-rfs] add PATH to find dnbd3-client (diff)
downloadsystemd-init-df199394bcca85b13d668dd79213eb991d2c7016.tar.gz
systemd-init-df199394bcca85b13d668dd79213eb991d2c7016.tar.xz
systemd-init-df199394bcca85b13d668dd79213eb991d2c7016.zip
[slx-addons] refine ldconfig calls
TIL: hash -t prints nothing if the binary was not hashed already. type does.
Diffstat (limited to 'builder')
-rw-r--r--builder/modules.d/slx-addons/scripts/setup-addons.sh19
1 files changed, 7 insertions, 12 deletions
diff --git a/builder/modules.d/slx-addons/scripts/setup-addons.sh b/builder/modules.d/slx-addons/scripts/setup-addons.sh
index 701f5d25..c6b7f427 100644
--- a/builder/modules.d/slx-addons/scripts/setup-addons.sh
+++ b/builder/modules.d/slx-addons/scripts/setup-addons.sh
@@ -84,21 +84,16 @@ setup_addon() {
local ADDON_LD_CACHE="$NEWROOT/opt/openslx/etc/$ADDON.ld.so.cache"
if [ ! -e "$ADDON_LD_CACHE" ] || ! mv -f -- "$ADDON_LD_CACHE" "$NEWROOT/etc/ld.so.cache" ; then
# Using prebuilt ld cache failed, try hard to find a ldconfig...
- local LDCONFIG="$(hash -t ldconfig 2>/dev/null)"
- if [ -n "$LDCONFIG" ] && ! "${LDCONFIG}" --root "$NEWROOT"; then
- return 0
- fi
- # try with chroot if we have it
- local CHROOT_PATH="$(hash -t chroot 2>/dev/null)"
- if [ -n "$CHROOT_PATH" ] && "$CHROOT_PATH" "$NEWROOT" ldconfig; then
- return 0
- fi
- # fallbacks to file paths...
- for LDCONFIG_CANDIDATE in {,${NEWROOT}/sbin/}ldconfig{,.real}; do
- if [ -x "$LDCONFIG_CANDIDATE" ] && ${LDCONFIG_CANDIDATE} -r "$NEWROOT"; then
+ for LDCONFIG in "$(type -p ldconfig 2>/dev/null)" "${NEWROOT}/sbin/ldconfig.real"; do
+ if [ -x "$LDCONFIG" ] && "$LDCONFIG" --root "$NEWROOT"; then
return 0
fi
done
+ # try with chroot if we have it
+ local CHROOT_PATH="$(type -p chroot 2>/dev/null)"
+ if [ -x "$CHROOT_PATH" ] && "$CHROOT_PATH" "$NEWROOT" ldconfig; then
+ return 0
+ fi
# very bad indeed, libraries won't be registered in the cache ...
warn "Failed to find 'ldconfig' to rebuild the addon's missing ld.so.cache..."
return 1