Better checks for baseband/manifest

This commit is contained in:
LukeZGD 2022-11-27 11:27:18 +08:00
parent 760af27d94
commit 874db8cea4

View File

@ -22,12 +22,11 @@ FRBaseband() {
BasebandSHA1L=$($sha1sum saved/baseband/$Baseband | awk '{print $1}') BasebandSHA1L=$($sha1sum saved/baseband/$Baseband | awk '{print $1}')
if [[ ! -e $(ls saved/baseband/$Baseband) || $BasebandSHA1L != $BasebandSHA1 ]]; then if [[ ! -e $(ls saved/baseband/$Baseband) || $BasebandSHA1L != $BasebandSHA1 ]]; then
rm -f saved/baseband/$Baseband saved/$ProductType/BuildManifest.plist rm -f saved/baseband/$Baseband $BuildManifest
if [[ $DeviceProc == 7 || $platform == "win" ]]; then if [[ $DeviceProc == 7 || $platform == "win" ]]; then
Error "Downloading/verifying baseband failed. Please run the script again" Error "Downloading/verifying baseband failed. Please run the script again"
else else
Log "Downloading/verifying baseband failed, will proceed with --latest-baseband flag" Log "Downloading/verifying baseband failed. Proceeding with --latest-baseband flag"
return 1
fi fi
fi fi
} }
@ -60,10 +59,11 @@ FutureRestore() {
ExtraArgs+=("--no-baseband") ExtraArgs+=("--no-baseband")
else else
FRBaseband FRBaseband
if [[ $? == 1 ]]; then if [[ -e saved/baseband/$Baseband && -e $BuildManifest ]]; then
ExtraArgs+=("--latest-baseband")
else
ExtraArgs+=("-b" "saved/baseband/$Baseband" "-p" "$BuildManifest") ExtraArgs+=("-b" "saved/baseband/$Baseband" "-p" "$BuildManifest")
else
rm -f saved/baseband/$Baseband $BuildManifest
ExtraArgs+=("--latest-baseband")
fi fi
fi fi
@ -154,6 +154,17 @@ iDeviceRestore() {
rm -f saved/baseband/$Baseband saved/$ProductType/BuildManifest.plist rm -f saved/baseband/$Baseband saved/$ProductType/BuildManifest.plist
Error "Downloading/verifying baseband failed. Please run the script again" Error "Downloading/verifying baseband failed. Please run the script again"
fi fi
if [[ ! -e tmp/bbfw.tmp || ! -e tmp/BuildManifest.plist ]]; then
Log "Downloading/verifying baseband failed."
Echo "* You may still attempt to continue, but $OSVer baseband will be flashed instead of latest."
Echo "* This may cause ACTIVATION ERRORS after the restore, it is recommended to not continue."
Echo "* I highly suggest to do the restore in Linux/macOS instead to avoid issues."
Input "Press Enter/Return to continue (or press Ctrl+C to cancel)"
read -s
ExtraArgs="-e -w"
idevicerestore="./resources/tools/idevicerestore_$platform"
re=
fi
fi fi
Log "Running idevicere${re}store with command: $idevicerestore $ExtraArgs \"$IPSWRestore.ipsw\"" Log "Running idevicere${re}store with command: $idevicerestore $ExtraArgs \"$IPSWRestore.ipsw\""
$idevicerestore $ExtraArgs "$IPSWRestore.ipsw" $idevicerestore $ExtraArgs "$IPSWRestore.ipsw"