Skip to content

Commit 9ac8c3c

Browse files
committed
"fix" detect normal mode devices on 2.x or lower
1 parent af57a89 commit 9ac8c3c

1 file changed

Lines changed: 26 additions & 13 deletions

File tree

restore.sh

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ device_get_name() {
908908
"iPod7,1") device_name="iPod touch 6";;
909909
"iPod9,1") device_name="iPod touch 7";;
910910
esac
911-
if [[ -z $device_name ]]; then
911+
if [[ -z $device_name && -n $device_type ]]; then
912912
log "Getting device name"
913913
device_name="$(curl "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/device/$device_type.json" | $jq -r ".name")"
914914
fi
@@ -939,6 +939,7 @@ device_manufacturing() {
939939
fi
940940
elif [[ $device_type == "iPod2,1" && $device_mode == "Recovery" ]]; then
941941
device_newbr=2
942+
print "* Cannot check $device_name bootrom model in Recovery mode. Enter DFU mode to get bootrom model"
942943
return
943944
fi
944945
case $device_newbr in
@@ -1236,6 +1237,17 @@ device_get_info() {
12361237
iPad[67]* ) device_checkm8ipad=1;;
12371238
esac
12381239
device_get_name
1240+
if [[ -z $device_name && $device_mode == "Normal" ]]; then
1241+
device_name=$($ideviceinfo -s -k DeviceName)
1242+
if [[ -n $device_name ]]; then
1243+
warn "Unable to detect device model and iOS version. Is your device on 2.x or lower?"
1244+
warn "Limited support for iOS versions lower than 3.x. Expect features to not work properly."
1245+
print "* To fix this, enter Recovery/DFU mode and/or update your device to iOS 3.x or newer."
1246+
pause
1247+
device_proc=1
1248+
device_det=1
1249+
fi
1250+
fi
12391251
if (( device_proc > 10 )); then
12401252
print "* Device: $device_name (${device_type} - ${device_model}ap) in $device_mode mode"
12411253
print "* iOS Version: $device_vers"
@@ -6648,7 +6660,7 @@ menu_ramdisk() {
66486660
$ssh -p $ssh_port root@127.0.0.1 "cd /mnt2; ln -s /private/lib; cd mobile/Library/Preferences; rm -f com.apple.springboard.plist; ln -s /private/com.apple.springboard.plist; /usr/sbin/chown 501:501 com.apple.springboard.plist"
66496661
log "Installing bootstrap done."
66506662
if [[ $device_proc == 7 ]]; then
6651-
print "* If your device is on iOS 7, proceed to Install Bootstrap next."
6663+
print "* If your device is on iOS 7, proceed to Install Untether next."
66526664
fi
66536665
;;
66546666
"untether7" )
@@ -9209,7 +9221,7 @@ device_activate() {
92099221
esac
92109222
fi
92119223
$ideviceactivation activate
9212-
if [[ $device_type == "iPod"* ]] && (( device_det <= 3 )); then
9224+
if [[ $device_name == "iPod"* ]] && (( device_det <= 3 )); then
92139225
$ideviceactivation itunes
92149226
fi
92159227
print "* If it returns an error, just try again."
@@ -9927,7 +9939,7 @@ main() {
99279939
"exitrecovery" )
99289940
log "Attempting to exit Recovery mode."
99299941
$irecovery -n
9930-
if [[ $device_proc != 1 ]] && (( device_proc < 7 )); then
9942+
if [[ $device_proc != 1 && $device_type != "iPod2,1" ]] && (( device_proc < 7 )); then
99319943
print "* Note: For tethered downgrades, you need to boot your device using the Just Boot option. Exiting recovery mode will not work."
99329944
fi
99339945
if [[ $device_canpowder == 1 ]]; then
@@ -9980,6 +9992,16 @@ for i in "$@"; do
99809992
"--bootargs"* ) device_bootargs="${i#*=}";;
99819993
"--old-menu" ) menu_old=1;;
99829994
"--use-usbmuxd2" ) use_usbmuxd2=1;;
9995+
# main_argmode setters here
9996+
"--dfuhelper" ) main_argmode="device_dfuhelper";;
9997+
"--exit-recovery" ) main_argmode="exitrecovery";;
9998+
"--pwn" ) main_argmode="pwned-ibss";;
9999+
"--sshrd" ) main_argmode="device_enter_ramdisk";;
10000+
"--sshrd-menu" )
10001+
device_argmode="entry"
10002+
main_argmode="device_enter_ramdisk_menu"
10003+
;;
10004+
"--kdfu" ) main_argmode="kdfu";;
998310005
# please dont use these, unless you know what youre doing
998410006
"--run-as-root" ) run_as_root=1;;
998510007
"--no-internet-check" ) no_internet_check=1;;
@@ -9998,8 +10020,6 @@ if [[ $no_color != 1 ]]; then
999810020
fi
999910021

1000010022
case $1 in
10001-
"--dfuhelper" ) main_argmode="device_dfuhelper";;
10002-
"--exit-recovery" ) main_argmode="exitrecovery";;
1000310023
"--just-boot" )
1000410024
print "* Just Boot usage: --just-boot --build-id=<id>"
1000510025
print "* Optional: --device=<type> --bootargs=\"<bootargs>\""
@@ -10014,13 +10034,6 @@ case $1 in
1001410034
log "Just Boot arguments: $justboot_args"
1001510035
main_argmode="device_justboot"
1001610036
;;
10017-
"--pwn" ) main_argmode="pwned-ibss";;
10018-
"--sshrd" ) main_argmode="device_enter_ramdisk";;
10019-
"--sshrd-menu" )
10020-
device_argmode="entry"
10021-
main_argmode="device_enter_ramdisk_menu"
10022-
;;
10023-
"--kdfu" ) main_argmode="kdfu";;
1002410037
esac
1002510038

1002610039
trap "clean" EXIT

0 commit comments

Comments
 (0)