-
Notifications
You must be signed in to change notification settings - Fork 23
/
package.sh
executable file
·97 lines (72 loc) · 2.74 KB
/
package.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
#!/bin/bash
# Cydia Substrate - Powerful Code Insertion Platform
# Copyright (C) 2008-2011 Jay Freeman (saurik)
# GNU Lesser General Public License, Version 3 {{{
#
# Substrate is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# Substrate is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Substrate. If not, see <http://www.gnu.org/licenses/>.
# }}}
set -e
arch=$1
shift 1
pkg=package.${arch}
sudo rm -rf "${pkg}"
mkdir -p "${pkg}"/DEBIAN
control=${pkg}/DEBIAN/control
cat control."${arch}" >"${control}"
./control.sh >>"${control}"
lib=/Library/MobileSubstrate
mkdir -p "${pkg}/${lib}/DynamicLibraries"
fwk=/Library/Frameworks/CydiaSubstrate.framework
if [[ ${arch} == arm ]]; then
rsc=${fwk}
else
rsc=${fwk}/Resources
fi
mkdir -p "${pkg}/${rsc}"
for sub in Commands Headers Libraries; do
mkdir -p "${pkg}/${fwk}/${sub}"
done
cp -a Info.plist "${pkg}/${rsc}/Info.plist"
cp -a CydiaSubstrate.h "${pkg}/${fwk}/Headers"
cp -a SubstrateBootstrap.dylib "${pkg}/${fwk}/Libraries"
cp -a SubstrateLauncher.dylib "${pkg}/${fwk}/Libraries"
cp -a SubstrateLoader.dylib "${pkg}/${fwk}/Libraries"
cp -a libsubstrate.dylib "${pkg}/${fwk}/CydiaSubstrate"
mkdir -p "${pkg}/usr/lib"
ln -s libsubstrate.0.dylib "${pkg}/usr/lib/libsubstrate.dylib"
ln -s "${fwk}/CydiaSubstrate" "${pkg}/usr/lib/libsubstrate.0.dylib"
mkdir -p "${pkg}/usr/include"
ln -s "${fwk}/Headers/CydiaSubstrate.h" "${pkg}/usr/include/substrate.h"
mkdir -p "${pkg}/usr/bin"
for cmd in cycc cynject; do
ln -s "${fwk}/Commands/${cmd}" "${pkg}/usr/bin"
cp -a "${cmd}" "${pkg}/${fwk}/Commands"
done
cp -a extrainst_ postrm "${pkg}/DEBIAN"
if [[ ${arch} == arm ]]; then
ln -s "${fwk}"/Libraries/SubstrateInjection.dylib "${pkg}/${lib}/MobileSubstrate.dylib"
ln -s SubstrateBootstrap.dylib "${pkg}/${fwk}/Libraries/SubstrateInjection.dylib"
else
ln -s SubstrateLoader.dylib "${pkg}/${fwk}/Libraries/SubstrateInjection.dylib"
fi
function field() {
grep ^"$1": "${control}" | cut -d ' ' -f 2
}
sudo chown -R root:staff "${pkg}"
sudo chgrp procmod "${pkg}/${fwk}/Commands/cynject"
sudo chmod g+s "${pkg}/${fwk}/Commands/cynject"
#(cd "${pkg}" && find . -type f -o -type l)
deb=$(field Package)_$(field Version)_$(field Architecture).deb
dpkg-deb -b "${pkg}" "${deb}"
ln -sf "${deb}" "$(field Package)_$(field Architecture).deb"