Created
May 6, 2020 06:55
-
-
Save toshke/186b6d50c0b437007b383d9f390a8bf5 to your computer and use it in GitHub Desktop.
Isolate binary using chroot
This file contains 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
function isolate_binary() { | |
binary=$(which $1) | |
libs=$(ldd -v $binary | grep -o '/.*[[:space:]]') | |
libs=($libs) | |
mkdir -p ${2}$(dirname $binary) | |
cp -vn ${binary} ${2}${binary} | |
for l in "${libs[@]}"; do mkdir -p ${2}$(dirname $l) && cp -vn ${l} ${2}${l}; done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment