Skip to content

Instantly share code, notes, and snippets.

@Kimeiga
Created November 11, 2019 23:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kimeiga/47eab1e92cc212b1f0b464571e85c233 to your computer and use it in GitHub Desktop.
Save Kimeiga/47eab1e92cc212b1f0b464571e85c233 to your computer and use it in GitHub Desktop.
alpine ldconfig
#!/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