Skip to content

Commit 4bf186f

Browse files
committed
some changes regarding aria2c
- install from package manager on supported linux distros - check first if aria2c exists in path, then use that instead - if it doesnt exist, only then use the aria2c bin - remove >/dev/null from aria2c usages to always see output - add --download-result=hide for shorter output
1 parent 4ab1fbd commit 4bf186f

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

restore.sh

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,9 @@ set_tool_paths() {
565565
chmod +x $dir/*
566566
fi
567567

568-
aria2c="$dir/aria2c"
568+
aria2c="$(command -v aria2c)"
569+
[[ -z $aria2c ]] && aria2c="$dir/aria2c"
570+
aria2c+=" --download-result=hide"
569571
futurerestore+="$dir/futurerestore"
570572
ideviceactivation+="$dir/ideviceactivation"
571573
idevicediagnostics+="$dir/idevicediagnostics"
@@ -615,21 +617,21 @@ install_depends() {
615617

616618
log "Installing dependencies..."
617619
if [[ $distro == "arch" ]]; then
618-
sudo pacman -Sy --noconfirm --needed base-devel ca-certificates ca-certificates-mozilla curl git libimobiledevice openssh python sshfs udev unzip usbmuxd usbutils vim zenity zip zstd
620+
sudo pacman -Sy --noconfirm --needed aria2 base-devel ca-certificates ca-certificates-mozilla curl git libimobiledevice openssh python sshfs udev unzip usbmuxd usbutils vim zenity zip zstd
619621
prepare_udev_rules root storage
620622

621623
elif [[ $distro == "debian" ]]; then
622624
if [[ -n $ubuntu_ver ]]; then
623625
sudo add-apt-repository -y universe
624626
fi
625627
sudo apt update
626-
sudo apt install -m -y ca-certificates curl git libssl3 libzstd1 openssh-client patch python3 sshfs unzip usbmuxd usbutils xxd zenity zip zlib1g
628+
sudo apt install -m -y aria2 ca-certificates curl git libssl3 libzstd1 openssh-client patch python3 sshfs unzip usbmuxd usbutils xxd zenity zip zlib1g
627629
if [[ $(command -v systemctl 2>/dev/null) ]]; then
628630
sudo systemctl enable --now udev systemd-udevd usbmuxd 2>/dev/null
629631
fi
630632

631633
elif [[ $distro == "fedora" ]]; then
632-
sudo dnf install -y ca-certificates git libimobiledevice libzstd openssl patch python3 sshfs systemd udev usbmuxd vim-common zenity zip
634+
sudo dnf install -y aria2 ca-certificates git libimobiledevice libzstd openssl patch python3 sshfs systemd udev usbmuxd vim-common zenity zip
633635
sudo ln -sf /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-certificates.crt
634636
prepare_udev_rules root usbmuxd
635637

@@ -638,14 +640,14 @@ install_depends() {
638640
print "* You may need to reboot to apply changes with rpm-ostree. Perform a reboot after this before running the script again."
639641

640642
elif [[ $distro == "opensuse" ]]; then
641-
sudo zypper -n install ca-certificates curl git libimobiledevice-1_0-6 libzstd1 openssl-3 patch python3 sshfs usbmuxd unzip vim zenity zip
643+
sudo zypper -n install aria2 ca-certificates curl git libimobiledevice-1_0-6 libzstd1 openssl-3 patch python3 sshfs usbmuxd unzip vim zenity zip
642644
prepare_udev_rules usbmux usbmux # idk if this is right
643645

644646
elif [[ $distro == "gentoo" ]]; then
645-
sudo emerge -av --noreplace app-arch/zstd app-misc/ca-certificates libimobiledevice net-fs/sshfs net-misc/curl openssh python udev unzip usbmuxd usbutils vim zenity zip
647+
sudo emerge -av --noreplace app-arch/zstd app-misc/ca-certificates libimobiledevice net-fs/sshfs net-misc/aria2 net-misc/curl openssh python udev unzip usbmuxd usbutils vim zenity zip
646648

647649
elif [[ $distro == "void" ]]; then
648-
sudo xbps-install curl git patch openssh python3 unzip xxd zenity zip
650+
sudo xbps-install aria2 curl git patch openssh python3 unzip xxd zenity zip
649651
fi
650652

651653
echo "$platform_ver" > "../resources/firstrun"
@@ -673,7 +675,7 @@ version_update_check() {
673675
fi
674676
log "Checking for updates..."
675677
rm -f latest
676-
$aria2c "https://api.github.com/repos/LukeZGD/Legacy-iOS-Kit/releases/latest" >/dev/null
678+
$aria2c "https://api.github.com/repos/LukeZGD/Legacy-iOS-Kit/releases/latest"
677679
github_api=$(cat latest 2>/dev/null)
678680
version_latest=$(echo "$github_api" | $jq -r '.assets[] | select(.name|test("complete")) | .name' | cut -c 25- | cut -c -9)
679681
git_hash_latest=$(echo "$github_api" | $jq -r '.assets[] | select(.name|test("git-hash")) | .name' | cut -c 21- | cut -c -7)
@@ -970,7 +972,7 @@ device_get_name() {
970972
if [[ -z $device_name && -n $device_type ]]; then
971973
log "Getting device name"
972974
rm -f tmp.json
973-
$aria2c "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/device/$device_type.json" -o tmp.json >/dev/null
975+
$aria2c "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/device/$device_type.json" -o tmp.json
974976
device_name="$(cat tmp.json | $jq -r ".name")"
975977
fi
976978
}
@@ -1494,7 +1496,7 @@ device_get_info() {
14941496
device_latest_build="22G100"
14951497
# log "Getting latest iOS version for $device_type"
14961498
# rm -f tmp.json
1497-
# $aria2c "https://api.ipsw.me/v4/device/$device_type?type=ipsw" -o tmp.json >/dev/null
1499+
# $aria2c "https://api.ipsw.me/v4/device/$device_type?type=ipsw" -o tmp.json
14981500
# local latestver="$(cat tmp.json | $jq -j ".firmwares[0]")"
14991501
# device_latest_vers="$(echo "$latestver" | $jq -j ".version")"
15001502
# device_latest_build="$(echo "$latestver" | $jq -j ".buildid")"
@@ -2270,7 +2272,7 @@ device_fw_key_check() {
22702272
"https://api.m1sta.xyz/wikiproxy/$device_type/$build")
22712273
for i in "${try[@]}"; do
22722274
log "Getting firmware keys for $device_type-$build: $i"
2273-
$aria2c "$i" -o index.html >/dev/null
2275+
$aria2c "$i" -o index.html
22742276
if [[ $(cat index.html | grep -c "$build") == 1 ]]; then
22752277
break
22762278
fi
@@ -2323,7 +2325,7 @@ ipsw_get_url() {
23232325
esac
23242326
fi
23252327
rm -f tmp.json
2326-
$aria2c "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/ios/i${phone};$build_id.json" -o tmp.json >/dev/null
2328+
$aria2c "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/ios/i${phone};$build_id.json" -o tmp.json
23272329
url="$(cat tmp.json | $jq -r ".sources[] | select(.type == \"ipsw\" and any(.deviceMap[]; . == \"$device_type\")) | .links[0].url")"
23282330
local url2="$(echo "$url" | tr '[:upper:]' '[:lower:]')"
23292331
local build_id2="$(echo "$build_id" | tr '[:upper:]' '[:lower:]')"
@@ -2768,7 +2770,7 @@ ipsw_verify() {
27682770
esac
27692771
fi
27702772
rm -f tmp.json
2771-
$aria2c "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/ios/i${phone};$build_id.json" -o tmp.json >/dev/null
2773+
$aria2c "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/ios/i${phone};$build_id.json" -o tmp.json
27722774
IPSWSHA1="$(cat tmp.json | $jq -r ".sources[] | select(.type == \"ipsw\" and any(.deviceMap[]; . == \"$device_type\")) | .hashes.sha1")"
27732775
mkdir -p $device_fw_dir/$build_id 2>/dev/null
27742776

@@ -5125,7 +5127,7 @@ restore_futurerestore() {
51255127
fi
51265128
log "Checking for futurerestore updates..."
51275129
#rm -f commits
5128-
#$aria2c "https://api.github.com/repos/futurerestore/futurerestore/commits" >/dev/null
5130+
#$aria2c "https://api.github.com/repos/futurerestore/futurerestore/commits"
51295131
#local fr_latest="$(cat commits | $jq -r '.[0].sha')"
51305132
local fr_latest="15f26141aaf1c980a5d5c44e429194d5225f531c"
51315133
local fr_branch="main"
@@ -6740,7 +6742,7 @@ menu_ramdisk() {
67406742
fi
67416743
log "Checking for latest TrollStore"
67426744
rm -f latest
6743-
$aria2c "https://api.github.com/repos/opa334/TrollStore/releases/latest" >/dev/null
6745+
$aria2c "https://api.github.com/repos/opa334/TrollStore/releases/latest"
67446746
local latest="$(cat latest | $jq -r ".tag_name")"
67456747
local current="$(cat ../saved/TrollStore_version 2>/dev/null || echo "none")"
67466748
log "Latest version: $latest, current version: $current"
@@ -7038,7 +7040,7 @@ shsh_convert_onboard() {
70387040

70397041
shsh_save_cydia() {
70407042
rm -f tmp.json
7041-
$aria2c "https://api.ipsw.me/v4/device/${device_type}?type=ipsw" -o tmp.json >/dev/null
7043+
$aria2c "https://api.ipsw.me/v4/device/${device_type}?type=ipsw" -o tmp.json
70427044
local json=$(cat tmp.json)
70437045
local len=$(echo "$json" | $jq -r ".firmwares | length")
70447046
local builds=()
@@ -7547,7 +7549,7 @@ device_sideloader() {
75477549
sideloader+="$arch"
75487550
log "Checking for latest Sideloader"
75497551
rm -f latest
7550-
$aria2c "https://api.github.com/repos/LukeZGD/Sideloader/releases/latest" >/dev/null
7552+
$aria2c "https://api.github.com/repos/LukeZGD/Sideloader/releases/latest"
75517553
local latest="$(cat latest | $jq -r ".tag_name")"
75527554
local current="$(cat ../saved/Sideloader_version 2>/dev/null || echo "none")"
75537555
log "Latest version: $latest, current version: $current"
@@ -10009,7 +10011,7 @@ device_altserver() {
1000910011
fi
1001010012
log "Checking for latest anisette-server"
1001110013
rm -f latest
10012-
$aria2c "https://api.github.com/repos/LukeZGD/Provision/releases/latest" >/dev/null
10014+
$aria2c "https://api.github.com/repos/LukeZGD/Provision/releases/latest"
1001310015
local latest="$(cat latest | $jq -r ".tag_name")"
1001410016
local current="$(cat ../saved/anisette-server_version 2>/dev/null || echo "none")"
1001510017
log "Latest version: $latest, current version: $current"

0 commit comments

Comments
 (0)