mirror of
https://github.com/LukeZGD/Legacy-iOS-Kit.git
synced 2024-12-23 23:01:49 +01:00
IPSWFind, IPSWVerify, and other fixes
- IPSWFind and IPSWVerify to be used for the downgrade function and custom IPSW menu option - depends: ipwndfu="$(which python2) ipwndfu" for macOS 12.3 and newer - fix futurerestore error detect ($?) - a bit of cleanup
This commit is contained in:
parent
0aba782eab
commit
db7af88f5b
@ -63,8 +63,10 @@ SetToolPaths() {
|
||||
irecovery="sudo LD_LIBRARY_PATH=./resources/lib $irecovery"
|
||||
rmsigchks="sudo $rmsigchks"
|
||||
elif [[ $platform == "macos" ]]; then
|
||||
# for macOS 12.3 and newer
|
||||
if (( ${platformver:0:2} > 11 )) && [[ -z $python ]]; then
|
||||
python="/usr/bin/python3"
|
||||
ipwndfu="$(which python2) ipwndfu"
|
||||
rmsigchks="$(which python2) rmsigchks.py"
|
||||
SimpleHTTPServer="$python -m http.server 8888"
|
||||
fi
|
||||
|
@ -35,10 +35,7 @@ FRBaseband() {
|
||||
Downgrade() {
|
||||
local ExtraArgs=("--use-pwndfu")
|
||||
local IPSWExtract
|
||||
local IPSWSHA1
|
||||
local IPSWSHA1L
|
||||
local Jailbreak
|
||||
local Verify=1
|
||||
Verify=1
|
||||
|
||||
Log "Select your options when asked. If unsure, go for the defaults (press Enter/Return)."
|
||||
echo
|
||||
@ -73,7 +70,7 @@ Downgrade() {
|
||||
|
||||
if [[ $Jailbreak != 'N' && $Jailbreak != 'n' ]]; then
|
||||
JailbreakSet
|
||||
Log "Jailbreak option enabled. Using $JBName for the jailbreak"
|
||||
Log "Jailbreak option enabled."
|
||||
else
|
||||
Log "Jailbreak option disabled by user."
|
||||
fi
|
||||
@ -81,38 +78,14 @@ Downgrade() {
|
||||
fi
|
||||
|
||||
if [[ $OSVer != "Other" ]]; then
|
||||
IPSW="${IPSWType}_${OSVer}_${BuildVer}_Restore"
|
||||
[[ -z $IPSWCustom ]] && IPSWCustom="${IPSWType}_${OSVer}_${BuildVer}_Custom"
|
||||
|
||||
if [[ $Jailbreak == 1 ]]; then
|
||||
[[ -e "$IPSWCustom.ipsw" ]] && Verify=
|
||||
fi
|
||||
|
||||
MemoryOption
|
||||
|
||||
SaveOTABlobs
|
||||
|
||||
if [[ ! -e "$IPSW.ipsw" && $Verify == 1 ]]; then
|
||||
Log "iOS $OSVer IPSW for $ProductType cannot be found."
|
||||
Echo "* If you already downloaded the IPSW, move/copy it to the directory where the script is located."
|
||||
Echo "* Do NOT rename the IPSW as the script will fail to detect it."
|
||||
Echo "* The script will now proceed to download it for you. If you want to download it yourself, here is the link: $(cat $Firmware/$BuildVer/url)"
|
||||
Log "Downloading IPSW... (Press Ctrl+C to cancel)"
|
||||
curl -L $(cat $Firmware/$BuildVer/url) -o tmp/$IPSW.ipsw
|
||||
mv tmp/$IPSW.ipsw .
|
||||
fi
|
||||
IPSWFind
|
||||
|
||||
if [[ $Verify == 1 ]]; then
|
||||
Log "Verifying IPSW..."
|
||||
IPSWSHA1=$(cat $Firmware/$BuildVer/sha1sum)
|
||||
Log "Expected SHA1sum: $IPSWSHA1"
|
||||
IPSWSHA1L=$(shasum $IPSW.ipsw | awk '{print $1}')
|
||||
Log "Actual SHA1sum: $IPSWSHA1L"
|
||||
if [[ $IPSWSHA1L != $IPSWSHA1 ]]; then
|
||||
Error "Verifying IPSW failed. Your IPSW may be corrupted or incomplete. Delete/replace the IPSW and run the script again" \
|
||||
"SHA1sum mismatch. Expected $IPSWSHA1, got $IPSWSHA1L"
|
||||
fi
|
||||
Log "IPSW SHA1sum matches."
|
||||
IPSWVerify
|
||||
elif [[ -e "$IPSWCustom.ipsw" ]]; then
|
||||
Log "Found existing Custom IPSW. Skipping IPSW verification."
|
||||
Log "Setting restore IPSW to: $IPSWCustom.ipsw"
|
||||
@ -172,17 +145,16 @@ Downgrade() {
|
||||
ExtraArgs+=("-b" "saved/baseband/$Baseband" "-p" "$BuildManifest")
|
||||
fi
|
||||
fi
|
||||
|
||||
Log "Running futurerestore with command: $futurerestore -t \"$SHSH\" ${ExtraArgs[*]} \"$IPSWRestore.ipsw\""
|
||||
$futurerestore -t "$SHSH" "${ExtraArgs[@]}" "$IPSWRestore.ipsw"
|
||||
local opt=$?
|
||||
|
||||
echo
|
||||
if [[ $opt != 0 ]]; then
|
||||
if [[ $? != 0 ]]; then
|
||||
Log "An error seems to have occurred in futurerestore."
|
||||
Echo "* Please read the \"Troubleshooting\" wiki page in GitHub before opening any issue!"
|
||||
Echo "* Your problem may have already been addressed within the page."
|
||||
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!"
|
||||
|
@ -3,6 +3,8 @@
|
||||
JailbreakSet() {
|
||||
Jailbreak=1
|
||||
IPSWCustom="${IPSWType}_${OSVer}_${BuildVer}_Custom"
|
||||
[[ -e "$IPSWCustom.ipsw" ]] && Verify=
|
||||
|
||||
if [[ $ProductType == "iPhone4,1" || $ProductType == "iPhone5,2" ]] && [[ $OSVer == "8.4.1" ]]; then
|
||||
Input "Jailbreak Tool Option"
|
||||
Echo "* This option is set to daibutsu by default (1)."
|
||||
@ -29,6 +31,7 @@ JailbreakSet() {
|
||||
elif [[ $OSVer == "6.1.3" ]]; then
|
||||
JBName="p0sixspwn"
|
||||
fi
|
||||
Log "Using $JBName for the jailbreak"
|
||||
}
|
||||
|
||||
MemoryOption() {
|
||||
@ -47,6 +50,32 @@ MemoryOption() {
|
||||
fi
|
||||
}
|
||||
|
||||
IPSWFind() {
|
||||
IPSW="${IPSWType}_${OSVer}_${BuildVer}_Restore"
|
||||
if [[ ! -e "$IPSW.ipsw" && $Verify == 1 ]]; then
|
||||
Log "iOS $OSVer IPSW for $ProductType cannot be found."
|
||||
Echo "* If you already downloaded the IPSW, move/copy it to the directory where the script is located."
|
||||
Echo "* Do NOT rename the IPSW as the script will fail to detect it."
|
||||
Echo "* The script will now proceed to download it for you. If you want to download it yourself, here is the link: $(cat $Firmware/$BuildVer/url)"
|
||||
Log "Downloading IPSW... (Press Ctrl+C to cancel)"
|
||||
curl -L $(cat $Firmware/$BuildVer/url) -o tmp/$IPSW.ipsw
|
||||
mv tmp/$IPSW.ipsw .
|
||||
fi
|
||||
}
|
||||
|
||||
IPSWVerify() {
|
||||
Log "Verifying IPSW..."
|
||||
IPSWSHA1=$(cat $Firmware/$BuildVer/sha1sum)
|
||||
Log "Expected SHA1sum: $IPSWSHA1"
|
||||
IPSWSHA1L=$(shasum $IPSW.ipsw | awk '{print $1}')
|
||||
Log "Actual SHA1sum: $IPSWSHA1L"
|
||||
if [[ $IPSWSHA1L != $IPSWSHA1 ]]; then
|
||||
Error "Verifying IPSW failed. Your IPSW may be corrupted or incomplete. Delete/replace the IPSW and run the script again" \
|
||||
"SHA1sum mismatch. Expected $IPSWSHA1, got $IPSWSHA1L"
|
||||
fi
|
||||
Log "IPSW SHA1sum matches."
|
||||
}
|
||||
|
||||
IPSW32() {
|
||||
local Bundle="Down_${ProductType}_${OSVer}_${BuildVer}.bundle"
|
||||
local ExtraArgs
|
||||
|
13
restore.sh
13
restore.sh
@ -48,7 +48,7 @@ Main() {
|
||||
|
||||
clear
|
||||
Echo "******* iOS-OTA-Downgrader *******"
|
||||
Echo " Downgrader script by LukeZGD "
|
||||
Echo " - Downgrader script by LukeZGD - "
|
||||
echo
|
||||
|
||||
if [[ $EUID == 0 ]]; then
|
||||
@ -131,12 +131,18 @@ Main() {
|
||||
SelectVersion
|
||||
|
||||
if [[ $Mode == "IPSW32" ]]; then
|
||||
IPSW="${IPSWType}_${OSVer}_${BuildVer}_Restore"
|
||||
Verify=1
|
||||
echo
|
||||
JailbreakSet
|
||||
Log "Using $JBName for the jailbreak"
|
||||
MemoryOption
|
||||
IPSWFind
|
||||
if [[ $Verify == 1 ]]; then
|
||||
IPSWVerify
|
||||
elif [[ -e "$IPSWCustom.ipsw" ]]; then
|
||||
Log "Found existing Custom IPSW, stopping here."
|
||||
Echo "* If you want to re-create the custom IPSW, move/delete the existing one first."
|
||||
exit 0
|
||||
fi
|
||||
IPSW32
|
||||
Log "Custom IPSW has been created: $IPSWCustom.ipsw"
|
||||
Echo "* This custom IPSW has a jailbreak built in ($JBName)"
|
||||
@ -169,7 +175,6 @@ Main() {
|
||||
echo "${Color_Y}* For more details, read the \"Troubleshooting\" wiki page in GitHub ${Color_N}"
|
||||
exit 1
|
||||
fi
|
||||
Mode="Downgrade"
|
||||
echo
|
||||
Echo "* DFU Advanced Menu"
|
||||
Echo "* This menu is for ADVANCED USERS ONLY."
|
||||
|
Loading…
Reference in New Issue
Block a user