diff options
author | toni <matzeton@googlemail.com> | 2013-05-02 01:04:15 +0200 |
---|---|---|
committer | toni <matzeton@googlemail.com> | 2013-05-02 01:04:15 +0200 |
commit | baa0998095617705612d734ab1a9f8be5b45e126 (patch) | |
tree | 77755cda6d0e74cd4f28c01376c78d195ed2006b /copy_so.sh | |
parent | e33b5930923a439f4c73b6dd64253578c4131420 (diff) |
xmonad related configs
copy_so.sh: copy shared libs needed by a binary to a specified location
Diffstat (limited to 'copy_so.sh')
-rwxr-xr-x | copy_so.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/copy_so.sh b/copy_so.sh new file mode 100755 index 0000000..3cac82d --- /dev/null +++ b/copy_so.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +[ -z "$LDD" ] && LDD=/usr/bin/ldd +[ -z "$GREP" ] && GREP=/bin/grep + +LDD_EXP='/(.*).so(|.[[:digit:]]+)*' +if [ $# -ne 2 ]; then + echo "usage: $0 [binary] [destdir]" >&2 + exit 1 +else + BIN="${1}" + DEST="${2}" +fi + +SO_FILES=$(${LDD} ${BIN} | ${GREP} -oE ${LDD_EXP}) + +[ -d ${DEST} ] || mkdir -p ${DEST} +for file in ${SO_FILES}; do + if [ ! -r ${file} ]; then + echo "$0: $file not readable." + continue + fi + libdir=$(dirname ${DEST}/${file}) + mkdir -p ${libdir} + cp ${file} ${libdir}/ +done + |