Skip to content

Instantly share code, notes, and snippets.

@christoph-jerolimov
Last active October 12, 2019 15:17
Show Gist options
  • Save christoph-jerolimov/6289262 to your computer and use it in GitHub Desktop.
Save christoph-jerolimov/6289262 to your computer and use it in GitHub Desktop.
Create a OSX chroot ... not finished... works partly, but neighter network nor node.js :S
#!/bin/bash
#set -e
jail="jail"
if [ -e "$jail" ]; then
echo Folder already exists: "$jail"
exit -1
fi
mkdir -p "$jail"
mkdir -p "$jail/etc" "$jail/private/etc"
cp /etc/* "$jail/etc"
cp /private/etc/* "$jail/private/etc"
#mkdir "$jail/etc"
#cp /etc/hosts /etc/resolv.conf "$jail/etc"
# base system: /bin/* /usr/bin/* /usr/lib/* /usr/lib/System/*
for src in /bin /usr/bin /usr/lib /usr/lib/System; do
dest=`echo $src | sed 's/^.//'`
mkdir -p "$jail/$dest"
cp -n $src/* "$jail/$dest"
done
for src in \
/System/Library/Frameworks/Security.framework/Versions/A \
/System/Library/Frameworks/CoreFoundation.framework/Versions/A \
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit \
/System/Library/Frameworks/Kerberos.framework/Versions/A \
/System/Library/PrivateFrameworks/Heimdal.framework/Versions/A \
/System/Library/PrivateFrameworks/TrustEvaluationAgent.framework/Versions/A \
/System/Library/Frameworks/CFNetwork.framework/Versions/A \
/System/Library/Frameworks/SystemConfiguration.framework/Versions/A \
/System/Library/Frameworks/LDAP.framework/Versions/A \
/System/Library/Frameworks/SecurityFoundation.framework/Versions/A \
/System/Library/Frameworks/NetFS.framework/Versions/A \
/System/Library/Frameworks/Carbon.framework/Versions/A \
/System/Library/Frameworks/Foundation.framework/Versions/C \
/System/Library/Frameworks/CoreServices.framework/Versions/A \
/System/Library/Frameworks/ApplicationServices.framework/Versions/A \
/System/Library/Frameworks/CoreGraphics.framework/Versions/A \
/System/Library/Frameworks/CoreText.framework/Versions/A \
/System/Library/Frameworks/ImageIO.framework/Versions/A \
/System/Library/Frameworks/IOSurface.framework/Versions/A \
/System/Library/Frameworks/Accelerate.framework/Versions/A
do
dest=`echo $src | sed 's/^.//'`
mkdir -p `dirname "$jail/$dest"`
cp -nR "$src" "$jail/$dest"
done
cp `which nave` "$jail"
cp `which node` "$jail"
@desarrollogis
Copy link

dude, i am able to run curl, but partly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment