Skip to content

Instantly share code, notes, and snippets.

@fcicq
Last active August 1, 2019 12:44
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 fcicq/4408d0836838bbaec6f2b05f25463929 to your computer and use it in GitHub Desktop.
Save fcicq/4408d0836838bbaec6f2b05f25463929 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ $# != 2 ]; then
echo usage $0 BINARY FOLDER
exit 1
fi
if [ ! -f $1 ]; then
echo file $1 not found
exit
fi
echo mkdir -p $2
echo mkdir -p "$2/$(dirname $1)"
echo cp -L "$1" "$2"
for lib in `ldd "$1" | cut -d'>' -f2 | awk '{print \$1}'` ; do
echo mkdir -p "$2/$(dirname $lib)"
echo [ ! -f "$2/$lib" ] \&\& cp -L "$lib" "$2/$(dirname $lib)"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment