From c8b4c408fcf90f1aa91f0de617aa44ee7689c601 Mon Sep 17 00:00:00 2001 From: LukeeGD Date: Mon, 9 Mar 2020 14:24:45 +0800 Subject: [PATCH] Some updates - Do not run kDFU function when device is in DFU mode - SCP/SSH error detection - Clean after downgrade --- restore.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/restore.sh b/restore.sh index 5f3001c..c817947 100755 --- a/restore.sh +++ b/restore.sh @@ -84,7 +84,7 @@ function MainMenu { mkdir tmp if [ $(lsusb | grep -c "1227") == 1 ]; then - echo "Device in DFU mode detected. Are you in kDFU mode? (y/N)" + echo "Device in DFU mode detected. Is your device in kDFU mode? (y/N)" read kDFUManual if [[ $kDFUManual == y ]] || [[ $kDFUManual == Y ]]; then read -p "Enter ProductType (eg. iPad2,1): " ProductType @@ -301,6 +301,10 @@ function kDFU { echo echo "Copying stuff to device..." scp resources/tools/$kloader tmp/pwnediBSS root@$IPAddress:/ + if [ $? == 1 ]; then + echo "Cannot connect to device via SSH! Please check your known_hosts file and try again" + exit + fi echo echo "Entering kDFU mode..." ssh root@$IPAddress "chmod 755 /$kloader && /$kloader /pwnediBSS" & @@ -344,7 +348,9 @@ function Downgrade { cp $IPSW/Firmware/dfu/$iBSS.dfu tmp/ echo - kDFU + if [[ ! $kDFUManual ]]; then + kDFU + fi echo "Preparing for futurerestore (starting local server)..." cd resources @@ -375,6 +381,7 @@ function Downgrade { echo "Stopping local server..." sudo kill $pythonPID echo "Downgrade script done!" + Clean exit }