-
Notifications
You must be signed in to change notification settings - Fork 116
/
patch-linux.sh
executable file
·101 lines (80 loc) · 2.61 KB
/
patch-linux.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
#!/bin/sh
# Made by Paisseon and Sudo
# Fancy colors, courtesy of ja1dan
reset="\033[0m"
faint="\033[38;5;249m"
red="\033[38;5;196m"
black="\033[38;5;244m"
green="\033[38;5;46m"
yellow="\033[38;5;226m"
info="${black}${faint}[${reset}${green}*${reset}${black}${faint}]${reset}"
error="${black}${faint}[${reset}${red}!${reset}${black}${faint}]${reset}"
warn="${black}${faint}[${reset}${yellow}!${reset}${black}${faint}]${reset}"
# Read arguments. If you're not me, ignore the -x flag
while getopts ":v:i:o:x" args; do
case "${args}" in
v)
echo "$warn The -v flag no longer does anything"
;;
i)
echo "$info Setting input file as ${OPTARG}"
ipa="${OPTARG}"
;;
o)
echo "$info Setting output file as ${OPTARG}"
output="${OPTARG}"
;;
x)
echo "$info Set to transfer file after patching"
transfer=true
device=0
;;
*)
echo "$error Invalid argument: ${OPTARG}. Satella Jailed patcher accepts only -i, and -o arguments"
exit
;;
esac
done
# Say to install Azule if it doesn't exist already
if [ ! -f "$(which azule)" ]; then
echo "$error Please install Azule from https://github.com/Al4ise/Azule/wiki to continue"
echo "$error If you already have Azule, try typing 'azule -h' and send me the output"
exit
fi
# Check if an .ipa file exists nearby
if [ -z "$ipa" ]; then
files="*"
for file in $files; do
if [ "${file#${file%????}}" = ".ipa" ]; then
name="${file%????}"
if [ "${name#${name%????????}}" != "_Patched" ]; then
echo "$info Setting input file as $file"
ipa="$file"
break
fi
fi
done
fi
# Exit if the $ipa variable is not set
if [ -z "$ipa" ]; then
echo "$error Couldn't find .ipa file"
exit
fi
# Ensure that the $output variable is set and there are no spaces
if [ -z "$output" ]; then
output="$(echo "$ipa" | sed 's/\ /_/g' | sed 's/.ipa/_Patched/')"
echo "$info Setting output file as $output.ipa"
fi
# Inject SatellaJailed to the app using Azule
azule -n "$output" -i "$ipa" -o ./ -f "$PWD/SatellaJailed.dylib" -muvwz | sed -u -r "s/(\[\*\])/$(echo $info)/g"
# Transfer to device if the -x flag is enabled
if [ "$transfer" ]; then
if [ -f /usr/local/bin/xenon ]; then
echo "$info Transferring to device"
xenon "$output.ipa" "$device"
else
echo "$warn Transfer not initiated as xenon isn't installed"
fi
fi
# Finish up
echo "$info Done!"