-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathinstall_theos.sh
executable file
·178 lines (157 loc) · 5.99 KB
/
install_theos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!/bin/bash
THEOS_INSTALL_DIR="/opt"
THEOS=${THEOS_INSTALL_DIR}/theos
BIGBOSS_REPO="http://apt.thebigboss.org/repofiles/cydia"
SUBSTRATE_REPO="http://apt.saurik.com"
if [ "$(pwd | grep travis)" -o "$CI" = "true" -o "$TRAVIS" = "true" ]; then
echo "This is travis."
THEOS_INSTALL_DIR=$(pwd)
THEOS=${THEOS_INSTALL_DIR}/theos
fi
# initial theos install directory check
if [ ! -d "$THEOS_INSTALL_DIR" ]; then
echo "making $THEOS_INSTALL_DIR"
sudo mkdir -p $THEOS_INSTALL_DIR
fi
function install_from_telesphoreo() {
cd /tmp
echo "Downloading $1 header and library..."
if [ -z "$(find TelesphoreoPackages.bz2 -mmin -60 > /dev/null 2>&1)" ]; then
rm -f TelesphoreoPackages.bz2
curl -s -L "${SUBSTRATE_REPO}/dists/tangelo-3.7/main/binary-iphoneos-arm/Packages.bz2" > TelesphoreoPackages.bz2
fi
pkg_path=$(bzcat TelesphoreoPackages.bz2 | grep "debs/$1" | awk '{print $2}' | sort -n | tail -1)
pkg=$(basename $pkg_path)
curl -s -L "${SUBSTRATE_REPO}/${pkg_path}" > $pkg
if [ "$1" == "mobilesubstrate" ]; then
ar -p $pkg data.tar.lzma | tar -Jxf - ./Library/Frameworks/CydiaSubstrate.framework
mv ./Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h $THEOS/include/substrate.h
mv ./Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate $THEOS/lib/libsubstrate.dylib
rm -rf $pkg /tmp/Library
elif [ "$1" == "ldid" ]; then
ar -p $pkg data.tar.gz | tar -zxvf- --strip-components 2 ./usr/bin/ldid
mv bin/ldid $THEOS/bin
rmdir bin
rm -f $pkg
fi
}
function install_theos() {
# clone theos.git
cd $THEOS_INSTALL_DIR
sudo git clone --recursive -b pure-objc-flag https://github.com/r-plus/theos.git
sudo chown -R $USER $THEOS
# clone iphoneheaders.git
cd $THEOS
mv include include.bak
ln -s ../iphoneheaders include
cd $THEOS_INSTALL_DIR
sudo git clone --recursive https://github.com/r-plus/iphoneheaders.git
sudo chown -R $USER iphoneheaders
# get IOSurfaceAPI.h
cd $THEOS/include/IOSurface
cp /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOSurface.framework/Versions/A/Headers/IOSurfaceAPI.h $THEOS/include/IOSurface/
sed -i .orig -e 's/xpc_object_t/id/g' -e 's/XPC_RETURNS_RETAINED//' -e 's/IOSFC_SWIFT_NAME(IOSurfaceRef)//g' -e 's/IOSFC_AVAILABLE_BUT_DEPRECATED(__MAC_10_6, __MAC_10_11, __IPHONE_3_0, __IPHONE_9_0)//g' IOSurfaceAPI.h
# clone theos-nic-templates.git
cd $THEOS/templates/
git clone https://github.com/orikad/theos-nic-templates.git
# get flipswitch nic template
cd /tmp
git clone https://github.com/a3tweaks/Flipswitch.git
cd "Flipswitch/NIC Template"
mkdir -p $THEOS/templates/iphone_flipswitch
cp iphone_flipswitch_switch.nic.tar $THEOS/templates/iphone_flipswitch/
# get full sdks.
cd $THEOS
rm -fr sdks
git clone https://github.com/theos/sdks.git
# get 9.2 sdk
cd $THEOS/sdks
curl -sL 'https://sdks.website/dl/iPhoneOS9.2.sdk.tbz2' | tar xj
# get ldid.
# `brew install ldid`
if [ -z $(type -P ldid) ]; then
echo "Should install ldid"
exit 1
fi
# get dpkg for Mac OS X
# `brew install dpkg`
if [ -z $(type -P dpkg) ]; then
echo "Should install dpkg"
exit 1
fi
# get libobjcipc headers.
mkdir -p $THEOS/include/objcipc
cd /tmp
git clone https://github.com/a1anyip/libobjcipc.git
cd libobjcipc
cp *.h $THEOS/include/objcipc/
# get libstatusbar headers.
mkdir -p $THEOS/include/libstatusbar
cd /tmp
git clone https://github.com/phoenix3200/libstatusbar.git
cd libstatusbar
cp *.h $THEOS/include/libstatusbar/
}
function install_library_from_bigboss() {
cd /tmp
echo "Downloading $1 /usr directory..."
if [ -z "$(find BigBossPackages.bz2 -mmin -60 > /dev/null 2>&1)" ]; then
rm -f BigBossPackages.bz2
curl -s -L "${BIGBOSS_REPO}/dists/stable/main/binary-iphoneos-arm/Packages.bz2" > BigBossPackages.bz2
fi
pkg_path=$(bzcat BigBossPackages.bz2 | grep "debs2.0/$1" | awk '{print $2}')
pkg=$(basename $pkg_path)
curl -s -L "${BIGBOSS_REPO}/${pkg_path}" > $pkg
data=$(ar -t $pkg | grep data.tar)
ar -p $pkg $data | tar -zxf - ./usr
cp -a ./usr/ $THEOS/
rm -rf usr $pkg
}
function install_inspectivec() {
cd /tmp
DAVID_REPO="http://apt.golddavid.com"
echo "Downloading Inspective-C /usr directory..."
if [ -z "$(find DavidPackages.bz2 -mmin -60 > /dev/null 2>&1)" ]; then
rm -f DavidPackages.bz2
curl -s -L "${DAVID_REPO}/Packages.bz2" > DavidPackages.bz2
fi
pkg_path=$(bzcat DavidPackages.bz2 | grep "debs/com.golddavid.inspectivec" | awk '{print $2}' | sort -n | tail -1)
pkg=$(basename $pkg_path)
curl -s -L "${DAVID_REPO}/${pkg_path}" > $pkg
data=$(ar -t $pkg | grep data.tar)
ar -p $pkg $data | tar -zxf - ./usr
cp -a ./usr/ $THEOS/
rm -rf usr $pkg
curl -s -L "https://raw.githubusercontent.com/DavidGoldman/InspectiveC/master/InspectiveC.h" > $THEOS/include/InspectiveC.h
}
function re_install_all_libraries() {
install_from_telesphoreo mobilesubstrate
install_library_from_bigboss libactivator
install_library_from_bigboss actionmenu_
# install_library_from_bigboss applist
# install_library_from_bigboss preferenceloader
# install_library_from_bigboss com.a3tweaks.flipswitch
install_library_from_bigboss libobjcipc
install_inspectivec
}
function substitude_theos_in_dropbox() {
for i in $(find ~/Dropbox -name "theos" -type d); do
TWEAK_DIR=$(dirname $i)
rm -fr $i
ln -s $THEOS $i
done
}
if [ $# -eq 0 ]; then
install_theos
re_install_all_libraries
elif [ "$1" = "dropbox" ]; then
substitude_theos_in_dropbox
elif [ "$1" = "mobilesubstrate" -o "$1" = "ldid" ]; then
install_from_telesphoreo $1
else
for i in $@; do
install_library_from_bigboss $i
done
fi
echo "Done."
# vim: set ts=4 sw=4 sts=4 expandtab: