Skip to content

Instantly share code, notes, and snippets.

@EricRabil
Last active June 5, 2019 04:49
Show Gist options
  • Select an option

  • Save EricRabil/9684bfea836e8b6f1d0d70625f2264d6 to your computer and use it in GitHub Desktop.

Select an option

Save EricRabil/9684bfea836e8b6f1d0d70625f2264d6 to your computer and use it in GitHub Desktop.
my installer script for simject. ymmv
export THEOS=${THEOS:-~/theos}
export SIMJECT=${SIMJECT:-~/simject}
install_theos_deps() {
LDID_VERSION=$(brew ls --versions ldid)
XZ_VERSION=$(brew ls --versions xz)
if [ -z "$LDID_VERSION" ]
then
echo "has ldid: no";
BREW_ARGS=" ldid"
else
echo "has ldid: yes";
fi
if [ -z "$XZ_VERSION" ]
then
echo "has xz: no";
BREW_ARGS+=" xz"
else
echo "has xz: yes";
fi
if [ -z "$BREW_ARGS" ]
then
echo "no brew deps to install for theos! yay :)"
else
echo "installing brew deps"
brew install $BREW_ARGS
fi
}
install_theos() {
install_theos_deps
# Clone Theos to your device:
git clone --recursive https://github.com/theos/theos.git $THEOS
# Downloading SDKs from DavidSkrundz
if [[ "$1" == 1 ]]
then
curl -LO https://github.com/DavidSkrundz/sdks/archive/master.zip
TMP=$(mktemp -d)
unzip -qq master.zip -d $TMP
mv $TMP/*.sdk $THEOS/sdks
rm -r master.zip $TMP
fi
if [[ "$2" == 1 ]]
then
curl https://ghostbin.com/ghost.sh -o $THEOS/bin/ghost
chmod +x $THEOS/bin/ghost
fi
}
install_simject() {
git clone https://github.com/angelXwind/simject.git $SIMJECT
cd $SIMJECT || { echo "Couldn't cd into $SIMJECT after cloning >:("; exit 2;}
make setup
}
install_substrate_thing() {
echo "list of substrate things
subst: if you target iOS 12+ (of Xcode 10+)
cs: install cycript's CydiaSubstrate
link: if you only want to symlink CydiaSubstrate.framework to new iOS runtimes"
read -p "which substrate thing? [subst/cs/link] " -r
curl https://raw.githubusercontent.com/angelXwind/simject/master/installsubstrate.sh | exec sudo bash -s $REPLY
}
setup_path() {
echo "
run these commands if theyre missing from your rc file"
echo "
echo \"export PATH=\\\"$SIMJECT/bin:\$PATH\\\"\" >> ~/.zshrc
echo \"export THEOS=\\\"$THEOS\\\"\" >> ~/.zshrc
echo \"export SIMJECT=\\\"$SIMJECT\\\"\" >> ~/.zshrc
source ~/.zshrc
"
source ~/.zshrc
echo "open a new session for path change to take effect"
}
# option is -k
# download sdks from https://github.com/DavidSkrundz/sdks for simject
do_download_sdks=0
# option is -g
# idfk bro
do_ghostin_script=0
# option is -t
# theos thing
do_install_theos=0
# option is -s
# simject thing
do_install_simject=0
# option is -m
# create a template using the theos nic builder
create_template=0
# option is -r
# output the commands necessary for zshrc
show_profile_cmds=0
# option is -c
# install whicher substrate thingy u need (it asks you at runtime)
do_install_substrate_shit=0
while getopts 'kgtsmrc' opt
do
case "$opt" in
k) do_download_sdks=1;;
g) do_ghostin_script=1;;
t) do_install_theos=1;;
s) do_install_simject=1;;
m) create_template=1;;
r) show_profile_cmds=1;;
c) do_install_substrate_shit=1;;
esac
done
if [[ $do_install_theos == 1 ]]
then
echo "installing theos: yes"
install_theos $do_download_sdks $do_ghostin_script
else
echo "installing theos: no"
fi
if [[ $do_install_simject == 1 ]]
then
echo "installing simject: yes"
install_simject
else
echo "installing simject: no"
fi
if [[ $do_install_substrate_shit == 1 ]]
then
echo "installing sdks: yes"
install_substrate_thing $substrate_thing
else
echo "installing sdks: no"
fi
if [[ $create_template == 1 ]]
then
echo "running theos nic"
exec $THEOS/bin/nic.pl
fi
setup_path
echo "simject directory: $SIMJECT"
echo "theos directory: $THEOS"
echo "read the simject docs at https://github.com/angelXwind/simject"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment