diff --git a/README.md b/README.md index 65c21b1..8a7eb61 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ - **iPhone4Down: Downgrade iPhone 4 GSM on Linux/Windows (using powdersn0w)** - **Linux, macOS, and Windows** are supported - Windows usage is not recommended - - iPhone4Down focuses on Linux support only - use [cherryflowerJB](https://web.archive.org/web/20210322151509/https://dora2ios.web.app/CFJB/) or [powdersn0w](https://web.archive.org/web/20221213010446/https://dora2ios.web.app/konayuki/index.html) on macOS instead - **Read the ["How to Use" wiki page](https://github.com/LukeZGD/iOS-OTA-Downgrader/wiki/How-to-Use) for a step-by-step tutorial** - **Read the ["Troubleshooting" wiki page](https://github.com/LukeZGD/iOS-OTA-Downgrader/wiki/Troubleshooting) for tips, frequent questions, and troubleshooting** @@ -73,7 +72,7 @@ ## Supported OS versions/distros -#### Supported architectures: x86_64, armhf (Linux), arm64 +#### Supported architectures: x86_64, arm64, armhf (Linux) - [**Ubuntu**](https://ubuntu.com/) 22.04 and newer, and Ubuntu-based distros like [Linux Mint](https://www.linuxmint.com/) - [**Arch Linux**](https://www.archlinux.org/) and Arch-based distros like [EndeavourOS](https://endeavouros.com/) diff --git a/restore.cmd b/restore.cmd index 2e0a71d..4d320af 100644 --- a/restore.cmd +++ b/restore.cmd @@ -22,5 +22,5 @@ C:\msys64\msys2.exe "./restore.sh" rem Add the argument at the end of the line above if needed rem Examples: -rem C:\msys64\msys2.exe "./restore.sh" NoDevice -rem C:\msys64\msys2.exe "./restore.sh" PwnedDevice +rem C:\msys64\msys2.exe "./restore.sh" --no-device +rem C:\msys64\msys2.exe "./restore.sh" --entry-device --no-color diff --git a/restore.sh b/restore.sh index 3fde85b..3cb1952 100755 --- a/restore.sh +++ b/restore.sh @@ -418,7 +418,8 @@ device_get_info() { fi device_type=$(echo "$device_type" | cut -c -$ProdCut) device_ecid=$((16#$($irecovery -q | grep "ECID" | cut -c 9-))) # converts hex ecid to dec - device_vers="Unknown" + device_vers=$(echo "/exit" | $irecovery -s | grep "iBoot-") + [[ -z $device_vers ]] && device_vers="Unknown" ;; "Normal" ) @@ -447,6 +448,10 @@ device_get_info() { device_fw_dir="../resources/firmware/$device_type" device_model="$(cat $device_fw_dir/hwmodel)" if [[ -z $device_model ]]; then + print "* Device: $device_type in $device_mode mode" + print "* iOS Version: $device_vers" + print "* ECID: $device_ecid" + echo error "Device model not found. Device type ($device_type) is possibly invalid or not supported." fi @@ -717,7 +722,7 @@ device_enter_mode() { sendfiles+=("kloaders" "pwnediBSS") log "Entering kDFU mode..." - print "* This may take a while." + print "* This may take a while, but should not take longer than a minute." $scp -P 2222 ${sendfiles[@]} root@127.0.0.1:/tmp if [[ $? == 0 ]]; then $ssh -p 2222 root@127.0.0.1 "bash /tmp/kloaders" & @@ -1678,7 +1683,7 @@ ipsw_prepare_32bit() { "$dir/hfsplus" Ramdisk.raw extract usr/local/share/restore/options.$device_model.plist local RootSize=$($xmlstarlet sel -t -m "plist/dict/key[.='SystemPartitionSize']" -v "following-sibling::integer[1]" options.$device_model.plist) echo -e $'\n\n' > $NewPlist - echo -e "Filename$ipsw_type.ipsw" >> $NewPlist + echo -e "Filename$ipsw_path.ipsw" >> $NewPlist echo -e "RootFilesystem$(echo "$device_fw_key" | $jq -j '.keys[] | select(.image | startswith("RootFS")) | .filename')" >> $NewPlist echo -e "RootFilesystemKey$(echo "$device_fw_key" | $jq -j '.keys[] | select(.image | startswith("RootFS")) | .key')'" >> $NewPlist echo -e "RootFilesystemSize$RootSize" >> $NewPlist @@ -1861,11 +1866,20 @@ restore_download_bbsep() { mv $build_id.plist ../saved/$device_type fi cp ../saved/$device_type/$build_id.plist tmp/BuildManifest.plist - log "Restore Manifest: ../saved/$device_type/$build_id.plist" + if [[ $? != 0 ]]; then + rm ../saved/$device_type/$build_id.plist + error "An error occurred copying manifest. Please run the script again" + fi + log "Manifest: ../saved/$device_type/$build_id.plist" restore_manifest="tmp/BuildManifest.plist" # Baseband if [[ $restore_baseband != 0 ]]; then + if [[ -e ../saved/baseband/$restore_baseband ]]; then + if [[ $baseband_sha1 != "$($sha1sum $restore_baseband | awk '{print $1}')" ]]; then + rm ../saved/baseband/$restore_baseband + fi + fi if [[ ! -e ../saved/baseband/$restore_baseband ]]; then log "Downloading $build_id Baseband" "$dir/partialzip" "$(cat $device_fw_dir/$build_id/url)" Firmware/$restore_baseband $restore_baseband @@ -1875,7 +1889,11 @@ restore_download_bbsep() { mv $restore_baseband ../saved/baseband/ fi cp ../saved/baseband/$restore_baseband tmp/bbfw.tmp - log "Restore Baseband: ../saved/baseband/$restore_baseband" + if [[ $? != 0 ]]; then + rm ../saved/baseband/$restore_baseband + error "An error occurred copying baseband. Please run the script again" + fi + log "Baseband: ../saved/baseband/$restore_baseband" restore_baseband="tmp/bbfw.tmp" fi @@ -1887,9 +1905,13 @@ restore_download_bbsep() { "$dir/partialzip" "$(cat $device_fw_dir/$build_id/url)" Firmware/all_flash/$restore_sep.im4p $restore_sep.im4p mv $restore_sep.im4p ../saved/$device_type/$restore_sep-$build_id.im4p fi - log "Restore SEP: ../saved/$device_type/$restore_sep-$build_id.im4p" restore_sep="$restore_sep-$build_id.im4p" cp ../saved/$device_type/$restore_sep . + if [[ $? != 0 ]]; then + rm ../saved/$device_type/$restore_sep + error "An error occurred copying SEP. Please run the script again" + fi + log "SEP: ../saved/$device_type/$restore_sep" fi } @@ -1943,6 +1965,9 @@ restore_futurerestore() { httpserver_pid=$! else # python3 http.server for the rest + if [[ -z $(which python3) ]]; then + error "Python 3 is not installed, cannot continue. Make sure to have python3 installed." + fi $(which python3) -m http.server $port & httpserver_pid=$! fi @@ -2185,8 +2210,6 @@ device_ramdisk4() { iBSS.n90ap.RELEASE.dfu kernelcache.release.n90 ) - - print "Mode: Ramdisk" print "* This uses files and script from 4tify by Zurac-Apps" print "* Make sure that your device is already in DFU mode" @@ -2245,6 +2268,7 @@ shsh_save_onboard() { pause fi device_target_other=1 + print "* Download and select the IPSW of your current iOS version." ipsw_path_set device_enter_mode kDFU patch_ibec