From 3c6a500ad7da3bcb999eaff5777fb90d9bc63b31 Mon Sep 17 00:00:00 2001 From: LukeZGD Date: Mon, 30 May 2022 22:17:56 +0800 Subject: [PATCH] An update (fix some stuff) --- resources/blobs.sh | 4 ++-- resources/device.sh | 7 +++++-- resources/downgrade.sh | 5 +++-- resources/ipsw.sh | 21 ++++++++++----------- restore.cmd | 17 +++++++++++++++++ 5 files changed, 37 insertions(+), 17 deletions(-) diff --git a/resources/blobs.sh b/resources/blobs.sh index 71bb1ce..cebb369 100755 --- a/resources/blobs.sh +++ b/resources/blobs.sh @@ -68,7 +68,7 @@ Save712Blobs() { mv BuildManifest.plist resources/manifests/$BuildManifest fi - if [[ -e saved/shsh/$SHSH7 ]]; then + if [[ -e $SHSH ]]; then Log "Found existing saved 7.1.2 blobs." return fi @@ -77,6 +77,6 @@ Save712Blobs() { SHSHChk=$(ls ${UniqueChipID}_${ProductType}_7.1.2-11D257_*.shsh2) [[ ! $SHSHChk ]] && Error "Saving $OSVer blobs failed. Please run the script again" mkdir saved/shsh 2>/dev/null - mv $SHSHChk saved/shsh/$SHSH7 + mv $SHSHChk $SHSH Log "Successfully saved 7.1.2 blobs." } diff --git a/resources/device.sh b/resources/device.sh index d78021f..c6aa99b 100755 --- a/resources/device.sh +++ b/resources/device.sh @@ -190,6 +190,9 @@ GetDeviceValues() { iBSSBuildVer="12H321" fi [[ ! $IPSWType ]] && IPSWType="$ProductType" + iBEC="iBEC.$iBSS.RELEASE" + iBECb="iBEC.${iBSS}b.RELEASE" + iBSSb="iBSS.${iBSS}b.RELEASE" iBSS="iBSS.$iBSS.RELEASE" SEP="sep-firmware.$HWModel.RELEASE.im4p" @@ -489,7 +492,7 @@ EnterPwnREC() { iBSS=$iBSSb fi - while (( $Attempt < 4 )); do + while (( Attempt < 4 )); do Log "Entering pwnREC mode... (Attempt $Attempt)" Log "Sending iBSS..." $irecovery -f $IPSWCustom/Firmware/dfu/$iBSS.im4p @@ -502,7 +505,7 @@ EnterPwnREC() { ((Attempt++)) done - if (( $Attempt == 4 )); then + if (( Attempt == 4 )); then Error "Failed to enter pwnREC mode. You may have to force restart your device and start over entering pwnDFU mode again" fi } diff --git a/resources/downgrade.sh b/resources/downgrade.sh index 571375e..89f9bc9 100755 --- a/resources/downgrade.sh +++ b/resources/downgrade.sh @@ -33,11 +33,12 @@ FRBaseband() { } FutureRestore() { - local ExtraArgs=("--use-pwndfu") + local ExtraArgs=() Log "Proceeding to futurerestore..." [[ $platform == "linux" ]] && Echo "* Enter your user password when prompted" if [[ $platform != "win" ]]; then + ExtraArgs+=("--use-pwndfu") cd resources $SimpleHTTPServer & ServerPID=$! @@ -122,7 +123,7 @@ DowngradeOTAWin() { fi IPSWFindVerify if [[ $DeviceProc == 7 ]]; then - IPSWSetExtract extract + IPSWSetExtract IPSW64 EnterPwnREC local APNonce=$($irecovery -q | grep "NONC" | cut -c 7-) diff --git a/resources/ipsw.sh b/resources/ipsw.sh index e389590..55b0788 100755 --- a/resources/ipsw.sh +++ b/resources/ipsw.sh @@ -124,20 +124,19 @@ IPSWFindVerify() { } IPSWSetExtract() { - if [[ $1 != "extract" ]]; then - if [[ -e "$IPSWCustom.ipsw" ]]; then - Log "Setting restore IPSW to: $IPSWCustom.ipsw" - IPSWRestore="$IPSWCustom" - elif [[ -z $IPSWRestore ]]; then - Log "Setting restore IPSW to: $IPSW.ipsw" - IPSWRestore="$IPSW" - fi + if [[ -e "$IPSWCustom.ipsw" ]]; then + Log "Setting restore IPSW to: $IPSWCustom.ipsw" + IPSWRestore="$IPSWCustom" + elif [[ -z $IPSWRestore ]]; then + Log "Setting restore IPSW to: $IPSW.ipsw" + IPSWRestore="$IPSW" fi - if [[ $1 != "set" ]]; then - Log "Extracting IPSW: $IPSWRestore.ipsw" - unzip -oq "$IPSWRestore.ipsw" -d "$IPSWRestore"/ + if [[ $1 == "set" ]]; then + return fi + Log "Extracting IPSW: $IPSWRestore.ipsw" + unzip -oq "$IPSWRestore.ipsw" -d "$IPSWRestore"/ } IPSW32() { diff --git a/restore.cmd b/restore.cmd index 507ce57..c880b44 100755 --- a/restore.cmd +++ b/restore.cmd @@ -1,4 +1,21 @@ @echo off + +if not exist "C:\Program Files\iTunes\iTunes.exe" ( + echo [Error] iTunes does not seem to be installed. + echo * Please install iTunes 12.6.5 first before proceeding. + echo * Read the "How to Use" wiki page in GitHub for more details. + pause >nul + exit +) + +if not exist "C:\msys64\msys2.exe" ( + echo [Error] MSYS2 does not seem to be installed. + echo * Please install MSYS2 first before proceeding. + echo * Read the "How to Use" wiki page in GitHub for more details. + pause >nul + exit +) + C:\msys64\msys2.exe "./restore.sh" rem Add the argument at the end of the line above if needed