general fixes
This commit is contained in:
LukeZGD 2022-07-18 19:53:45 +08:00
parent eaf36a0bbd
commit aa802cfac6
8 changed files with 86 additions and 89 deletions

View File

@ -87,7 +87,7 @@
- [libimobiledevice](https://github.com/libimobiledevice/libimobiledevice), [libirecovery](https://github.com/libimobiledevice/libirecovery) - libimobiledevice ([macOS/Windows builds](https://github.com/libimobiledevice-win32/imobiledevice-net)) - [libimobiledevice](https://github.com/libimobiledevice/libimobiledevice), [libirecovery](https://github.com/libimobiledevice/libirecovery) - libimobiledevice ([macOS/Windows builds](https://github.com/libimobiledevice-win32/imobiledevice-net))
- [tsschecker](https://github.com/tihmstar/tsschecker) - tihmstar ([1Conan fork](https://github.com/1Conan/tsschecker)) - [tsschecker](https://github.com/tihmstar/tsschecker) - tihmstar ([1Conan fork](https://github.com/1Conan/tsschecker))
- [futurerestore](https://github.com/futurerestore/futurerestore) - futurerestore beta (and 194) - [futurerestore](https://github.com/futurerestore/futurerestore) - futurerestore beta (and 194)
- [idevicerestore](https://github.com/LukeeGD/idevicerestore) - LukeZGD fork - [idevicerestore](https://github.com/LukeZGD/idevicerestore) - LukeZGD fork
- [kloader](https://www.youtube.com/watch?v=fh0tB6fp0Sc) - [kloader](https://www.youtube.com/watch?v=fh0tB6fp0Sc)
- [kloader5 for iOS 5](https://www.pmbonneau.com/cydia/com.pmbonneau.kloader5_1.2_iphoneos-arm.deb) - [kloader5 for iOS 5](https://www.pmbonneau.com/cydia/com.pmbonneau.kloader5_1.2_iphoneos-arm.deb)
- [kloader_hgsp for iOS 10](https://twitter.com/nyan_satan/status/945203180522045440) - [kloader_hgsp for iOS 10](https://twitter.com/nyan_satan/status/945203180522045440)

View File

@ -3,58 +3,55 @@
SaveOTABlobs() { SaveOTABlobs() {
local APNonce=$1 local APNonce=$1
local ExtraArgs local ExtraArgs
local SHSHChk local SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}*.shsh*
local SHSHContinue
local SHSHLatest
local SHSHExisting
Log "Saving iOS $OSVer blobs with tsschecker..."
BuildManifest="resources/manifests/BuildManifest_${ProductType}_${OSVer}.plist" BuildManifest="resources/manifests/BuildManifest_${ProductType}_${OSVer}.plist"
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*
$tsschecker $ExtraArgs
SHSH=$(ls $SHSHChk) if [[ $(ls saved/shsh/$SHSHChk 2>/dev/null) ]]; then
SHSHExisting=$(ls saved/shsh/$SHSHChk 2>/dev/null) Log "Found existing saved $OSVer blobs."
if [[ ! -e $SHSH && ! -e $SHSHExisting ]]; then return
Error "Saving $OSVer blobs failed. Please run the script again" \
"It is also possible that $OSVer for $ProductType is no longer signed"
elif [[ ! -e $SHSH ]]; then
Log "Saving $OSVer blobs failed, but found existing saved SHSH blobs."
cp $SHSHExisting .
SHSH=$(ls $SHSHChk)
SHSHContinue=1
fi fi
if [[ -n $SHSH && $SHSHContinue != 1 ]]; then Log "Saving iOS $OSVer blobs with tsschecker..."
ExtraArgs="-d $ProductType -i $OSVer -e $UniqueChipID -m $BuildManifest -o -s -B ${HWModel}ap -b "
[[ -n $APNonce ]] && ExtraArgs+="--apnonce $APNonce" || ExtraArgs+="-g 0x1111111111111111"
$tsschecker $ExtraArgs
SHSH=$(ls $SHSHChk)
if [[ -n $SHSH ]]; then
mkdir -p saved/shsh 2>/dev/null mkdir -p saved/shsh 2>/dev/null
[[ -z $APNonce ]] && cp "$SHSH" saved/shsh [[ -z $APNonce ]] && cp "$SHSH" saved/shsh
Log "Successfully saved $OSVer blobs." Log "Successfully saved $OSVer blobs."
else
Error "Saving $OSVer blobs failed. Please run the script again" \
"It is also possible that $OSVer for $ProductType is no longer signed"
fi fi
} }
Save712Blobs() { Save712Blobs() {
local SHSHChk local SHSHChk
BuildManifest="saved/iPhone3,1/BuildManifest.plist" BuildManifest="saved/$ProductType/BuildManifest.plist"
SHSH="saved/shsh/${UniqueChipID}-${ProductType}-7.1.2.shsh" SHSH="saved/shsh/${UniqueChipID}-${ProductType}-7.1.2.shsh"
if [[ ! -e $BuildManifest ]]; then
Log "Extracting BuildManifest from 7.1.2 IPSW..."
unzip -o -j $IPSW7.ipsw BuildManifest.plist -d .
mkdir -p saved/iPhone3,1 2>/dev/null
mv BuildManifest.plist $BuildManifest
fi
if [[ -e $SHSH ]]; then if [[ -e $SHSH ]]; then
Log "Found existing saved 7.1.2 blobs." Log "Found existing saved 7.1.2 blobs."
return return
fi fi
if [[ ! -e $BuildManifest && -e $IPSW7.ipsw ]]; then
Log "Extracting BuildManifest from 7.1.2 IPSW..."
unzip -o -j $IPSW7.ipsw BuildManifest.plist -d .
mkdir -p saved/$ProductType 2>/dev/null
mv BuildManifest.plist $BuildManifest
elif [[ ! -e $BuildManifest ]]; then
Log "Downloading BuildManifest for 7.1.2..."
$partialzip $BasebandURL BuildManifest.plist BuildManifest.plist
mkdir -p saved/$ProductType 2>/dev/null
mv BuildManifest.plist $BuildManifest
fi
Log "Saving 7.1.2 blobs with tsschecker..." Log "Saving 7.1.2 blobs with tsschecker..."
$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)
[[ ! $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 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."

View File

@ -224,4 +224,5 @@ InstallDepends() {
cd .. cd ..
Log "Install script done! Please run the script again to proceed" Log "Install script done! Please run the script again to proceed"
Log "If your iOS device is plugged in, unplug and replug your device" Log "If your iOS device is plugged in, unplug and replug your device"
ExitWin 0
} }

View File

@ -136,6 +136,59 @@ DowngradeOther() {
FutureRestore FutureRestore
} }
iDeviceRestore() {
mkdir shsh
cp $SHSH shsh/${UniqueChipID}-${ProductType}-${OSVer}.shsh
Log "Proceeding to idevicerestore..."
[[ $1 == "latest" ]] && ExtraArgs="-e" || ExtraArgs="-e -w"
[[ $platform == "win" ]] && ExtraArgs="-ewy"
$idevicerestore $ExtraArgs "$IPSWRestore.ipsw"
if [[ $platform == "win" && $? != 0 ]]; then
Log "Restoring done! Read the message below if any error has occurred:"
Echo "* Windows users may encounter errors like \"Unable to send APTicket\" or \"Unable to send iBEC\" in the restore process."
Echo "* To fix this, follow troubleshooting steps from here: https://github.com/LukeZGD/iOS-OTA-Downgrader/wiki/Troubleshooting#windows"
elif [[ $? != 0 ]]; then
Log "An error seems to have occurred in idevicerestore."
Echo "* Please read the \"Troubleshooting\" wiki page in GitHub before opening any issue!"
Echo "* Your problem may have already been addressed within the wiki page."
Echo "* If opening an issue in GitHub, please provide a FULL log. Otherwise, your issue may be dismissed."
else
echo
Log "Restoring done!"
fi
Log "Downgrade script done!"
}
IPSWCustomA7() {
local fr194=()
if [[ $platform == "macos" ]]; then
fr194=("https://github.com/futurerestore/futurerestore/releases/download/194/futurerestore-v194-macOS.tar.xz" "d279423dd9a12d3a7eceaeb7e01beb332c306aaa")
elif [[ $platform == "linux" ]]; then
fr194=("https://github.com/futurerestore/futurerestore/releases/download/194/futurerestore-v194-ubuntu_20.04.2.tar.xz" "9f2b4b6cc6710d1d68880711001d2dc5b4cb9407")
fi
Input "Custom IPSW Option"
Echo "* When this option is enabled, a custom IPSW will be created/used for restoring."
Echo "* Only enable this when you encounter problems with futurerestore."
Echo "* This option is disabled by default (N)."
read -p "$(Input 'Enable this option? (y/N):')" IPSWA7
if [[ $IPSWA7 != 'Y' && $IPSWA7 != 'y' ]]; then
return
fi
IPSWA7=1
Log "Custom IPSW option enabled by user."
futurerestore="./resources/tools/futurerestore194_$platform"
if [[ ! -e $futurerestore ]]; then
cd tmp
SaveFile ${fr194[0]} futurerestore.tar.xz ${fr194[1]}
7z x futurerestore.tar.xz
tar -xf futurerestore*.tar
chmod +x futurerestore-v194
mv futurerestore-v194 ../$futurerestore
cd ..
fi
}
DowngradeOTA() { DowngradeOTA() {
if [[ $DeviceProc != 7 ]]; then if [[ $DeviceProc != 7 ]]; then
JailbreakOption JailbreakOption
@ -177,35 +230,6 @@ DowngradeOTAWin() {
iDeviceRestore iDeviceRestore
} }
IPSWCustomA7() {
local fr194=()
if [[ $platform == "macos" ]]; then
fr194=("https://github.com/futurerestore/futurerestore/releases/download/194/futurerestore-v194-macOS.tar.xz" "d279423dd9a12d3a7eceaeb7e01beb332c306aaa")
elif [[ $platform == "linux" ]]; then
fr194=("https://github.com/futurerestore/futurerestore/releases/download/194/futurerestore-v194-ubuntu_20.04.2.tar.xz" "9f2b4b6cc6710d1d68880711001d2dc5b4cb9407")
fi
Input "Custom IPSW Option"
Echo "* When this option is enabled, a custom IPSW will be created/used for restoring."
Echo "* Only enable this when you encounter problems with futurerestore."
Echo "* This option is disabled by default (N)."
read -p "$(Input 'Enable this option? (y/N):')" IPSWA7
if [[ $IPSWA7 != 'Y' && $IPSWA7 != 'y' ]]; then
return
fi
IPSWA7=1
Log "Custom IPSW option enabled by user."
futurerestore="./resources/tools/futurerestore194_$platform"
if [[ ! -e $futurerestore ]]; then
cd tmp
SaveFile ${fr194[0]} futurerestore.tar.xz ${fr194[1]}
7z x futurerestore.tar.xz
tar -xf futurerestore*.tar
chmod +x futurerestore-v194
mv futurerestore-v194 ../$futurerestore
cd ..
fi
}
Downgrade() { Downgrade() {
Log "Select your options when asked. If unsure, go for the defaults (press Enter/Return)." Log "Select your options when asked. If unsure, go for the defaults (press Enter/Return)."
echo echo
@ -224,31 +248,6 @@ Downgrade() {
DowngradeOTA DowngradeOTA
} }
iDeviceRestore() {
mkdir shsh
cp $SHSH shsh/${UniqueChipID}-${ProductType}-${OSVer}.shsh
Log "Proceeding to idevicerestore..."
[[ $platform == "macos" ]] && sudo codesign --sign - --force --deep $idevicerestore
[[ $1 == "latest" ]] && ExtraArgs="-e" || ExtraArgs="-e -w"
[[ $platform == "win" ]] && ExtraArgs="-ewy"
$idevicerestore $ExtraArgs "$IPSWRestore.ipsw"
if [[ $platform == "macos" && $? != 0 ]]; then
Log "Restoring done! Read the message below if any error has occurred:"
Echo "* If the \"Killed: 9\" or other similar error pops up, try these steps:"
Echo "* Using Terminal, cd to where the script is located, then run"
Echo "* sudo codesign --sign - --force --deep resources/tools/idevicerestore_macos"
Echo "* For more details, read the \"Troubleshooting\" wiki page in GitHub"
elif [[ $platform == "win" && $? != 0 ]]; then
Log "Restoring done! Read the message below if any error has occurred:"
Echo "* Windows users may encounter errors like \"Unable to send APTicket\" or \"Unable to send iBEC\" in the restore process."
Echo "* To fix this, follow troubleshooting steps from here: https://github.com/LukeZGD/iOS-OTA-Downgrader/wiki/Troubleshooting#windows"
else
echo
Log "Restoring done!"
fi
Log "Downgrade script done!"
}
Downgrade4() { Downgrade4() {
JailbreakOption JailbreakOption
IPSWFindVerify IPSWFindVerify

View File

@ -1 +1 @@
c98ac468d86c4d8aaaf878c6ba97db79659d48cc 4553077c61fd9c487c906ee419d2159f807a00fb

View File

@ -1 +1 @@
04bba84a98b248400c159164a8ea247f12eeb5ea 3d123107c71588fef6f03bd1fc8ca42bda400621

View File

@ -44,6 +44,7 @@ JailbreakSet() {
} }
JailbreakOption() { JailbreakOption() {
echo
Input "Jailbreak Option" Input "Jailbreak Option"
Echo "* When this option is enabled, your device will be jailbroken on restore." Echo "* When this option is enabled, your device will be jailbroken on restore."
if [[ $ProductType == "iPad2,5" || $ProductType == "iPad2,6" || $ProductType == "iPad2,7" ]]; then if [[ $ProductType == "iPad2,5" || $ProductType == "iPad2,6" || $ProductType == "iPad2,7" ]]; then

View File

@ -20,7 +20,7 @@ fi
Clean() { Clean() {
rm -rf iP*/ shsh/ tmp/ *.im4p *.bbfw ${UniqueChipID}_${ProductType}_*.shsh2 \ rm -rf iP*/ shsh/ tmp/ *.im4p *.bbfw ${UniqueChipID}_${ProductType}_*.shsh2 \
${UniqueChipID}_${ProductType}_${HWModel}ap_*.shsh BuildManifest.plist ${UniqueChipID}_${ProductType}_${HWModel}ap_*.shsh BuildManifest.plist version.xml
kill $iproxyPID $ServerPID 2>/dev/null kill $iproxyPID $ServerPID 2>/dev/null
} }
@ -104,7 +104,6 @@ Main() {
fi fi
Clean Clean
InstallDepends InstallDepends
ExitWin 0
fi fi
GetDeviceValues $1 GetDeviceValues $1
@ -163,7 +162,7 @@ Main() {
if [[ $DeviceProc == 4 && $OSVer == "7.1.2" ]]; then if [[ $DeviceProc == 4 && $OSVer == "7.1.2" ]]; then
Log "Creating custom IPSW is not needed for non-jailbroken 7.1.2 restores." Log "Creating custom IPSW is not needed for non-jailbroken 7.1.2 restores."
ExitWin 0 ExitWin 0
elif [[ $ProductType != "iPad2,3" ]]; then elif [[ $ProductType != "iPhone3"* && $ProductType != "iPad2,3" ]]; then
Log "Creating custom IPSW is not needed for non-jailbroken restores on your device." Log "Creating custom IPSW is not needed for non-jailbroken restores on your device."
ExitWin 0 ExitWin 0
fi fi