2021-05-29 13:26:08 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
SaveOTABlobs() {
|
|
|
|
local SHSHChk
|
|
|
|
local SHSHExisting
|
|
|
|
|
|
|
|
Log "Saving $OSVer blobs with tsschecker..."
|
|
|
|
BuildManifest="resources/manifests/BuildManifest_${ProductType}_${OSVer}.plist"
|
|
|
|
if [[ $DeviceProc == 7 ]]; then
|
2021-06-13 14:07:18 +02:00
|
|
|
local APNonce=$($irecovery -q | grep "NONC" | cut -c 7-)
|
2021-05-29 13:26:08 +02:00
|
|
|
Log "APNonce: $APNonce"
|
|
|
|
$tsschecker -d $ProductType -B ${HWModel}ap -i $OSVer -e $UniqueChipID -m $BuildManifest --apnonce $APNonce -o -s
|
|
|
|
SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}_${APNonce}.shsh*
|
|
|
|
else
|
|
|
|
$tsschecker -d $ProductType -i $OSVer -e $UniqueChipID -m $BuildManifest -o -s
|
|
|
|
SHSHChk=${UniqueChipID}_${ProductType}_${OSVer}-${BuildVer}*.shsh*
|
|
|
|
fi
|
|
|
|
SHSH=$(ls $SHSHChk)
|
|
|
|
SHSHExisting=$(ls saved/shsh/$SHSHChk 2>/dev/null)
|
|
|
|
if [[ ! $SHSH && ! $SHSHExisting ]]; then
|
|
|
|
Error "Saving $OSVer blobs failed. Please run the script again" \
|
|
|
|
"It is also possible that $OSVer for $ProductType is no longer signed"
|
|
|
|
elif [[ ! $SHSH ]]; then
|
2021-05-30 05:03:39 +02:00
|
|
|
Log "Saving $OSVer blobs failed, but found existing saved SHSH blobs. Continuing..."
|
2021-05-29 13:26:08 +02:00
|
|
|
cp $SHSHExisting .
|
|
|
|
SHSH=$(ls $SHSHChk)
|
|
|
|
else
|
|
|
|
mkdir -p saved/shsh 2>/dev/null
|
|
|
|
[[ ! $SHSHExisting ]] && cp "$SHSH" saved/shsh
|
|
|
|
Log "Successfully saved $OSVer blobs."
|
|
|
|
fi
|
|
|
|
}
|