Skip to content

Commit d17b73f

Browse files
committed
update ipsw and shsh select menus and other prep stuff
1 parent c49ebc2 commit d17b73f

1 file changed

Lines changed: 41 additions & 13 deletions

File tree

restore.sh

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,7 @@ device_entry_s5l8900() {
875875
esac
876876
device_model=
877877
}
878+
878879
device_get_name() {
879880
# all devices that run iOS/iPhoneOS/iPadOS
880881
# adding more entries here is no longer necessary since AppleDB is now used as fallback
@@ -1496,7 +1497,7 @@ device_get_info() {
14961497
warn "Limited support for iOS versions lower than 3.x. Expect features to not work properly."
14971498
print "* For better support, enter Recovery/DFU mode and/or update your device to iOS 3.x or newer."
14981499
pause
1499-
device_vers_maj=1
1500+
[[ -z $device_vers_maj ]] && device_vers_maj=1
15001501
fi
15011502
if [[ $device_type == "AppleTV"* || $device_type == "Watch"* ]]; then
15021503
device_proc=11
@@ -2418,12 +2419,11 @@ device_fw_key_check() {
24182419
# check and download keys for device_target_build, then set the variable device_fw_key (or device_fw_key_base)
24192420
local key
24202421
local build="$device_target_build"
2421-
local device_type="$device_type"
24222422
case $1 in
24232423
base ) build="$device_base_build";;
24242424
temp ) build="$2";;
24252425
esac
2426-
local keys_path="../saved/firmware/$device_type/$build"
2426+
local keys_path="$device_fw_dir/$build"
24272427

24282428
log "Checking firmware keys in $keys_path"
24292429
if [[ $(cat "$keys_path/index.html" 2>/dev/null | grep -c "$build") != 1 ]]; then
@@ -8439,6 +8439,7 @@ menu_restore() {
84398439
case $device_type in
84408440
iPod4,1 ) menu_items+=("7.1.2");;
84418441
iPod3,1 ) menu_items+=("6.0" "6.1.3" "6.1.6");;
8442+
#iPad1,1 ) :;; # for future use
84428443
esac
84438444
if [[ $device_canpowder == 1 && $device_proc != 4 ]]; then
84448445
local text2="7.1.x"
@@ -8506,7 +8507,7 @@ menu_restore() {
85068507
;;
85078508
6.* )
85088509
case $device_type in
8509-
iPod3,1 ) menu_ipsw_special "$selected" "$1";;
8510+
iPod3,1 | iPad1,1 ) menu_ipsw_special "$selected" "$1";;
85108511
* ) menu_ipsw "$selected" "$1";;
85118512
esac
85128513
;;
@@ -8625,7 +8626,6 @@ ipsw_latest_set() {
86258626
* ) ipsw_prefix="${device_type}";;
86268627
esac
86278628
newpath="$ipsw_prefix"
8628-
device_type2="$newpath"
86298629
newpath+="_${device_latest_vers}_${device_latest_build}"
86308630
ipsw_custom_set $newpath
86318631
ipsw_dfuipsw="../${newpath}_DFUIPSW"
@@ -9359,7 +9359,7 @@ menu_ipsw_browse() {
93599359

93609360
ipsw_latest_set
93619361
local menu_items=($(ls ../$device_type*Restore.ipsw 2>/dev/null))
9362-
[[ $device_type2 != "$device_type" ]] && menu_items+=($(ls ../$device_type2*$device_latest_vers*Restore.ipsw 2>/dev/null))
9362+
[[ $ipsw_prefix != "$device_type" ]] && menu_items+=($(ls ../${ipsw_prefix}_1*Restore.ipsw 2>/dev/null))
93639363
if [[ $1 == "base" ]]; then
93649364
text="Base"
93659365
menu_items=()
@@ -9383,8 +9383,7 @@ menu_ipsw_browse() {
93839383
if [[ $1 == "custom" ]]; then
93849384
menu_items=()
93859385
elif [[ $versionc == "$device_latest_vers" ]]; then
9386-
menu_items=($(ls ../$device_type*$device_latest_vers*Restore.ipsw 2>/dev/null))
9387-
[[ $device_type2 != "$device_type" ]] && menu_items+=($(ls ../$device_type2*$device_latest_vers*Restore.ipsw 2>/dev/null))
9386+
menu_items+=($(ls ../${ipsw_prefix}_${device_latest_vers}_${device_latest_build}_Restore.ipsw 2>/dev/null))
93889387
elif [[ -n $versionc ]]; then
93899388
menu_items=($(ls ../${device_type}_${versionc}*Restore.ipsw 2>/dev/null))
93909389
fi
@@ -9639,21 +9638,50 @@ menu_shsh_browse() {
96399638
local newpath
96409639
local text="Target"
96419640
local val="$ipsw_path.ipsw"
9642-
[[ $1 == "base" ]] && text="Base"
9641+
local picker
9642+
9643+
local menu_items=($(ls ../*${device_type}*${device_target_vers}*shsh* ../saved/shsh/*${device_type}*${device_target_vers}*shsh* 2>/dev/null))
9644+
if [[ $1 == "base" ]]; then
9645+
text="Base"
9646+
menu_items=($(ls ../*${device_type}*${device_base_vers}*shsh* ../saved/shsh/*${device_type}*${device_base_vers}*shsh* 2>/dev/null))
9647+
fi
9648+
menu_items+=("Open File Picker" "Enter Path" "Go Back")
9649+
9650+
if [[ "${menu_items[0]}" == *"shsh"* ]]; then
9651+
print "* Select $text SHSH Menu"
9652+
while true; do
9653+
input "Select an option:"
9654+
select_option "${menu_items[@]}"
9655+
selected="${menu_items[$?]}"
9656+
case $selected in
9657+
"Open File Picker" ) picker=1; break;;
9658+
"Enter Path" ) break;;
9659+
*shsh* ) newpath="$selected"; break;;
9660+
"Go Back" ) return;;
9661+
esac
9662+
done
9663+
else
9664+
picker=1
9665+
fi
9666+
9667+
if [[ $picker == 1 ]]; then
9668+
input "Select your $text SHSH file in the file selection window."
9669+
menu_zenity_check
9670+
newpath="$($zenity --file-selection --file-filter='SHSH | *.bshsh2 *.shsh *.shsh2' --title="Select $text SHSH file")"
9671+
fi
96439672

9644-
input "Select your $text SHSH file in the file selection window."
9645-
menu_zenity_check
9646-
newpath="$($zenity --file-selection --file-filter='SHSH | *.bshsh2 *.shsh *.shsh2' --title="Select $text SHSH file")"
9647-
log "Selected SHSH file: $newpath"
96489673
if [[ -n "$newpath" && ! -s "$newpath" ]]; then
96499674
warn "The selected SHSH blob file seems to be empty/invalid. It cannot be used for restoring."
9675+
pause
9676+
return
96509677
fi
96519678
if [[ ! -s "$newpath" ]]; then
96529679
print "* Enter the full path to the SHSH file to be used."
96539680
print "* You may also drag and drop the SHSH file to the Terminal window."
96549681
read -p "$(input "Path to $text SHSH file (or press Enter/Return or Ctrl+C to cancel): ")" newpath
96559682
fi
96569683
[[ ! -s "$newpath" ]] && return
9684+
log "Selected SHSH file: $newpath"
96579685
log "Validating..."
96589686
if (( device_proc >= 7 )); then
96599687
file_extract_from_archive "$val" BuildManifest.plist

0 commit comments

Comments
 (0)