forked from powenn/AltServer-Linux-ShellScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain
More file actions
executable file
·142 lines (129 loc) · 3.13 KB
/
main
File metadata and controls
executable file
·142 lines (129 loc) · 3.13 KB
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
#!/bin/bash
# Author of the script : powen
HasExistAccount=$(cat saved.txt)
HasExistipa=$(ls ipa)
_udid=$(lsusb -v 2> /dev/null | grep -e "Apple Inc" -A 2 | grep iSerial | awk '{print $3}')
_udid_length=${#_udid}
if [ $_udid_length == "24" ]; then
UDID=${_udid:0:8}"-"${_udid:8}
fi
if [ $_udid_length == "40" ]; then
UDID=$_udid
fi
# Check if there exists saved account
# Ask if want to use saved account
AskAccount() {
if [[ "$HasExistAccount" != "" ]]; then
echo "Do you want to use saved Account ? [y/n]"
read reply
case "$reply" in
[yY][eE][sS]|[yY] )
echo "Which account you want to use ? "
UseExistAccount=1
nl saved.txt
echo "please enter the number "
read number
AppleID=$(sed -n "$number"p saved.txt | cut -d , -f 1)
password=$(sed -n "$number"p saved.txt | cut -d , -f 2)
;;
[nN][oO]|[nN] )
UseExistAccount=0
;;
esac
fi
if [[ "$HasExistAccount" == "" ]]; then
UseExistAccount=0
fi
if [[ $UseExistAccount = 0 ]]; then
echo "Please provide your AppleID"
read AppleID
echo "Please provide the password of AppleID"
read password
fi
}
# Execute AltServer
# Check if this account existed before
AltServer() {
./AltServer -u ${UDID} -a $AppleID -p $password $IPA_PATH
if [[ "$CheckAccount" == "" ]] ; then
AccountSaving=1
fi
}
# Check if there exists ipa files in ipa folder
# Ask which ipa want to install
ipaCheck() {
if [[ "$HasExistipa" != "" ]]; then
echo "Please provide the number of ipa "
echo "$HasExistipa" > ipaList.txt
nl ipaList.txt
read ipanumber
Existipa=$(sed -n "$ipanumber"p ipaList.txt )
else
echo "There is no ipa filess in ipa folder "
NoIpaFile=1
fi
}
# Ask to save the new account
SaveAcccount() {
echo "Do you want to save this Account ? [y/n]"
read ans
case "$ans" in
[yY][eE][sS]|[yY] )
echo "$Account" >> saved.txt
echo "saved"
;;
[nN][oO]|[nN] )
;;
esac
}
# Start Script Main
RunScriptMain=0
while [ $RunScriptMain = 0 ] ; do
cat << EOF
----------------------
InstallUsage: [OPTION]
OPTIONS
1, --Install AltStore
Install AltStore to your device
2, --Install ipa files
Install ipa files to your device
b, --Back
Back to previous script
EOF
echo "Enter OPTION to continue"
read option
case "$option" in
1|--Install-AltStore )
mainScript=1
RunScriptMain=1
;;
2|--Install-ipa-files )
mainScript=2
RunScriptMain=1
;;
b|--Back )
RunScriptMain=1
;;
esac
done
if [[ $mainScript = 1 ]] ; then
AskAccount
Account=$AppleID,$password
CheckAccount=$(grep $Account saved.txt)
IPA_PATH=./AltStore.ipa
AltServer
fi
if [[ $mainScript = 2 ]] ; then
ipaCheck
if [[ $NoIpaFile != 1 ]] ; then
AskAccount
Account=$AppleID,$password
CheckAccount=$(grep $Account saved.txt)
IPA_PATH=./ipa/$Existipa
AltServer
fi
fi
if [[ $AccountSaving = 1 ]] ; then
SaveAcccount
fi
echo "<< Back to AltServer script >>"