Skip to content

Instantly share code, notes, and snippets.

@lottspot
Created May 23, 2013 07:49
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 lottspot/5633358 to your computer and use it in GitHub Desktop.
Save lottspot/5633358 to your computer and use it in GitHub Desktop.
This single loop script is designed to make it simple to gather any needed libraries to execute a particular executable in one location, such are during the creation of an initramfs.
#!/bin/bash
###########################################################################################################
#
# Single loop for copying all dynamically linked libraries needed by an executable to a specified location
#
###########################################################################################################
EXECUTABLE=$1
DEST=/path/to/destination/dir/
for lib in $(ldd ${EXECUTABLE} | awk -F"=>" '{ print $2 }' | awk '{ print $1 }')
do cp $lib ${DEST}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment