More updates on blob saving and others

most of these are more of edge cases but it's still nice to get them updated anyway
This commit is contained in:
LukeZGD 2022-07-21 13:14:03 +08:00
parent 9933d6e0f5
commit 5e30eaf1b9
3 changed files with 26 additions and 19 deletions

View File

@ -6,9 +6,9 @@ SaveOTABlobs() {
local SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}*.shsh* local SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}*.shsh*
BuildManifest="resources/manifests/BuildManifest_${ProductType}_${OSVer}.plist" BuildManifest="resources/manifests/BuildManifest_${ProductType}_${OSVer}.plist"
if [[ $(ls saved/shsh/$SHSHChk 2>/dev/null) ]]; then if [[ $(ls saved/shsh/$SHSHChk 2>/dev/null) && -z $APNonce ]]; then
Log "Found existing saved $OSVer blobs."
SHSH=$(ls saved/shsh/$SHSHChk) SHSH=$(ls saved/shsh/$SHSHChk)
Log "Found existing saved $OSVer blobs: $SHSH"
return return
fi fi
@ -19,8 +19,14 @@ SaveOTABlobs() {
SHSH=$(ls $SHSHChk) SHSH=$(ls $SHSHChk)
if [[ -n $SHSH ]]; then if [[ -n $SHSH ]]; then
mkdir -p saved/shsh 2>/dev/null mkdir -p saved/shsh 2>/dev/null
[[ -z $APNonce ]] && cp "$SHSH" saved/shsh if [[ -n $APNonce ]]; then
Log "Successfully saved $OSVer blobs." mv "$SHSH" tmp/
SHSH=$(ls tmp/$SHSHChk)
else
mv "$SHSH" saved/shsh/
SHSH=$(ls saved/shsh/$SHSHChk)
fi
Log "Successfully saved $OSVer blobs: $SHSH"
else else
Error "Saving $OSVer blobs failed. Please run the script again" \ Error "Saving $OSVer blobs failed. Please run the script again" \
"It is also possible that $OSVer for $ProductType is no longer signed" "It is also possible that $OSVer for $ProductType is no longer signed"
@ -33,18 +39,18 @@ Save712Blobs() {
SHSH="saved/shsh/${UniqueChipID}-${ProductType}-7.1.2.shsh" SHSH="saved/shsh/${UniqueChipID}-${ProductType}-7.1.2.shsh"
if [[ -e $SHSH ]]; then if [[ -e $SHSH ]]; then
Log "Found existing saved 7.1.2 blobs." Log "Found existing saved 7.1.2 blobs: $SHSH"
return return
fi fi
if [[ ! -e $BuildManifest && -e $IPSW7.ipsw ]]; then if [[ ! -e $BuildManifest ]]; then
Log "Extracting BuildManifest from 7.1.2 IPSW..." if [[ -e $IPSW7.ipsw ]]; then
unzip -o -j $IPSW7.ipsw BuildManifest.plist -d . Log "Extracting BuildManifest from 7.1.2 IPSW..."
mkdir -p saved/$ProductType 2>/dev/null unzip -o -j $IPSW7.ipsw BuildManifest.plist -d .
mv BuildManifest.plist $BuildManifest else
elif [[ ! -e $BuildManifest ]]; then Log "Downloading BuildManifest for 7.1.2..."
Log "Downloading BuildManifest for 7.1.2..." $partialzip $BasebandURL BuildManifest.plist BuildManifest.plist
$partialzip $BasebandURL BuildManifest.plist BuildManifest.plist fi
mkdir -p saved/$ProductType 2>/dev/null mkdir -p saved/$ProductType 2>/dev/null
mv BuildManifest.plist $BuildManifest mv BuildManifest.plist $BuildManifest
fi fi
@ -53,7 +59,7 @@ Save712Blobs() {
$tsschecker -d $ProductType -i 7.1.2 -e $UniqueChipID -m $BuildManifest -s -b $tsschecker -d $ProductType -i 7.1.2 -e $UniqueChipID -m $BuildManifest -s -b
SHSHChk=$(ls ${UniqueChipID}_${ProductType}_7.1.2-11D257_*.shsh2) SHSHChk=$(ls ${UniqueChipID}_${ProductType}_7.1.2-11D257_*.shsh2)
[[ -z $SHSHChk ]] && Error "Saving $OSVer blobs failed. Please run the script again" [[ -z $SHSHChk ]] && Error "Saving $OSVer blobs failed. Please run the script again"
mkdir saved/shsh 2>/dev/null mkdir -p saved/shsh 2>/dev/null
mv $SHSHChk $SHSH mv $SHSHChk $SHSH
Log "Successfully saved 7.1.2 blobs." Log "Successfully saved 7.1.2 blobs: $SHSH"
} }

View File

@ -139,7 +139,7 @@ iDeviceRestore() {
cp $SHSH shsh/${UniqueChipID}-${ProductType}-${OSVer}.shsh cp $SHSH shsh/${UniqueChipID}-${ProductType}-${OSVer}.shsh
Log "Proceeding to idevicerestore..." Log "Proceeding to idevicerestore..."
[[ $1 == "latest" ]] && ExtraArgs="-e" || ExtraArgs="-e -w" [[ $1 == "latest" ]] && ExtraArgs="-e" || ExtraArgs="-e -w"
[[ $platform == "win" ]] && ExtraArgs="-ewy" [[ $platform == "win" ]] && ExtraArgs+=" -y"
$idevicerestore $ExtraArgs "$IPSWRestore.ipsw" $idevicerestore $ExtraArgs "$IPSWRestore.ipsw"
echo echo
Log "Restoring done! Read the message below if any error has occurred:" Log "Restoring done! Read the message below if any error has occurred:"
@ -243,7 +243,9 @@ Downgrade() {
} }
Downgrade4() { Downgrade4() {
JailbreakOption if [[ $OSVer == "7.1.2" ]]; then
[[ $platform != "win" ]] && JailbreakOption
fi
IPSWFindVerify IPSWFindVerify
Save712Blobs Save712Blobs
if [[ $OSVer == "7.1.2" && $Jailbreak != 1 ]]; then if [[ $OSVer == "7.1.2" && $Jailbreak != 1 ]]; then

View File

@ -19,8 +19,7 @@ if [[ $1 != "NoColor" && $2 != "NoColor" ]]; then
fi fi
Clean() { Clean() {
rm -rf iP*/ shsh/ tmp/ *.im4p *.bbfw ${UniqueChipID}_${ProductType}_*.shsh2 \ rm -rf iP*/ shsh/ tmp/ *.im4p *.bbfw BuildManifest.plist version.xml
${UniqueChipID}_${ProductType}_${HWModel}ap_*.shsh BuildManifest.plist version.xml
kill $iproxyPID $ServerPID 2>/dev/null kill $iproxyPID $ServerPID 2>/dev/null
} }