|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | | -printf "\nPlug in your idevice and enter your passcode.\n" |
4 | | -printf "=============================================\n" |
5 | | -while ! idevicepair pair; do |
6 | | - sleep 1s |
7 | | -done |
| 3 | +# Get udid |
| 4 | +if ! idevice_id; then |
| 5 | + echo "Plug the device in, then run the command!" |
| 6 | + exit |
| 7 | +fi |
| 8 | + |
| 9 | +udid=$(idevice_id | awk '{print $1}') |
| 10 | + |
| 11 | +# Check if we need to pair |
| 12 | +printf "\nVerify if current mobiledevicepairing file is valid.\n" |
| 13 | +printf "====================================================\n" |
| 14 | +if ! idevicepair validate -u "${udid}"; then |
| 15 | + printf "\nEnter your passcode.\n" |
| 16 | + printf "====================\n" |
| 17 | + while ! idevicepair pair; do |
| 18 | + sleep 1s |
| 19 | + done |
| 20 | +fi |
| 21 | + |
| 22 | +# Ensure UDID key is present in mobiledevicepairing before we copy to host through mount |
| 23 | +printf "\nCopying mobiledevicepairing file for SideStore to current directory on host machine.\n" |
| 24 | +printf "====================================================================================\n" |
| 25 | +if ! grep -q "<key>UDID</key>" "/tmp/lockdown/${udid}.plist"; then |
| 26 | + sed -i "/<\/dict>/ i\\ |
| 27 | + <key>UDID</key>\\ |
| 28 | + <string>$udid</string>" "/tmp/lockdown/${udid}.plist" |
| 29 | +fi |
| 30 | +cp --verbose /tmp/lockdown/${udid}.plist /mnt/${udid}.mobiledevicepairing |
8 | 31 |
|
9 | 32 | # Get SideStore ipa |
10 | | -printf "\nDownloading SideStore.ipa stable.\n" |
11 | | -printf "=================================\n" |
12 | | -curl --progress-bar -L -o SideStore.ipa $(curl -s https://api.github.com/repos/SideStore/SideStore/releases/latest | grep "browser_download_url.*SideStore.ipa*" | cut -d : -f 2,3 | tr -d \") |
| 33 | +printf "\nDownloading SideStore.ipa.\n" |
| 34 | +printf "==========================\n" |
| 35 | +curl --progress-bar -L -o SideStore.ipa https://github.com/SideStore/SideStore/releases/latest/download/SideStore.ipa |
13 | 36 |
|
14 | 37 | # Get SideStore-Nightly ipa |
15 | | -printf "\nDownloading SideStore.ipa nightly.\n" |
16 | | -printf "=================================\n" |
| 38 | +printf "\nDownloading SideStore-Nightly.ipa.\n" |
| 39 | +printf "==================================\n" |
17 | 40 | curl --progress-bar -L -o SideStore-Nightly.ipa https://github.com/SideStore/SideStore/releases/download/nightly/SideStore.ipa |
18 | 41 |
|
19 | | -# Get udid |
20 | | -udid=$(idevice_id | awk '{print $1}') |
21 | | - |
22 | | -# Generate mobiledevicepairing file |
23 | | -printf "\nGenerating mobiledevicepairing file for SideStore\n" |
24 | | -printf "===============================================================\n" |
25 | | -./jitterbugpair -c > /mnt/${udid}.mobiledevicepairing && echo "Check your home folder on your host/after your exit, and copy the ${udid}.mobiledevicepairing file to your iDevice." |
26 | | - |
| 42 | +# Explain how to install IPA and how to exit container |
27 | 43 | echo -e "\nTo install an IPA, run the following command and change \033[0;31mmyemail\033[0m and \033[0;31mmyapplepass\033[0m. The \033[0;32mUDID\033[0m is already correct:" |
28 | 44 | printf "=============================================================================================================\n" |
29 | 45 | echo -e "./AltServer -u \033[0;32m${udid}\033[0m -a \033[0;[email protected]\033[0m -p \033[0;31mmyapplepass\033[0m SideStore.ipa\n" |
30 | 46 | echo -e "\nDo note that if your password contains special characters like '@','$' '!'or a space." |
31 | 47 | echo "It may not work and you need to put backslashes before it" |
32 | 48 | echo "For example, if your password is 'azerty79!?', you need to write 'azerty79\!\?'" |
33 | | -printf "=============================================================================================\n" |
| 49 | +printf "=====================================================================================\n" |
34 | 50 | echo -e "\nOnce you're finished, type: \033[0;35mexit\033[0m." |
35 | 51 | printf "=================================\n\n" |
36 | 52 |
|
| 53 | +# Throw user into a shell |
37 | 54 | /bin/bash |
0 commit comments