From c053bb5569068dbecd2fe7140a82d5497355b2ff Mon Sep 17 00:00:00 2001 From: LukeZGD Date: Wed, 1 Sep 2021 07:57:25 +0800 Subject: [PATCH] Use zenity file selection for "Other" downgrades (Linux only) --- resources/depends.sh | 11 +++++------ resources/downgrade.sh | 21 +++++++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/resources/depends.sh b/resources/depends.sh index 173d514..8b4045d 100755 --- a/resources/depends.sh +++ b/resources/depends.sh @@ -7,7 +7,7 @@ SetToolPaths() { platform="linux" platformver="$PRETTY_NAME" MPath+="$platform" - + bspatch="$(which bspatch)" futurerestore1="sudo LD_PRELOAD=./resources/lib/libcurl.so.3 LD_LIBRARY_PATH=./resources/lib ./resources/tools/futurerestore1_linux" futurerestore2="sudo LD_LIBRARY_PATH=./resources/lib ./resources/tools/futurerestore2_linux" @@ -107,7 +107,7 @@ InstallDepends() { read -s fi if [[ $ID == "arch" || $ID_LIKE == "arch" || $ID == "artix" ]]; then - sudo pacman -Syu --noconfirm --needed base-devel bsdiff curl libcurl-compat libpng12 libimobiledevice libzip openssh openssl-1.0 python2 unzip usbutils + sudo pacman -Syu --noconfirm --needed base-devel bsdiff curl libcurl-compat libpng12 libimobiledevice libzip openssh openssl-1.0 python2 unzip usbutils zenity ln -sf /usr/lib/libcurl.so.3 ../resources/lib/libcurl.so.3 ln -sf /usr/lib/libzip.so.5 ../resources/lib/libzip.so.4 @@ -115,7 +115,7 @@ InstallDepends() { [[ $VERSION == "11 (bullseye)" || $PRETTY_NAME == "Debian"*"sid" ]]; then [[ ! -z $UBUNTU_CODENAME ]] && sudo add-apt-repository -y universe sudo apt update - sudo apt install -y bsdiff curl git libimobiledevice6 openssh-client python2 unzip usbmuxd usbutils + sudo apt install -y bsdiff curl git libimobiledevice6 openssh-client python2 unzip usbmuxd usbutils zenity SavePkg cp libcrypto.so.1.0.0 libcurl.so.3 libpng12.so.0 libssl.so.1.0.0 ../resources/lib if [[ $VERSION_ID == "20"* ]]; then @@ -125,7 +125,7 @@ InstallDepends() { fi elif [[ $ID == "fedora" ]] && (( $VERSION_ID >= 33 )); then - sudo dnf install -y bsdiff git libimobiledevice libpng12 libzip perl-Digest-SHA python2 + sudo dnf install -y bsdiff git libimobiledevice libpng12 libzip perl-Digest-SHA python2 zenity SavePkg cp libcrypto.so.1.0.0 libssl.so.1.0.0 ../resources/lib ln -sf /usr/lib64/libzip.so.5 ../resources/lib/libzip.so.4 @@ -138,7 +138,7 @@ InstallDepends() { libimobiledevice="libimobiledevice6" ln -sf /lib64/libreadline.so.7 ../resources/lib/libreadline.so.8 fi - sudo zypper -n in bsdiff curl git $libimobiledevice libpng12-0 libopenssl1_0_0 libzip5 python-base + sudo zypper -n in bsdiff curl git $libimobiledevice libpng12-0 libopenssl1_0_0 libzip5 python-base zenity ln -sf /usr/lib64/libzip.so.5 ../resources/lib/libzip.so.4 elif [[ $platform == "macos" ]]; then @@ -157,7 +157,6 @@ InstallDepends() { libimobiledevice=("https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/tools/libimobiledevice_linux.zip" "4344b3ca95d7433d5a49dcacc840d47770ba34c4") fi - if [[ ! -d ../resources/libimobiledevice_$platform && $MPath == "./resources"* ]]; then Log "Downloading libimobiledevice..." SaveFile ${libimobiledevice[0]} libimobiledevice.zip ${libimobiledevice[1]} diff --git a/resources/downgrade.sh b/resources/downgrade.sh index 3aff255..e248d22 100755 --- a/resources/downgrade.sh +++ b/resources/downgrade.sh @@ -70,12 +70,21 @@ Downgrade() { local Verify if [[ $OSVer == "Other" ]]; then - Echo "* Move/copy the IPSW and SHSH to the directory where the script is located" - Echo "* Remember to create a backup of the SHSH" - read -p "$(Input 'Path to IPSW (drag IPSW to terminal window):')" IPSW - IPSW="$(basename $IPSW .ipsw)" - read -p "$(Input 'Path to SHSH (drag SHSH to terminal window):')" SHSH - + if [[ $platform == "linux" ]]; then + IPSW="$(zenity --file-selection --file-filter='IPSW | *.ipsw' --title="Select IPSW file")" + IPSW="${IPSW%?????}" + Log "Selected IPSW file: $IPSW" + SHSH="$(zenity --file-selection --file-filter='SHSH | *.shsh *.shsh2' --title="Select SHSH file")" + Log "Selected SHSH file: $SHSH" + else + Echo "* Move/copy the IPSW and SHSH files to the directory where the script is located" + Echo "* When entering the names of IPSW and SHSH, enter the full name including the file extension" + Echo "* Remember to create a backup of the SHSH" + read -p "$(Input 'Enter name of IPSW file:')" IPSW + IPSW="$(basename $IPSW .ipsw)" + read -p "$(Input 'Enter name of SHSH file:')" SHSH + fi + elif [[ $Mode == "Downgrade" && $DeviceProc != 7 ]]; then read -p "$(Input 'Jailbreak the selected iOS version? (Y/n):')" Jailbreak