Last active
December 4, 2015 06:04
-
-
Save ekimekim/33fbe944508da6cfce86 to your computer and use it in GitHub Desktop.
lddcopy - A script to copy all required libraries to a output directory
This file contains hidden or 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/bash | |
| USAGE="$0 EXECUTABLE PATH | |
| For all shared libraries used by EXECUTABLE, copy that .so file to PATH" | |
| if [ "$#" -ne 2 ]; then | |
| echo "$USAGE" >&2 | |
| exit 1 | |
| fi | |
| executable="$1" | |
| path="$2" | |
| if ! [ -d "$path" ]; then | |
| echo "PATH must be a directory" | |
| exit 1 | |
| fi | |
| ldd "$executable" | | |
| awk '$2 == "=>" && $3 " " $4 != "not found" {print $1, $3}' | | |
| while read name libpath; do | |
| echo "Copying $name at $libpath" | |
| cp "$libpath" "$path" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment