Increase timeouts, Update depends

- increase timeouts to fix #254 and similar issues
- update depends and detect missing to fix #255 and other potential errors
This commit is contained in:
LukeZGD 2023-02-04 14:43:34 +08:00
parent 85da325a72
commit 3ea02d7698
13 changed files with 44 additions and 57 deletions

View File

@ -20,10 +20,9 @@ jobs:
- name: Move linux binaries - name: Move linux binaries
run: | run: |
mkdir -p ./exclude/lib ./exclude/bin mkdir -p ./exclude/bin
cp -R ./bin/* ./exclude/bin cp -R ./bin/* ./exclude/bin
cp ./resources/lib/* ./exclude/lib rm -r ./bin/linux ./bin/windows
rm -r ./bin/linux ./bin/windows ./resources/lib/*
- name: Zip macos files - name: Zip macos files
run: zip -r ${{ github.event.repository.name }}_macos_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip bin/ LICENSE resources/ restore.sh README.md run: zip -r ${{ github.event.repository.name }}_macos_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip bin/ LICENSE resources/ restore.sh README.md
@ -31,7 +30,6 @@ jobs:
- name: Move macos binaries - name: Move macos binaries
run: | run: |
rm -r ./bin/macos rm -r ./bin/macos
cp ./exclude/lib/* ./resources/lib
mkdir ./bin/linux mkdir ./bin/linux
cp -R ./exclude/bin/linux/x86_64 ./bin/linux cp -R ./exclude/bin/linux/x86_64 ./bin/linux
@ -48,7 +46,7 @@ jobs:
- name: Move linux arm64 binaries and other files - name: Move linux arm64 binaries and other files
run: | run: |
rm -r ./bin/linux/arm64 ./resources/lib/* rm -r ./bin/linux/arm64
cp -R ./exclude/bin/linux/arm ./bin/linux cp -R ./exclude/bin/linux/arm ./bin/linux
- name: Zip linux arm files - name: Zip linux arm files
@ -65,7 +63,6 @@ jobs:
- name: Copy exclude files back and download other files - name: Copy exclude files back and download other files
run: | run: |
cp -R ./exclude/bin/* ./bin cp -R ./exclude/bin/* ./bin
cp -R ./exclude/lib/* ./resources/lib
./resources/complete.sh ./resources/complete.sh
- name: Zip complete files - name: Zip complete files

BIN
bin/linux/arm/bspatch Executable file

Binary file not shown.

BIN
bin/linux/arm/gaster Executable file

Binary file not shown.

BIN
bin/linux/arm/iBoot32Patcher Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/macos/jq Executable file

Binary file not shown.

BIN
bin/windows/iBoot32Patcher Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -95,12 +95,12 @@ For devices compatible with downgrades (see README):
set_tool_paths() { set_tool_paths() {
: ' : '
sets variables: platform, platform_ver, dir, lib (linux only) sets variables: platform, platform_ver, dir
also checks architecture (linux) and macos version also checks architecture (linux) and macos version
also set distro, debian_ver, ubuntu_ver, fedora_ver variables for linux also set distro, debian_ver, ubuntu_ver, fedora_ver variables for linux
list of tools set here: list of tools set here:
bspatch, jq, ping, scp, ssh, sha1sum (for macos: shasum -a 1), sha256sum (for macos: shasum -a 256), xmlstarlet, zenity bspatch, jq, ping, scp, ssh, sha1sum (for macos: shasum -a 1), sha256sum (for macos: shasum -a 256), zenity
these ones "need" sudo for linux arm, not for others: these ones "need" sudo for linux arm, not for others:
futurerestore, gaster, idevicerestore, idevicererestore, ipwnder, irecovery futurerestore, gaster, idevicerestore, idevicererestore, ipwnder, irecovery
@ -117,7 +117,6 @@ set_tool_paths() {
platform="linux" platform="linux"
platform_ver="$PRETTY_NAME" platform_ver="$PRETTY_NAME"
dir="../bin/linux/" dir="../bin/linux/"
lib="../resources/lib/"
# architecture check # architecture check
if [[ $(uname -m) == "a"* && $(getconf LONG_BIT) == 64 ]]; then if [[ $(uname -m) == "a"* && $(getconf LONG_BIT) == 64 ]]; then
@ -130,6 +129,7 @@ set_tool_paths() {
error "Your architecture ($(uname -m)) is not supported." error "Your architecture ($(uname -m)) is not supported."
fi fi
# version check
if [[ -e /etc/debian_version ]]; then if [[ -e /etc/debian_version ]]; then
debian_ver=$(cat /etc/debian_version) debian_ver=$(cat /etc/debian_version)
if [[ $debian_ver == *"sid" ]]; then if [[ $debian_ver == *"sid" ]]; then
@ -145,6 +145,7 @@ set_tool_paths() {
fedora_ver=$VERSION_ID fedora_ver=$VERSION_ID
fi fi
# distro check
if [[ $ID == "arch" || $ID_LIKE == "arch" || $ID == "artix" ]]; then if [[ $ID == "arch" || $ID_LIKE == "arch" || $ID == "artix" ]]; then
distro="arch" distro="arch"
elif (( ubuntu_ver >= 22 )) || (( debian_ver >= 12 )) || [[ $debian_ver == "sid" ]]; then elif (( ubuntu_ver >= 22 )) || (( debian_ver >= 12 )) || [[ $debian_ver == "sid" ]]; then
@ -157,18 +158,11 @@ set_tool_paths() {
error "Distro not detected/supported. See the repo README for supported OS versions/distros" error "Distro not detected/supported. See the repo README for supported OS versions/distros"
fi fi
bspatch="$(which bspatch 2>/dev/null)"
if [[ ! -e $bspatch ]]; then
bspatch="env LD_LIBRARY_PATH=$lib $dir/bspatch"
fi
jq="$(which jq)" jq="$(which jq)"
ping="ping -c1" ping="ping -c1"
sha1sum="$(which sha1sum)"
sha256sum="$(which sha256sum)"
xmlstarlet="$(which xmlstarlet)"
zenity="$(which zenity)" zenity="$(which zenity)"
if [[ -e ../resources/sudoloop && $device_sudoloop != 1 ]]; then if [[ $(uname -m) == "x86_64" && -e ../resources/sudoloop && $device_sudoloop != 1 ]]; then
local opt local opt
log "Previous run failed to detect iOS device." log "Previous run failed to detect iOS device."
print "* You may enable sudoloop mode, which will run some tools as root." print "* You may enable sudoloop mode, which will run some tools as root."
@ -177,7 +171,6 @@ set_tool_paths() {
device_sudoloop=1 device_sudoloop=1
fi fi
fi fi
if [[ $(uname -m) == "a"* || $device_sudoloop == 1 || $(id -u $USER) == 999 ]]; then if [[ $(uname -m) == "a"* || $device_sudoloop == 1 || $(id -u $USER) == 999 ]]; then
print "* Enter your user password when prompted" print "* Enter your user password when prompted"
sudo -v sudo -v
@ -215,14 +208,11 @@ set_tool_paths() {
ideviceinfo="$(which ideviceinfo)" ideviceinfo="$(which ideviceinfo)"
iproxy="$(which iproxy)" iproxy="$(which iproxy)"
irecovery="$(which irecovery)" irecovery="$(which irecovery)"
jq="$dir/jq"
ping="ping -c1" ping="ping -c1"
sha1sum="$(which shasum) -a 1" sha1sum="$(which shasum) -a 1"
sha256sum="$(which shasum) -a 256" sha256sum="$(which shasum) -a 256"
xmlstarlet="$dir/xmlstarlet"
zenity="$dir/zenity"
if [[ ! -e $ideviceinfo || ! -e $irecovery ]]; then if [[ -z $ideviceinfo || -z $irecovery ]]; then
error "Install bash, libimobiledevice and libirecovery from Homebrew or MacPorts to continue." \ error "Install bash, libimobiledevice and libirecovery from Homebrew or MacPorts to continue." \
"* For Homebrew: brew install bash libimobiledevice libirecovery" \ "* For Homebrew: brew install bash libimobiledevice libirecovery" \
$'\n* For MacPorts: sudo port install bash libimobiledevice libirecovery' $'\n* For MacPorts: sudo port install bash libimobiledevice libirecovery'
@ -233,13 +223,7 @@ set_tool_paths() {
platform_ver="$(uname)" platform_ver="$(uname)"
dir="../bin/windows" dir="../bin/windows"
bspatch="$dir/bspatch"
jq="$dir/jq"
ping="ping -n 1" ping="ping -n 1"
sha1sum="$(which sha1sum)"
sha256sum="$(which sha256sum)"
xmlstarlet="$dir/xmlstarlet"
zenity="$dir/zenity"
# windows warning message # windows warning message
warn "Using iOS-OTA-Downgrader on Windows is not recommended." warn "Using iOS-OTA-Downgrader on Windows is not recommended."
@ -254,11 +238,18 @@ set_tool_paths() {
# common # common
if [[ $platform != "macos" ]]; then if [[ $platform != "macos" ]]; then
bspatch="$dir/bspatch"
futurerestore+="$dir/futurerestore" futurerestore+="$dir/futurerestore"
ideviceenterrecovery="$dir/ideviceenterrecovery" ideviceenterrecovery="$dir/ideviceenterrecovery"
ideviceinfo="$dir/ideviceinfo" ideviceinfo="$dir/ideviceinfo"
iproxy="$dir/iproxy" iproxy="$dir/iproxy"
irecovery+="$dir/irecovery" irecovery+="$dir/irecovery"
sha1sum="$(which sha1sum)"
sha256sum="$(which sha256sum)"
fi
if [[ $platform != "linux" ]]; then
jq="$dir/jq"
zenity="$dir/zenity"
fi fi
gaster+="$dir/gaster" gaster+="$dir/gaster"
idevicerestore+="$dir/idevicerestore" idevicerestore+="$dir/idevicerestore"
@ -283,23 +274,22 @@ install_depends() {
fi fi
if [[ $distro == "arch" ]]; then if [[ $distro == "arch" ]]; then
sudo pacman -Sy --noconfirm --needed base-devel curl jq libimobiledevice openssh python udev unzip usbmuxd usbutils vim xmlstarlet zenity zip sudo pacman -Sy --noconfirm --needed base-devel curl jq libimobiledevice openssh python udev unzip usbmuxd usbutils vim zenity zip
elif [[ $distro == "debian" ]]; then elif [[ $distro == "debian" ]]; then
if [[ -n $ubuntu_ver ]]; then if [[ -n $ubuntu_ver ]]; then
sudo add-apt-repository -y universe sudo add-apt-repository -y universe
fi fi
sudo apt update sudo apt update
sudo apt install -y bsdiff curl jq libimobiledevice6 libirecovery-common libssl3 openssh-client python3 unzip usbmuxd usbutils xmlstarlet xxd zenity zip sudo apt install -y curl jq libimobiledevice6 libirecovery-common libssl3 openssh-client python3 unzip usbmuxd usbutils xxd zenity zip
sudo systemctl enable --now udev systemd-udevd usbmuxd 2>/dev/null sudo systemctl enable --now udev systemd-udevd usbmuxd 2>/dev/null
elif [[ $distro == "fedora" ]]; then elif [[ $distro == "fedora" ]]; then
ln -sf /usr/lib64/libbz2.so.1.* "$lib/libbz2.so.1.0" sudo dnf install -y ca-certificates jq libimobiledevice openssl python3 systemd udev usbmuxd vim-common zenity zip
sudo dnf install -y bsdiff ca-certificates jq libimobiledevice openssl python3 systemd udev usbmuxd vim-common xmlstarlet zenity zip
sudo ln -sf /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-certificates.crt sudo ln -sf /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-certificates.crt
elif [[ $distro == "opensuse" ]]; then elif [[ $distro == "opensuse" ]]; then
sudo zypper -n in bsdiff curl jq libimobiledevice-1_0-6 openssl-3 python3 usbmuxd unzip vim xmlstarlet zenity zip sudo zypper -n in curl jq libimobiledevice-1_0-6 openssl-3 python3 usbmuxd unzip vim zenity zip
elif [[ $platform == "macos" ]]; then elif [[ $platform == "macos" ]]; then
xcode-select --install xcode-select --install
@ -585,11 +575,10 @@ device_get_info() {
} }
device_find_mode() { device_find_mode() {
# usage: device_find_mode {DFU,Recovery,Restore} {Timeout (default: 10)} # usage: device_find_mode {DFU,Recovery,Restore} {Timeout (default: 24 for linux, 4 for other)}
# finds device in given mode, and sets the device_mode variable # finds device in given mode, and sets the device_mode variable
local usb local usb
local timeout=10 local timeout=4
local i=0 local i=0
local device_in local device_in
@ -601,6 +590,8 @@ device_find_mode() {
if [[ -n $2 ]]; then if [[ -n $2 ]]; then
timeout=$2 timeout=$2
elif [[ $platform == "linux" ]]; then
timeout=24
fi fi
log "Finding device in $1 mode..." log "Finding device in $1 mode..."
@ -635,7 +626,6 @@ device_enter_mode() {
# usage: device_enter_mode {Recovery, DFU, kDFU, pwnDFU} # usage: device_enter_mode {Recovery, DFU, kDFU, pwnDFU}
# attempt to enter given mode, and device_find_mode function will then set device_mode variable # attempt to enter given mode, and device_find_mode function will then set device_mode variable
local opt local opt
case $1 in case $1 in
"Recovery" ) "Recovery" )
if [[ $device_mode == "Normal" ]]; then if [[ $device_mode == "Normal" ]]; then
@ -678,7 +668,7 @@ device_enter_mode() {
sleep 1 sleep 1
done done
echo echo
device_find_mode DFU 20 device_find_mode DFU
;; ;;
"kDFU" ) "kDFU" )
@ -929,7 +919,6 @@ device_ipwndfu() {
main_menu() { main_menu() {
# provides a menu to set the variable mode {downgrade, restore-latest, save-ota-blobs, custom-ipsw, kdfu, remove4, ramdisk4} # provides a menu to set the variable mode {downgrade, restore-latest, save-ota-blobs, custom-ipsw, kdfu, remove4, ramdisk4}
local menu_items=() local menu_items=()
local tmp_items=() local tmp_items=()
if [[ $device_mode != "none" ]]; then if [[ $device_mode != "none" ]]; then
@ -1300,7 +1289,6 @@ ipsw_path_set() {
ipsw_preference_set() { ipsw_preference_set() {
# sets ipsw variables: ipsw_jailbreak, ipsw_jailbreak_tool, ipsw_memory, ipsw_verbose # sets ipsw variables: ipsw_jailbreak, ipsw_jailbreak_tool, ipsw_memory, ipsw_verbose
if [[ $device_target_vers == "$device_latest_vers" && $device_proc != 4 ]]; then if [[ $device_target_vers == "$device_latest_vers" && $device_proc != 4 ]]; then
return return
fi fi
@ -1525,6 +1513,7 @@ ipsw_prepare_1033() {
fi fi
log "Pwned iBSS and iBEC saved at: saved/$device_type" log "Pwned iBSS and iBEC saved at: saved/$device_type"
# this will not be needed if i get to compile futurerestore on mac
if [[ $platform == "macos" && ! -e "$ipsw_custom.ipsw" ]]; then if [[ $platform == "macos" && ! -e "$ipsw_custom.ipsw" ]]; then
log "Preparing custom IPSW..." log "Preparing custom IPSW..."
mkdir -p Firmware/dfu mkdir -p Firmware/dfu
@ -1620,17 +1609,9 @@ ipsw_prepare_32bit_keys() {
local comp="$1" local comp="$1"
local getcomp="$1" local getcomp="$1"
case $comp in case $comp in
"RestoreLogo" ) "RestoreLogo" ) getcomp="AppleLogo";;
getcomp="AppleLogo" "RestoreKernelCache" ) getcomp="Kernelcache";;
;; "RestoreDeviceTree" ) getcomp="DeviceTree";;
"RestoreKernelCache" )
getcomp="Kernelcache"
;;
"RestoreDeviceTree" )
getcomp="DeviceTree"
;;
esac esac
local name=$(echo $device_fw_key | $jq -j '.keys[] | select(.image | startswith("'$getcomp'")) | .filename') local name=$(echo $device_fw_key | $jq -j '.keys[] | select(.image | startswith("'$getcomp'")) | .filename')
local iv=$(echo $device_fw_key | $jq -j '.keys[] | select(.image | startswith("'$getcomp'")) | .iv') local iv=$(echo $device_fw_key | $jq -j '.keys[] | select(.image | startswith("'$getcomp'")) | .iv')
@ -1666,6 +1647,14 @@ ipsw_prepare_32bit() {
return return
fi fi
local xmlstarlet="$dir/xmlstarlet"
if [[ ! -e $xmlstarlet ]]; then
xmlstarlet="$(which xmlstarlet)"
if [[ -z $xmlstarlet ]]; then
error "xmlstarlet is not installed. Install xmlstarlet to continue creating custom IPSW"
fi
fi
local ExtraArgs local ExtraArgs
log "Generating firmware bundle..." log "Generating firmware bundle..."
local IPSWSHA256=$($sha256sum "${ipsw_path//\\//}.ipsw" | awk '{print $1}') local IPSWSHA256=$($sha256sum "${ipsw_path//\\//}.ipsw" | awk '{print $1}')
@ -1844,7 +1833,6 @@ ipsw_extract() {
restore_download_bbsep() { restore_download_bbsep() {
# restore manifest, baseband, sep # restore manifest, baseband, sep
# sets variables: restore_manifest, restore_baseband, restore_sep # sets variables: restore_manifest, restore_baseband, restore_sep
local build_id local build_id
local baseband_sha1 local baseband_sha1
if [[ $device_latest_vers == "$device_use_vers" || $device_target_vers == "10"* ]]; then if [[ $device_latest_vers == "$device_use_vers" || $device_target_vers == "10"* ]]; then
@ -1869,6 +1857,7 @@ restore_download_bbsep() {
mv $build_id.plist ../saved/$device_type mv $build_id.plist ../saved/$device_type
fi fi
cp ../saved/$device_type/$build_id.plist tmp/BuildManifest.plist cp ../saved/$device_type/$build_id.plist tmp/BuildManifest.plist
log "Restore Manifest: ../saved/$device_type/$build_id.plist"
restore_manifest="tmp/BuildManifest.plist" restore_manifest="tmp/BuildManifest.plist"
# Baseband # Baseband
@ -1882,6 +1871,7 @@ restore_download_bbsep() {
mv $restore_baseband ../saved/baseband/ mv $restore_baseband ../saved/baseband/
fi fi
cp ../saved/baseband/$restore_baseband tmp/bbfw.tmp cp ../saved/baseband/$restore_baseband tmp/bbfw.tmp
log "Restore Baseband: ../saved/baseband/$restore_baseband"
restore_baseband="tmp/bbfw.tmp" restore_baseband="tmp/bbfw.tmp"
fi fi
@ -1893,6 +1883,7 @@ restore_download_bbsep() {
"$dir/partialzip" "$(cat $device_fw_dir/$build_id/url)" Firmware/all_flash/$restore_sep.im4p $restore_sep.im4p "$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 mv $restore_sep.im4p ../saved/$device_type/$restore_sep-$build_id.im4p
fi fi
log "Restore SEP: ../saved/$device_type/$restore_sep-$build_id.im4p"
restore_sep="$restore_sep-$build_id.im4p" restore_sep="$restore_sep-$build_id.im4p"
cp ../saved/$device_type/$restore_sep . cp ../saved/$device_type/$restore_sep .
fi fi
@ -2222,7 +2213,7 @@ device_ramdisk4() {
$irecovery -c ramdisk $irecovery -c ramdisk
$irecovery -f ../resources/ramdisk/kernelcache.release.n90 $irecovery -f ../resources/ramdisk/kernelcache.release.n90
$irecovery -c bootx $irecovery -c bootx
device_find_mode Restore device_find_mode Restore 30
log "Device should now be in SSH ramdisk mode." log "Device should now be in SSH ramdisk mode."
echo echo
@ -2255,7 +2246,6 @@ shsh_save_onboard() {
patch_ibec patch_ibec
log "Sending iBEC..." log "Sending iBEC..."
$irecovery -f pwnediBEC $irecovery -f pwnediBEC
sleep 5
device_find_mode Recovery device_find_mode Recovery
log "Dumping blobs now" log "Dumping blobs now"
if [[ $platform == "windows" ]]; then if [[ $platform == "windows" ]]; then
@ -2296,9 +2286,9 @@ main() {
set_tool_paths set_tool_paths
log "Checking Internet connection..." log "Checking Internet connection..."
$ping 208.67.222.222 >/dev/null $ping google.com >/dev/null
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
$ping 8.8.8.8 >/dev/null $ping 208.67.222.222 >/dev/null
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
error "Please check your Internet connection before proceeding." error "Please check your Internet connection before proceeding."
fi fi
@ -2306,7 +2296,7 @@ main() {
version_check version_check
if [[ ! -e "../resources/firstrun" ]] || if [[ ! -e "../resources/firstrun" || -z $jq || -z $zenity ]] ||
[[ $(cat "../resources/firstrun") != "$(uname)" && [[ $(cat "../resources/firstrun") != "$(uname)" &&
$(cat "../resources/firstrun") != "$distro" ]]; then $(cat "../resources/firstrun") != "$distro" ]]; then
install_depends install_depends