forked from pwn20wndstuff/Undecimus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post.sh
executable file
·86 lines (79 loc) · 2.65 KB
/
post.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
#!/bin/sh
# Get path for dpkg
set -e
if [ -f ~/.profile ]; then
. ~/.profile
fi
if [[ "${CODE_SIGNING_REQUIRED}" == "NO" ]]; then
if which -s gtar; then
TAR=gtar
elif which -s gnutar; then
TAR=gnutar
else
TAR=tar
fi
LISTSRC="${SOURCE_ROOT}/Undecimus/resources/lists.tar.lzma"
pushd "${TEMP_DIR}"
rm -rf lists
mkdir lists
pushd lists
${TAR} xf "${LISTSRC}"
cp -a ../lists ../lists-packaged
CURLARGS=("-H" "X-Firmware: 11.0" "-H" "X-Machine: iPhone0,0" "-H" "X-Unique-ID: 42" "-H" "User-Agent: Telesphoreo APT-HTTP/1.0.592")
for file in $(ls); do
echo ${file}
tfile="${file}"
if [[ "${file%_Packages}" != "${file}" ]]; then
file="${file}.bz2"
fi
HTTPURL="http://${file//_//}"
HTTPSURL="https://${file//_//}"
if ! curl "${CURLARGS[@]}" -z ${tfile} -o "${file}" ${HTTPSURL} 2>/dev/null; then
curl "${CURLARGS[@]}" -z ${tfile} -o ${file} ${HTTPURL} 2>/dev/null
fi
if [[ -f "${file}" && "${file%.bz2}" != "${file}" ]]; then
if [ -f "${tfile}" ]; then
rm "${tfile}"
fi
bunzip2 "${file}"
fi
done
if diff -qr ../lists-packaged . > /dev/null; then
echo Lists unchanged, continuing.
else
echo Lists updated, repacking. This will take a while...
if ! ${TAR} --use-compress-program="lzma -e9" --owner=root --group=wheel -cf "${LISTSRC}" *; then
echo We need GNU tar please
exit 1
fi
echo Done.
fi
popd
rm -rf lists lists-packaged
popd
fi # CODE_SIGNING_REQUIRED == NO
rm -rf "${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/apt"
rm -f "${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/"*.deb
rsync -a "${SOURCE_ROOT}/apt" "${SOURCE_ROOT}/Undecimus/resources/"* "${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/"
pushd "${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/apt"
dpkg-scanpackages . > Packages
cd ..
# Make sure these files exist and there is only one of them
ln -s apt/jailbreak-resources_*.deb resources.deb
popd
RESOURCES_VERSION="$(dpkg --info ${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/resources.deb | grep Version: | awk '{print $2}')"
if [ -z "${RESOURCES_VERSION}" ]; then
echo "dpkg not found or resources.deb missing"
exit 1
else
echo "Bundled resources: ${RESOURCES_VERSION}"
fi
PACKAGE_VERSION="$(git describe --tags --match="v*" | sed -e 's@-\([^-]*\)-\([^-]*\)$@+\1.\2@;s@^v@@;s@%@~@g')"
if [ -z "${PACKAGE_VERSION}" ]; then
echo "Could not generate package version"
exit 1
else
echo "Package Version: ${PACKAGE_VERSION}"
fi
defaults write "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" BundledResources "${RESOURCES_VERSION}"
defaults write "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" CFBundleShortVersionString "${PACKAGE_VERSION}"