From baa0998095617705612d734ab1a9f8be5b45e126 Mon Sep 17 00:00:00 2001 From: toni <matzeton@googlemail.com> Date: Thu, 2 May 2013 01:04:15 +0200 Subject: xmonad related configs copy_so.sh: copy shared libs needed by a binary to a specified location --- copy_so.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 copy_so.sh (limited to 'copy_so.sh') 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 + -- cgit v1.2.3