diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3b9e61..bbebe1d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,10 +36,10 @@ jobs: mv ./exclude/lib/* ./resources/lib mv ./exclude/tools/* ./resources/tools mv ./resources/tools/*macos* ./exclude/tools + mv ./resources/libimobiledevice_macos ./exclude - name: Download and extract libimobiledevice_linux run: | - mv ./resources/libimobiledevice_macos ./exclude curl -LO https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/tools/libimobiledevice_linux.zip mkdir ./resources/libimobiledevice_linux unzip libimobiledevice_linux.zip -d ./resources/libimobiledevice_linux @@ -49,16 +49,30 @@ jobs: run: zip -r ${{ github.event.repository.name }}_linux_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip resources/ restore.sh README.md - name: Move linux binaries and other files + run: | + mv ./resources/tools/*linux* ./exclude/tools + mv ./resources/libimobiledevice_linux ./exclude + + - name: Download and extract tools_linux_arm + run: | + curl -LO https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/tools/tools_linux_arm.zip + unzip tools_linux_arm.zip -d ./resources + + - name: Zip linux arm files + run: zip -r ${{ github.event.repository.name }}_linux_arm_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip resources/ restore.sh README.md + + - name: Move linux arm binaries and other files run: | mv ./resources/lib/* ./exclude/lib mv ./resources/tools/*linux* ./exclude/tools + mv ./resources/libimobiledevice_linux/* ./exclude/libimobiledevice_linux + rm -r ./resources/libimobiledevice_linux mv ./resources/firmware/FirmwareBundles ./resources/firmware/JailbreakBundles ./exclude/firmware mkdir ./resources/firmware/FirmwareBundles mv ./exclude/firmware/FirmwareBundles/Down_iPhone3* ./resources/firmware/FirmwareBundles - name: Download and extract libimobiledevice_win run: | - mv ./resources/libimobiledevice_linux ./exclude curl -LO https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/tools/libimobiledevice_win.zip mkdir ./resources/libimobiledevice_win unzip libimobiledevice_win.zip -d ./resources/libimobiledevice_win @@ -66,7 +80,7 @@ jobs: - name: Download and extract tools_win run: | curl -LO https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/tools/tools_win.zip - unzip tools_win.zip -d ./resources + unzip -o tools_win.zip -d ./resources - name: Zip win files run: zip -r ${{ github.event.repository.name }}_win_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip resources/ restore.cmd restore.sh README.md @@ -90,4 +104,5 @@ jobs: ${{ github.event.repository.name }}_complete_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip ${{ github.event.repository.name }}_macos_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip ${{ github.event.repository.name }}_linux_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip + ${{ github.event.repository.name }}_linux_arm_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip ${{ github.event.repository.name }}_win_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip diff --git a/resources/depends.sh b/resources/depends.sh index 61e0831..a18186e 100755 --- a/resources/depends.sh +++ b/resources/depends.sh @@ -93,6 +93,22 @@ SetToolPaths() { ipwndfu="$python2 ipwndfu" rmsigchks="$python2 rmsigchks.py" SimpleHTTPServer="$python -m http.server 8888" + if [[ $(uname -m) == "a"* && $(getconf LONG_BIT) != 64 ]]; then + # these still need sudo even with the udev rule for some reason + idevicerestore="sudo ${idevicerestore}_arm" + idevicererestore="sudo ${idevicererestore}_arm" + irecovery="sudo ${irecovery}_arm" + pwnedDFU="sudo ${pwnedDFU}_arm" + + ideviceenterrecovery="${ideviceenterrecovery}_arm" + ideviceinfo="${ideviceinfo}_arm" + iproxy="${iproxy}_arm" + ipsw="${ipsw}_arm" + partialzip="${partialzip}_arm" + powdersn0w="${powdersn0w}_arm" + tsschecker="${tsschecker}_arm" + xpwntool="${xpwntool}_arm" + fi elif [[ $platform == "macos" ]]; then sha1sum="$(which shasum)" @@ -189,12 +205,12 @@ InstallDepends() { Echo "* Arch Linux repos do not ship python2, which is needed for ipwndfu" Echo "* If you need to use ipwndfu, python2 can be installed from the AUR" sudo pacman -Sy --noconfirm --needed base-devel bsdiff curl libimobiledevice openssh python udev unzip usbmuxd usbutils vim xmlstarlet zenity zip - + elif [[ $ID == "gentoo" || $ID_LIKE == "gentoo" || $ID == "pentoo" ]]; then Echo "* Gentoo repos do not ship python2, which is needed for ipwndfu" Echo "* If you need to use ipwndfu, python2 can be installed from the official site" sudo emerge -av bsdiff net-misc/curl libimobiledevice openssh python udev unzip usbmuxd usbutils vim xmlstarlet zenity zip - + elif [[ -n $UBUNTU_CODENAME && $VERSION_ID == "2"* ]] || (( DebianVer >= 11 )) || [[ $DebianVer == "sid" ]]; then [[ -n $UBUNTU_CODENAME ]] && sudo add-apt-repository -y universe @@ -250,9 +266,14 @@ InstallDepends() { elif [[ $MPath != "./resources"* ]]; then mkdir ../resources/libimobiledevice_$platform fi - touch ../resources/first_run - cd .. + if [[ $platform == "linux" && $(uname -m) == "a"* && ! $(ls ../resources/tools/*linux_arm*) ]]; then + SaveFile https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/tools/tools_linux_arm.zip tools_linux_arm.zip b95b2bc1589ff1fe1e16ab7ac43e9d88d9880296 + Log "Extracting Linux ARM tools..." + unzip -oq tools_linux_arm.zip -d ../resources + fi + + touch ../resources/first_run Log "Install script done! Please run the script again to proceed" Log "If your iOS device is plugged in, unplug and replug your device" ExitWin 0 diff --git a/resources/downgrade.sh b/resources/downgrade.sh index f63a8e1..8cbbaee 100755 --- a/resources/downgrade.sh +++ b/resources/downgrade.sh @@ -142,7 +142,7 @@ iDeviceRestore() { ExtraArgs="-e" elif [[ $Baseband == 0 ]]; then Log "Device $ProductType has no baseband/disabled baseband update" - elif [[ $platform == "win" && $ProductType != "iPhone3"* ]]; then + elif [[ $platform == "win" || $LinuxARM == 1 ]] && [[ $ProductType != "iPhone3"* ]]; then ExtraArgs="-r" idevicerestore="$idevicererestore" re="re" @@ -258,7 +258,7 @@ Downgrade() { IPSWCustomA7 fi - if [[ $platform == "win" || $IPSWA7 == 1 ]]; then + if [[ $platform == "win" || $LinuxARM == 1 || $IPSWA7 == 1 ]]; then DowngradeOTAWin return elif [[ $OSVer == "Other" ]]; then diff --git a/resources/ipsw.sh b/resources/ipsw.sh index 077ac9a..9ae6d6a 100755 --- a/resources/ipsw.sh +++ b/resources/ipsw.sh @@ -22,7 +22,7 @@ JailbreakSet() { [[ $OSVer == "8.4.1" ]] && JBDaibutsu=1 fi - [[ $platform == "win" ]] && IPSWCustom+="JB" + [[ $platform == "win" || $LinuxARM == 1 ]] && IPSWCustom+="JB" if [[ $JBDaibutsu == 1 ]]; then JBName="daibutsu" IPSWCustom+="D" @@ -82,7 +82,7 @@ JailbreakOption() { fi Baseband=0 IPSWCustom+="B" - if [[ $platform != "win" && $Jailbreak != 1 ]]; then + if [[ $platform != "win" && $LinuxARM != 1 && $Jailbreak != 1 ]]; then IPSWCustom+="N" fi fi @@ -235,7 +235,7 @@ IPSW32() { #JailbreakFiles $JBURL/sshdeb.tar sshdeb.tar 0bffece0f8fd939c479159b57e923dd8c06191d3 # uncomment to add openssh to custom ipsw fi [[ $ProductType == "$DisableBBUpdate" ]] && BBUpdate= - [[ $platform == "win" ]] && WinBundles="windows/" + [[ $platform == "win" || $LinuxARM == 1 ]] && WinBundles="windows/" if [[ ! -e $IPSWCustom.ipsw ]]; then Log "Preparing custom IPSW..." diff --git a/restore.sh b/restore.sh index 3752395..a045f65 100755 --- a/restore.sh +++ b/restore.sh @@ -139,6 +139,14 @@ Main() { if [[ $platform == "macos" && $(uname -m) != "x86_64" ]]; then Log "Apple Silicon Mac detected. Support may be limited, proceed at your own risk." + elif [[ $platform == "linux" && $(uname -m) == "a"* ]]; then + Log "Linux ARM detected. Support may be limited, proceed at your own risk." + Echo "* Note that only 32-bit (armhf) is compiled natively for now. For 64-bit, box64 might work." + if [[ $(getconf LONG_BIT) != 64 ]]; then + LinuxARM=1 + Echo "* 32-bit Linux ARM support is also very limited." + fi + elif [[ $(uname -m) != "x86_64" ]]; then Error "Only 64-bit (x86_64) distributions are supported." fi @@ -146,10 +154,6 @@ Main() { if [[ $1 == "Install" || -z $bspatch || ! -e $ideviceinfo || ! -e $irecoverychk || ! -e $ideviceenterrecovery || ! -e $iproxy || -z $python || ! -e ./resources/first_run ]]; then - if [[ ! -e $ideviceinfo || ! -e $irecoverychk || - ! -e $ideviceenterrecovery || ! -e $iproxy ]]; then - rm -rf ./resources/libimobiledevice_$platform - fi Clean InstallDepends fi @@ -173,7 +177,7 @@ Main() { if [[ $DeviceProc != 7 ]]; then Selection+=("Create Custom IPSW") [[ $DeviceState == "Normal" ]] && Selection+=("Put Device in kDFU Mode") - [[ $DeviceProc != 4 && $platform != "win" ]] && Selection+=("Restore to latest iOS") + [[ $DeviceProc != 4 && $platform != "win" && $LinuxARM != 1 ]] && Selection+=("Restore to latest iOS") fi Selection+=("(Re-)Install Dependencies" "(Any other key to exit)") @@ -205,7 +209,7 @@ Main() { Log "Found existing Custom IPSW, stopping here." Echo "* If you want to re-create the custom IPSW, move/delete the existing one first." ExitWin 0 - elif [[ $Jailbreak != 1 && $platform != "win" ]]; then + elif [[ $Jailbreak != 1 && $platform != "win" && $LinuxARM != 1 ]]; then if [[ $DeviceProc == 4 && $OSVer == "7.1.2" ]]; then Log "Creating custom IPSW is not needed for non-jailbroken 7.1.2 restores." ExitWin 0 @@ -225,7 +229,7 @@ Main() { Log "Custom IPSW has been created: $IPSWCustom.ipsw" [[ $Jailbreak == 1 ]] && Echo "* This custom IPSW has a jailbreak built in ($JBName)" Echo "* Run the script again and select Downgrade Device to use the custom IPSW." - if [[ $DeviceProc != 4 && $platform != "win" ]]; then + if [[ $DeviceProc != 4 && $platform != "win" && $LinuxARM != 1 ]]; then Echo "* You may also use futurerestore manually (make sure to use the latest beta)" fi ExitWin 0 @@ -235,7 +239,9 @@ Main() { ExitWin 0 fi - if [[ $DeviceProc == 7 && $platform == "win" ]]; then + if [[ $DeviceProc == 7 && $LinuxARM == 1 ]]; then + Error "Restoring A7 devices is not supported on Linux ARM 32-bit." + elif [[ $DeviceProc == 7 && $platform == "win" ]]; then local Message="If you want to restore your A7 device on Windows, put the device in pwnDFU mode." if [[ $DeviceState == "Normal" ]]; then Error "$Message" @@ -354,7 +360,7 @@ SelectVersion() { Echo "* iOS 4.3.x downgrades are supported on Linux only" Echo "* For macOS users, use cherryflowerJB instead" fi - if [[ $platform != "win" ]]; then + if [[ $platform != "win" && $LinuxARM != 1 ]]; then Selection+=("4.3.5") Selection2+=("4.3.3" "4.3") fi @@ -383,7 +389,7 @@ SelectVersion() { fi fi - if [[ $platform != "win" && $Mode == "Downgrade"* ]]; then + if [[ $platform != "win" && $LinuxARM != 1 && $Mode == "Downgrade"* ]]; then Selection+=("Other (use SHSH blobs)") fi Selection+=("(Any other key to exit)")