Created
November 11, 2019 23:31
-
-
Save Kimeiga/47eab1e92cc212b1f0b464571e85c233 to your computer and use it in GitHub Desktop.
alpine ldconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$1" = "-p" ]; then | |
# Hack to mimic GNU ldconfig s -p option, needed by ctypes, used by shapely | |
echo " libc.musl-x86_64.so.1 (libc6,x86-64) => /lib/libc.musl-x86_64.so.1" | |
exit 0 | |
fi | |
scan_dirs() { | |
scanelf -qS "$@" | while read SONAME FILE; do | |
TARGET="${FILE##*/}" | |
LINK="${FILE%/*}/$SONAME" | |
case "$FILE" in | |
/lib/*|/usr/lib/*|/usr/local/lib/*) ;; | |
*) [ -h "$LINK" -o ! -e "$LINK" ] && ln -sf "$TARGET" "$LINK" | |
esac | |
done | |
return 0 | |
} | |
# eat ldconfig options | |
while getopts "nNvXvf:C:r:" opt; do | |
: | |
done | |
shift $(( $OPTIND - 1 )) | |
[ $# -gt 0 ] && scan_dirs "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment