Exit codes and other stuff

This commit is contained in:
LukeZGD 2021-05-30 11:03:39 +08:00
parent d3d2487ad4
commit 555c53fbd2
6 changed files with 27 additions and 24 deletions

View File

@ -21,7 +21,7 @@ SaveOTABlobs() {
Error "Saving $OSVer blobs failed. Please run the script again" \ Error "Saving $OSVer blobs failed. Please run the script again" \
"It is also possible that $OSVer for $ProductType is no longer signed" "It is also possible that $OSVer for $ProductType is no longer signed"
elif [[ ! $SHSH ]]; then elif [[ ! $SHSH ]]; then
Log "Saving $OSVer blobs failed, but detected existing saved SHSH blobs. Continuing..." Log "Saving $OSVer blobs failed, but found existing saved SHSH blobs. Continuing..."
cp $SHSHExisting . cp $SHSHExisting .
SHSH=$(ls $SHSHChk) SHSH=$(ls $SHSHChk)
else else

View File

@ -11,7 +11,6 @@ SetToolPaths() {
ipsw="env LD_LIBRARY_PATH=./lib ./tools/ipsw_linux" ipsw="env LD_LIBRARY_PATH=./lib ./tools/ipsw_linux"
partialzip="./resources/tools/partialzip_linux" partialzip="./resources/tools/partialzip_linux"
python="$(which python2)" python="$(which python2)"
tsschecker="./resources/tools/tsschecker_linux"
ipwndfu="sudo $python ipwndfu" ipwndfu="sudo $python ipwndfu"
rmsigchks="sudo $python rmsigchks.py" rmsigchks="sudo $python rmsigchks.py"
SimpleHTTPServer="sudo $python -m SimpleHTTPServer 80" SimpleHTTPServer="sudo $python -m SimpleHTTPServer 80"
@ -27,7 +26,6 @@ SetToolPaths() {
ipwnder32="./resources/tools/ipwnder32_macos" ipwnder32="./resources/tools/ipwnder32_macos"
partialzip="./resources/tools/partialzip_macos" partialzip="./resources/tools/partialzip_macos"
python="/usr/bin/python" python="/usr/bin/python"
tsschecker="./resources/tools/tsschecker_macos"
ipwndfu="$python ipwndfu" ipwndfu="$python ipwndfu"
rmsigchks="$python rmsigchks.py" rmsigchks="$python rmsigchks.py"
SimpleHTTPServer="$python -m SimpleHTTPServer 80" SimpleHTTPServer="$python -m SimpleHTTPServer 80"
@ -43,6 +41,7 @@ SetToolPaths() {
SSH="-F ./resources/ssh_config" SSH="-F ./resources/ssh_config"
SCP="$(which scp) $SSH" SCP="$(which scp) $SSH"
SSH="$(which ssh) $SSH" SSH="$(which ssh) $SSH"
tsschecker="./resources/tools/tsschecker_$platform"
Log "Running on platform: $platform $macver" Log "Running on platform: $platform $macver"
} }
@ -142,5 +141,5 @@ InstallDepends() {
cd .. cd ..
Log "Install script done! Please run the script again to proceed" Log "Install script done! Please run the script again to proceed"
exit exit 0
} }

View File

@ -103,7 +103,7 @@ GetDeviceValues() {
HWModel=$(cat $Firmware/hwmodel) HWModel=$(cat $Firmware/hwmodel)
if [[ ! $BasebandURL || ! $HWModel ]]; then if [[ ! $BasebandURL || ! $HWModel ]]; then
Error "GetDeviceValues: Missing BasebandURL and/or HWModel values. Is the firmware folder missing?" \ Error "Missing BasebandURL and/or HWModel values. Is the firmware folder missing?" \
"Reinstall dependencies and try again. For more details, read the 'Other Notes' section of the README" "Reinstall dependencies and try again. For more details, read the 'Other Notes' section of the README"
fi fi
@ -182,7 +182,7 @@ Recovery() {
if [[ $RecoveryDFU == 'N' || $RecoveryDFU == 'n' ]]; then if [[ $RecoveryDFU == 'N' || $RecoveryDFU == 'n' ]]; then
Log "Exiting recovery mode." Log "Exiting recovery mode."
$irecovery -n $irecovery -n
exit exit 0
fi fi
Echo "* Hold POWER and HOME button for 8 seconds." Echo "* Hold POWER and HOME button for 8 seconds."
@ -258,7 +258,10 @@ kDFU() {
read -p "$(Input 'Enter the IP Address of your device:')" IPAddress read -p "$(Input 'Enter the IP Address of your device:')" IPAddress
Log "Copying stuff to device via SSH..." Log "Copying stuff to device via SSH..."
$SCP resources/tools/$kloader tmp/pwnediBSS root@$IPAddress:/tmp $SCP resources/tools/$kloader tmp/pwnediBSS root@$IPAddress:/tmp
[[ $? == 1 ]] && Error "Cannot connect to device via SSH." "Please try the steps above to make sure that SSH is successful" if [[ $? == 1 ]]; then
Error "Cannot connect to device via SSH." \
"Please try the steps above to make sure that SSH is successful"
fi
$SSH root@$IPAddress "/tmp/$kloader /tmp/pwnediBSS" & $SSH root@$IPAddress "/tmp/$kloader /tmp/pwnediBSS" &
fi fi

View File

@ -86,11 +86,11 @@ Downgrade() {
$ProductType == "iPad2,7" || $ProductType == "iPod5,1" ]]; then $ProductType == "iPad2,7" || $ProductType == "iPod5,1" ]]; then
Log "Warning - A5 Rev A device detected. Enabling the jailbreak option might not work for you" Log "Warning - A5 Rev A device detected. Enabling the jailbreak option might not work for you"
read -p "$(Input 'Select Y to continue anyway, N to cancel and exit (y/N):')" Jailbreak read -p "$(Input 'Select Y to continue anyway, N to cancel and exit (y/N):')" Jailbreak
[[ $Jailbreak == 'Y' || $Jailbreak == 'y' ]] && Jailbreak=1 || exit [[ $Jailbreak == 'Y' || $Jailbreak == 'y' ]] && Jailbreak=1 || exit 0
fi fi
fi fi
if [[ $Mode == "Downgrade" && $ProductType == iPhone5,1 && $Jailbreak != 1 ]]; then if [[ $Mode == "Downgrade" && $ProductType == "iPhone5,1" && $Jailbreak != 1 ]]; then
Echo "* By default, iOS-OTA-Downgrader now flashes the iOS 8.4.1 baseband to iPhone5,1" Echo "* By default, iOS-OTA-Downgrader now flashes the iOS 8.4.1 baseband to iPhone5,1"
Echo "* Flashing the latest baseband is still available as an option but beware of problems it may cause" Echo "* Flashing the latest baseband is still available as an option but beware of problems it may cause"
Echo "* There are potential network issues that with the latest baseband when used on iOS 8.4.1" Echo "* There are potential network issues that with the latest baseband when used on iOS 8.4.1"

View File

@ -4,7 +4,7 @@ IPSW32() {
local JBFiles local JBFiles
local JBMemory local JBMemory
local JBSHA1 local JBSHA1
local JBS local JBPartSize
if [[ $IPSWRestore == $IPSWCustom ]]; then if [[ $IPSWRestore == $IPSWCustom ]]; then
Log "Found existing Custom IPSW. Skipping IPSW creation." Log "Found existing Custom IPSW. Skipping IPSW creation."
@ -12,13 +12,13 @@ IPSW32() {
fi fi
if [[ $OSVer == 8.4.1 ]]; then if [[ $OSVer == 8.4.1 ]]; then
JBFiles=(fstab.tar etasonJB-untether.tar Cydia8.tar) JBFiles=("fstab.tar" "etasonJB-untether.tar" "Cydia8.tar")
JBSHA1=6459dbcbfe871056e6244d23b33c9b99aaeca970 JBSHA1="6459dbcbfe871056e6244d23b33c9b99aaeca970"
JBS=2305 JBPartSize=2305
else else
JBFiles=(fstab_rw.tar p0sixspwn.tar Cydia6.tar) JBFiles=("fstab_rw.tar" "p0sixspwn.tar" "Cydia6.tar")
JBSHA1=1d5a351016d2546aa9558bc86ce39186054dc281 JBSHA1="1d5a351016d2546aa9558bc86ce39186054dc281"
JBS=1260 JBPartSize=1260
fi fi
if [[ ! -e resources/jailbreak/${JBFiles[2]} ]]; then if [[ ! -e resources/jailbreak/${JBFiles[2]} ]]; then
cd tmp cd tmp
@ -38,7 +38,7 @@ IPSW32() {
Log "Preparing custom IPSW..." Log "Preparing custom IPSW..."
cd resources cd resources
ln -sf firmware/FirmwareBundles FirmwareBundles ln -sf firmware/FirmwareBundles FirmwareBundles
$ipsw ../$IPSW.ipsw ../$IPSWCustom.ipsw $JBMemory -bbupdate -s $JBS ${JBFiles[@]} $ipsw ../$IPSW.ipsw ../$IPSWCustom.ipsw $JBMemory -bbupdate -s $JBPartSize ${JBFiles[@]}
cd .. cd ..
fi fi
if [[ ! -e $IPSWCustom.ipsw ]]; then if [[ ! -e $IPSWCustom.ipsw ]]; then
@ -68,7 +68,9 @@ IPSW64() {
zip ../$IPSWCustom.ipsw -rq0 * zip ../$IPSWCustom.ipsw -rq0 *
cd .. cd ..
mv $IPSW $IPSWCustom mv $IPSW $IPSWCustom
[[ ! -e $IPSWCustom.ipsw ]] && Error "Failed to find custom IPSW. Please run the script again" if [[ ! -e $IPSWCustom.ipsw ]]; then
Error "Failed to find custom IPSW. Please run the script again"
fi
Log "Setting restore IPSW to: $IPSWCustom.ipsw" Log "Setting restore IPSW to: $IPSWCustom.ipsw"
IPSWRestore=$IPSWCustom IPSWRestore=$IPSWCustom
} }

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
trap "Clean; exit" INT TERM EXIT trap "Clean" EXIT INT TERM
. ./resources/blobs.sh . ./resources/blobs.sh
. ./resources/depends.sh . ./resources/depends.sh
@ -28,7 +28,6 @@ Clean() {
ps aux | awk '/python/ {print "sudo kill -9 "$2" 2>/dev/null"}' | bash ps aux | awk '/python/ {print "sudo kill -9 "$2" 2>/dev/null"}' | bash
fi fi
fi fi
echo
} }
Echo() { Echo() {
@ -131,7 +130,7 @@ Main() {
Input "Press Enter/Return to continue (or press Ctrl+C to cancel)"; Input "Press Enter/Return to continue (or press Ctrl+C to cancel)";
read -s; read -s;
kDFU iBSS; break;; kDFU iBSS; break;;
* ) exit;; * ) exit 0;;
esac esac
done done
Log "Downgrading $ProductType in kDFU/pwnDFU mode..." Log "Downgrading $ProductType in kDFU/pwnDFU mode..."
@ -174,7 +173,7 @@ Main() {
"Save OTA blobs" ) Mode="SaveOTABlobs"; break;; "Save OTA blobs" ) Mode="SaveOTABlobs"; break;;
"Just put device in kDFU mode" ) Mode="kDFU"; break;; "Just put device in kDFU mode" ) Mode="kDFU"; break;;
"(Re-)Install Dependencies" ) InstallDepends;; "(Re-)Install Dependencies" ) InstallDepends;;
* ) exit;; * ) exit 0;;
esac esac
done done
fi fi
@ -185,7 +184,7 @@ Main() {
[[ $Mode == "Downgrade" ]] && Downgrade [[ $Mode == "Downgrade" ]] && Downgrade
[[ $Mode == "SaveOTABlobs" ]] && SaveOTABlobs [[ $Mode == "SaveOTABlobs" ]] && SaveOTABlobs
[[ $Mode == "kDFU" ]] && kDFU [[ $Mode == "kDFU" ]] && kDFU
exit exit 0
} }
SelectVersion() { SelectVersion() {
@ -217,7 +216,7 @@ SelectVersion() {
"iOS 8.4.1" ) OSVer="8.4.1"; BuildVer="12H321"; break;; "iOS 8.4.1" ) OSVer="8.4.1"; BuildVer="12H321"; break;;
"iOS 6.1.3" ) OSVer="6.1.3"; BuildVer="10B329"; break;; "iOS 6.1.3" ) OSVer="6.1.3"; BuildVer="10B329"; break;;
"Other (use SHSH blobs)" ) OSVer="Other"; break;; "Other (use SHSH blobs)" ) OSVer="Other"; break;;
*) exit;; *) exit 0;;
esac esac
done done
} }