Skip to content

Instantly share code, notes, and snippets.

@Trass3r
Last active July 22, 2020 12:35
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 Trass3r/143bffd3599af1c7100d3bc19943fa7b to your computer and use it in GitHub Desktop.
Save Trass3r/143bffd3599af1c7100d3bc19943fa7b to your computer and use it in GitHub Desktop.
copy executable with dependencies and fix rpath
#!/bin/bash
set -e
mkdir -p $2 && cd $2
ldd $1 | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp -v '{}' .
cp $1 .
patchelf --set-rpath '$ORIGIN/.' *
rm libc.* libgcc* librt.* libpthread* libdl.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment