Last active
October 24, 2015 12:12
-
-
Save npcardoso/920051ac16ba4d4f576a to your computer and use it in GitHub Desktop.
A chroot wrapper for pixelserv (https://github.com/HunterZ/pixelserv)
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
#!/bin/sh | |
set -e | |
P=`readlink -m $0` | |
P="$P.bin" | |
HOME='/tmp/pixelserv/chroot' | |
if [[ ! -d $HOME ]]; then | |
echo "Creating '$HOME'" | |
mkdir $HOME -p | |
fi | |
DEPS=`ldd $P | grep '/' | sed 's|[^/]*\(/[^ ]*\).*|\1|'` | |
echo "Copying '$P'" | |
cp $P $HOME | |
for d in $DEPS; do | |
echo "Copying '$d'" | |
cp --parents -L $d $HOME | |
done | |
echo "Setting perms" | |
chmod a+rx "$HOME/" -R | |
echo "Launching" | |
exec chroot --userspec=nobody:nobody $HOME ./pixelserv.bin -f -p 8888 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment