2021-05-29 13:26:08 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
SaveOTABlobs() {
|
2022-05-29 16:57:53 +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-11-18 11:33:15 +01:00
|
|
|
local SHSHLatest
|
2021-05-29 13:26:08 +02:00
|
|
|
local SHSHExisting
|
2021-11-18 11:33:15 +01:00
|
|
|
|
|
|
|
Log "Saving iOS $OSVer blobs with tsschecker..."
|
2021-05-29 13:26:08 +02:00
|
|
|
BuildManifest="resources/manifests/BuildManifest_${ProductType}_${OSVer}.plist"
|
2022-05-29 16:57:53 +02:00
|
|
|
ExtraArgs="-d $ProductType -i $OSVer -e $UniqueChipID -m $BuildManifest -o -s -B ${HWModel}ap -b "
|
|
|
|
[[ -n $APNonce ]] && ExtraArgs+="--apnonce $APNonce" || ExtraArgs+="-g 0x1111111111111111"
|
|
|
|
SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}*.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
|
2022-05-29 16:57:53 +02:00
|
|
|
[[ -z $APNonce ]] && cp "$SHSH" saved/shsh
|
2021-05-29 13:26:08 +02:00
|
|
|
Log "Successfully saved $OSVer blobs."
|
|
|
|
fi
|
|
|
|
}
|
2022-05-28 12:56:10 +02:00
|
|
|
|
|
|
|
Save712Blobs() {
|
|
|
|
local SHSHChk
|
2022-06-08 17:04:56 +02:00
|
|
|
BuildManifest="saved/iPhone3,1/BuildManifest.plist"
|
|
|
|
SHSH="saved/shsh/${UniqueChipID}-${ProductType}-7.1.2.shsh"
|
2022-05-28 12:56:10 +02:00
|
|
|
|
2022-06-08 17:04:56 +02:00
|
|
|
if [[ ! -e $BuildManifest ]]; then
|
2022-05-28 12:56:10 +02:00
|
|
|
Log "Extracting BuildManifest from 7.1.2 IPSW..."
|
|
|
|
unzip -o -j $IPSW7.ipsw BuildManifest.plist -d .
|
2022-06-08 17:04:56 +02:00
|
|
|
mkdir -p saved/iPhone3,1 2>/dev/null
|
|
|
|
mv BuildManifest.plist $BuildManifest
|
2022-05-28 12:56:10 +02:00
|
|
|
fi
|
|
|
|
|
2022-05-30 16:17:56 +02:00
|
|
|
if [[ -e $SHSH ]]; then
|
2022-05-28 12:56:10 +02:00
|
|
|
Log "Found existing saved 7.1.2 blobs."
|
2022-05-29 16:57:53 +02:00
|
|
|
return
|
2022-05-28 12:56:10 +02:00
|
|
|
fi
|
2022-05-29 16:57:53 +02:00
|
|
|
Log "Saving 7.1.2 blobs with tsschecker..."
|
2022-06-08 17:04:56 +02:00
|
|
|
$tsschecker -d $ProductType -i 7.1.2 -e $UniqueChipID -m $BuildManifest -s -b
|
2022-05-29 16:57:53 +02:00
|
|
|
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
|
2022-05-30 16:17:56 +02:00
|
|
|
mv $SHSHChk $SHSH
|
2022-05-29 16:57:53 +02:00
|
|
|
Log "Successfully saved 7.1.2 blobs."
|
2022-05-28 12:56:10 +02:00
|
|
|
}
|