2021-05-29 13:26:08 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
SaveOTABlobs() {
|
2021-10-21 13:42:50 +02:00
|
|
|
local APNonce=$1
|
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-05-29 13:26:08 +02:00
|
|
|
local SHSHExisting
|
|
|
|
|
|
|
|
Log "Saving $OSVer blobs with tsschecker..."
|
|
|
|
BuildManifest="resources/manifests/BuildManifest_${ProductType}_${OSVer}.plist"
|
2021-10-21 13:42:50 +02:00
|
|
|
ExtraArgs="-d $ProductType -i $OSVer -e $UniqueChipID -m $BuildManifest -o -s -B ${HWModel}ap"
|
|
|
|
SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}*.shsh*
|
2021-05-29 13:26:08 +02:00
|
|
|
if [[ $DeviceProc == 7 ]]; then
|
2021-10-21 13:42:50 +02:00
|
|
|
if [[ ! -z $APNonce ]]; then
|
|
|
|
ExtraArgs+=" --apnonce $APNonce"
|
|
|
|
SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}_${APNonce}.shsh*
|
|
|
|
else
|
|
|
|
ExtraArgs+=" --generator 0x1111111111111111"
|
|
|
|
fi
|
2021-05-29 13:26:08 +02:00
|
|
|
fi
|
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)
|
|
|
|
if [[ ! $SHSH && ! $SHSHExisting ]]; then
|
2021-08-26 13:45:53 +02:00
|
|
|
Log "Saving $OSVer blobs failed. Trying again with fallback..."
|
|
|
|
ExtraArgs+=" --no-baseband"
|
|
|
|
$tsschecker $ExtraArgs
|
2021-07-12 07:39:48 +02:00
|
|
|
|
|
|
|
SHSH=$(ls $SHSHChk)
|
|
|
|
if [[ ! $SHSH ]]; then
|
|
|
|
Error "Saving $OSVer blobs failed. Please run the script again" \
|
|
|
|
"It is also possible that $OSVer for $ProductType is no longer signed"
|
|
|
|
fi
|
|
|
|
|
2021-05-29 13:26:08 +02:00
|
|
|
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)
|
2021-07-12 07:39:48 +02:00
|
|
|
SHSHContinue=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -z $SHSH && $SHSHContinue != 1 ]]; then
|
2021-05-29 13:26:08 +02:00
|
|
|
mkdir -p saved/shsh 2>/dev/null
|
2021-10-25 08:57:24 +02:00
|
|
|
[[ -z $APNonce && ! $SHSHExisting ]] && cp "$SHSH" saved/shsh
|
2021-05-29 13:26:08 +02:00
|
|
|
Log "Successfully saved $OSVer blobs."
|
|
|
|
fi
|
|
|
|
}
|