2021-05-29 13:26:08 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
SaveOTABlobs() {
|
2021-07-12 07:39:48 +02:00
|
|
|
local ExtraArgs
|
2021-05-29 13:26:08 +02:00
|
|
|
local SHSHChk
|
2021-07-12 07:39:48 +02:00
|
|
|
local SHSHContinue
|
2021-11-18 11:33:15 +01:00
|
|
|
local SHSHLatest
|
2021-05-29 13:26:08 +02:00
|
|
|
local SHSHExisting
|
|
|
|
|
2021-11-28 07:04:07 +01:00
|
|
|
if [[ $DeviceProc != 7 && $Baseband != 0 ]]; then
|
2022-05-01 05:59:01 +02:00
|
|
|
if [[ ! -e saved/$ProductType/BuildManifest.plist ]]; then
|
|
|
|
Log "Downloading BuildManifest of iOS $LatestVer..."
|
|
|
|
$partialzip $BasebandURL BuildManifest.plist BuildManifest.plist
|
|
|
|
mkdir -p saved/$ProductType 2>/dev/null
|
|
|
|
mv BuildManifest.plist saved/$ProductType
|
|
|
|
fi
|
|
|
|
if [[ ! -e saved/$ProductType/BuildManifest.plist ]]; then
|
|
|
|
Error "Downloading/verifying BuildManifest failed. Please run the script again"
|
|
|
|
fi
|
2021-11-18 11:33:15 +01:00
|
|
|
Log "Checking signing status of iOS $LatestVer..."
|
|
|
|
SHSHChk=*_${ProductType}_${HWModel}ap_${LatestVer}*.shsh*
|
2022-05-01 05:59:01 +02:00
|
|
|
$tsschecker -d $ProductType -i $LatestVer -e $UniqueChipID -m saved/$ProductType/BuildManifest.plist -s -B ${HWModel}ap
|
2021-11-18 11:33:15 +01:00
|
|
|
SHSHLatest=$(ls $SHSHChk)
|
|
|
|
if [[ ! -e $SHSHLatest ]]; then
|
|
|
|
Error "For some reason, the latest version for your device (iOS $LatestVer) is not signed. Cannot continue."
|
|
|
|
fi
|
|
|
|
Log "Latest version for $ProductType (iOS $LatestVer) is signed."
|
|
|
|
rm $SHSHLatest
|
|
|
|
fi
|
|
|
|
|
|
|
|
Log "Saving iOS $OSVer blobs with tsschecker..."
|
2021-05-29 13:26:08 +02:00
|
|
|
BuildManifest="resources/manifests/BuildManifest_${ProductType}_${OSVer}.plist"
|
2022-05-28 12:21:26 +02:00
|
|
|
ExtraArgs="-d $ProductType -i $OSVer -e $UniqueChipID -m $BuildManifest -o -s -B ${HWModel}ap -g 0x1111111111111111 -b"
|
2021-11-18 11:33:15 +01:00
|
|
|
SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}_3a88b7c3802f2f0510abc432104a15ebd8bd7154.shsh*
|
2021-07-12 07:39:48 +02:00
|
|
|
$tsschecker $ExtraArgs
|
|
|
|
|
2021-05-29 13:26:08 +02:00
|
|
|
SHSH=$(ls $SHSHChk)
|
|
|
|
SHSHExisting=$(ls saved/shsh/$SHSHChk 2>/dev/null)
|
2021-11-18 11:33:15 +01:00
|
|
|
if [[ ! -e $SHSH && ! -e $SHSHExisting ]]; then
|
|
|
|
Error "Saving $OSVer blobs failed. Please run the script again" \
|
|
|
|
"It is also possible that $OSVer for $ProductType is no longer signed"
|
2021-07-12 07:39:48 +02:00
|
|
|
|
2021-11-18 11:33:15 +01:00
|
|
|
elif [[ ! -e $SHSH ]]; then
|
2022-05-28 12:21:26 +02:00
|
|
|
Log "Saving $OSVer blobs failed, but found existing saved SHSH blobs."
|
2021-05-29 13:26:08 +02:00
|
|
|
cp $SHSHExisting .
|
|
|
|
SHSH=$(ls $SHSHChk)
|
2021-07-12 07:39:48 +02:00
|
|
|
SHSHContinue=1
|
|
|
|
fi
|
|
|
|
|
2021-11-17 07:37:02 +01:00
|
|
|
if [[ -n $SHSH && $SHSHContinue != 1 ]]; then
|
2021-05-29 13:26:08 +02:00
|
|
|
mkdir -p saved/shsh 2>/dev/null
|
2021-11-18 11:33:15 +01:00
|
|
|
cp "$SHSH" saved/shsh
|
2021-05-29 13:26:08 +02:00
|
|
|
Log "Successfully saved $OSVer blobs."
|
|
|
|
fi
|
|
|
|
}
|