From fc105905f72931ac0b27c64e63bd1c374089381b Mon Sep 17 00:00:00 2001 From: LukeZGD Date: Sun, 5 Jun 2022 09:14:07 +0800 Subject: [PATCH] Update message messages after idevicerestore, and message to exit on windows --- resources/depends.sh | 2 -- resources/device.sh | 5 ++--- resources/downgrade.sh | 11 ++++++----- restore.sh | 23 +++++++++++------------ 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/resources/depends.sh b/resources/depends.sh index c6e8d8c..9309234 100755 --- a/resources/depends.sh +++ b/resources/depends.sh @@ -213,6 +213,4 @@ InstallDepends() { cd .. Log "Install script done! Please run the script again to proceed" - ExitWin - exit 0 } diff --git a/resources/device.sh b/resources/device.sh index d039517..81fc9a0 100755 --- a/resources/device.sh +++ b/resources/device.sh @@ -80,8 +80,7 @@ GetDeviceValues() { echo "${Color_Y}* Recovery or DFU mode is also applicable. ${Color_N}" echo "${Color_Y}* To perform operations without an iOS device connected, add NoDevice as an argument. ${Color_N}" echo "${Color_Y}* For more details, read the \"Troubleshooting\" wiki page in GitHub ${Color_N}" - ExitWin - exit 1 + ExitWin 1 elif [[ -n $DeviceState ]]; then if [[ ! $ProductType ]]; then read -p "$(Input 'Enter ProductType (eg. iPad2,1):')" ProductType @@ -252,7 +251,7 @@ EnterPwnDFU() { echo "${Color_Y}* This step may fail a lot, especially on Linux, and unfortunately there is nothing I can do about the low success rates. ${Color_N}" echo "${Color_Y}* The only option is to make sure you are using an Intel or Apple Silicon device, and to try multiple times ${Color_N}" Echo "* For more details, read the \"Troubleshooting\" wiki page in GitHub" - exit 1 + ExitWin 1 elif [[ $pwnDFUDevice == 0 ]]; then Log "Device in pwnDFU mode detected." else diff --git a/resources/downgrade.sh b/resources/downgrade.sh index ff53f70..78ec366 100755 --- a/resources/downgrade.sh +++ b/resources/downgrade.sh @@ -94,9 +94,9 @@ DowngradeOther() { Log "Selected SHSH file: $SHSH" if [[ ! -e resources/firmware/$ProductType/$BuildVer/index.html ]]; then + Log "Getting firmware keys for $ProductType-$BuildVer" unzip -o -j "$IPSW.ipsw" Restore.plist -d tmp BuildVer=$(cat tmp/Restore.plist | grep -i ProductBuildVersion -A 1 | grep -oPm1 "(?<=)[^<]+") - Log "Getting firmware keys for $ProductType-$BuildVer" mkdir -p resources/firmware/$ProductType/$BuildVer 2>/dev/null curl -L https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/raw/master/$ProductType/$BuildVer/index.html -o tmp/index.html mv tmp/index.html resources/firmware/$ProductType/$BuildVer @@ -167,14 +167,15 @@ iDeviceRestore() { [[ $1 == "latest" ]] && ExtraArgs="-ey" || ExtraArgs="-ewy" $idevicerestore $ExtraArgs "$IPSWRestore.ipsw" if [[ $platform == "macos" && $? != 0 ]]; then - Log "An error seems to have occurred in idevicerestore." - Echo "* If this is the \"Killed: 9\" error or similar, try these steps:" + Log "Restoring done! Read the message below if any error has occured:" + Echo "* If the \"Killed: 9\" or other similar error pops up, try these steps:" Echo "* Using Terminal, cd to where the script is located, then run" Echo "* sudo codesign --sign - --force --deep resources/tools/idevicerestore_macos" + Echo "* For more details, read the \"Troubleshooting\" wiki page in GitHub" elif [[ $platform == "win" && $? != 0 ]]; then - Log "An error seems to have occurred in idevicerestore." + Log "Restoring done! Read the message below if any error has occured:" Echo "* Windows users may encounter errors like \"Unable to send APTicket\" or \"Unable to send iBEC\" in the restore process." - Echo "* To fix this, follow troubleshooting steps here: https://github.com/LukeZGD/iOS-OTA-Downgrader/wiki/Troubleshooting#windows" + Echo "* To fix this, follow troubleshooting steps from here: https://github.com/LukeZGD/iOS-OTA-Downgrader/wiki/Troubleshooting#windows" else echo Log "Restoring done!" diff --git a/restore.sh b/restore.sh index 897adc7..fc550dc 100755 --- a/restore.sh +++ b/restore.sh @@ -32,8 +32,7 @@ Error() { echo -e "\n${Color_R}[Error] $1 ${Color_N}" [[ -n $2 ]] && echo "${Color_R}* $2 ${Color_N}" echo - ExitWin - exit 1 + ExitWin 1 } Input() { @@ -46,9 +45,11 @@ Log() { ExitWin() { if [[ $platform == "win" ]]; then + echo Input "Press Enter/Return to exit." read -s fi + exit $1 } Main() { @@ -103,6 +104,7 @@ Main() { fi Clean InstallDepends + ExitWin 0 fi if [[ $platform != "win" ]]; then @@ -165,14 +167,14 @@ Main() { if [[ -e "$IPSWCustom.ipsw" ]]; then Log "Found existing Custom IPSW, stopping here." Echo "* If you want to re-create the custom IPSW, move/delete the existing one first." - exit 0 + ExitWin 0 elif [[ $Jailbreak != 1 && $platform != "win" ]]; then if [[ $DeviceProc == 4 && $OSVer == "7.1.2" ]]; then Log "Creating custom IPSW is not needed for non-jailbroken 7.1.2 restores." - exit 0 + ExitWin 0 else Log "Creating custom IPSW is not needed for non-jailbroken restores on your device." - exit 0 + ExitWin 0 fi fi @@ -190,13 +192,11 @@ Main() { if [[ $DeviceProc != 4 && $platform != "win" ]]; then Echo "* You may also use futurerestore manually (make sure to use the latest beta)" fi - ExitWin - exit 0 + ExitWin 0 elif [[ $Mode != "Downgrade"* && $Mode != *"4" ]]; then $Mode - ExitWin - exit 0 + ExitWin 0 fi if [[ $DeviceProc == 4 && $platform == "win" ]]; then @@ -240,7 +240,7 @@ Main() { echo "${Color_Y}* Exit DFU mode by holding the TOP and HOME buttons for 15 seconds. ${Color_N}" echo "${Color_Y}* For usage of the DFU Advanced Menu, add PwnedDevice as an argument. ${Color_N}" echo "${Color_Y}* For more details, read the \"Troubleshooting\" wiki page in GitHub ${Color_N}" - exit 1 + ExitWin 1 fi echo Echo "* DFU Advanced Menu" @@ -281,8 +281,7 @@ Main() { fi Downgrade - ExitWin - exit 0 + ExitWin 0 } SelectVersion() {