Skip to content

Commit c6cc79d

Browse files
committed
Replace most curl usage with static aria2c
- update intel macos zenity binary to run on el capitan -add git fallbacks if --filter causes an error (like if git is too old on older macos versions) - remove homebrew/macports requirements - hopefully no issues come out of these changes
1 parent c3d9068 commit c6cc79d

7 files changed

Lines changed: 69 additions & 75 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
- [ideviceinstaller](https://github.com/LukeeGD/ideviceinstaller) - libimobiledevice
155155
- [ifuse](https://github.com/LukeeGD/ifuse) - libimobiledevice
156156
- [static-cross-openssh](https://github.com/binary-manu/static-cross-openssh) - scp and ssh binaries (used on Linux only)
157+
- [Motrix](https://github.com/agalwood/Motrix) - aria2c binaries
157158
- [usbmuxd2](https://github.com/LukeZGD/usbmuxd2) - tihmstar; LukeZGD fork (used on Linux only, optional)
158159
- [anisette-server](https://github.com/Dadoum/Provision) from Provision - Dadoum (used for sideloading on Linux)
159160
- [AltServer-Linux](https://github.com/NyaMisty/AltServer-Linux) - NyaMisty (used for sideloading on Linux)

bin/linux/arm64/aria2c

8.07 MB
Binary file not shown.

bin/linux/x86_64/aria2c

9.47 MB
Binary file not shown.

bin/macos/aria2c

3.95 MB
Binary file not shown.

bin/macos/arm64/aria2c

3.75 MB
Binary file not shown.

bin/macos/zenity

-2.64 MB
Binary file not shown.

restore.sh

Lines changed: 68 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -471,20 +471,6 @@ set_tool_paths() {
471471
"* Supported macOS versions are 10.11 and newer. (10.12 and newer recommended)"
472472
elif [[ $mac_minver == 11 ]]; then
473473
mac_cocoa=1
474-
if [[ -z $(command -v cocoadialog) ]]; then
475-
local error_msg="* You need to install cocoadialog from MacPorts."
476-
error_msg+=$'\n* Please read the wiki and install the requirements needed in MacPorts: https://github.com/LukeZGD/Legacy-iOS-Kit/wiki/How-to-Use'
477-
error_msg+=$'\n* Also make sure that /opt/local/bin (or /usr/local/bin) is in your $PATH.'
478-
error_msg+=$'\n* You may try running this command: export PATH="/opt/local/bin:$PATH"'
479-
error "Cannot find cocoadialog, cannot continue." "$error_msg"
480-
fi
481-
fi
482-
if [[ $(command -v curl) == "/usr/bin/curl" ]] && (( mac_minver < 15 )); then
483-
local error_msg="* You need to install curl from MacPorts."
484-
error_msg+=$'\n* Please read the wiki and install the requirements needed in MacPorts: https://github.com/LukeZGD/Legacy-iOS-Kit/wiki/How-to-Use'
485-
error_msg+=$'\n* Also make sure that /opt/local/bin (or /usr/local/bin) is in your $PATH.'
486-
error_msg+=$'\n* You may try running this command: export PATH="/opt/local/bin:$PATH"'
487-
error "Outdated curl detected, cannot continue." "$error_msg"
488474
fi
489475
case $mac_minver in
490476
11 ) mac_name="El Capitan";;
@@ -545,6 +531,7 @@ set_tool_paths() {
545531
chmod +x $dir/*
546532
fi
547533

534+
aria2c="$dir/aria2c"
548535
futurerestore+="$dir/futurerestore"
549536
ideviceactivation+="$dir/ideviceactivation"
550537
idevicediagnostics+="$dir/idevicediagnostics"
@@ -651,7 +638,9 @@ version_update_check() {
651638
/usr/bin/xattr -cr ../bin/macos
652639
fi
653640
log "Checking for updates..."
654-
github_api=$(curl https://api.github.com/repos/LukeZGD/Legacy-iOS-Kit/releases/latest 2>/dev/null)
641+
rm -f latest
642+
$aria2c "https://api.github.com/repos/LukeZGD/Legacy-iOS-Kit/releases/latest" >/dev/null
643+
github_api=$(cat latest 2>/dev/null)
655644
version_latest=$(echo "$github_api" | $jq -r '.assets[] | select(.name|test("complete")) | .name' | cut -c 25- | cut -c -9)
656645
git_hash_latest=$(echo "$github_api" | $jq -r '.assets[] | select(.name|test("git-hash")) | .name' | cut -c 21- | cut -c -7)
657646
popd >/dev/null
@@ -676,8 +665,11 @@ version_update() {
676665
log "Downloading..."
677666
git clone --filter=blob:none "https://github.com/LukeZGD/Legacy-iOS-Kit"
678667
if [[ $? != 0 ]]; then
679-
error "git clone failed. Please run the script again" \
680-
"* If you have not installed/updated git, please install git from your package manager."
668+
git clone "https://github.com/LukeZGD/Legacy-iOS-Kit"
669+
if [[ $? != 0 ]]; then
670+
error "git clone failed. Please run the script again" \
671+
"* If you have not installed/updated git, please install git from your package manager."
672+
fi
681673
fi
682674
popd >/dev/null
683675
log "Updating..."
@@ -701,8 +693,11 @@ version_get() {
701693
log "Shallow git repository detected. Unshallowing..."
702694
git fetch --unshallow --filter=blob:none
703695
if [[ $? != 0 ]]; then
704-
error "git fetch failed. Please run the script again" \
705-
"* If you have not installed/updated git, please install git from your package manager."
696+
git fetch --unshallow
697+
if [[ $? != 0 ]]; then
698+
error "git fetch failed. Please run the script again" \
699+
"* If you have not installed/updated git, please install git from your package manager."
700+
fi
706701
fi
707702
fi
708703
git_hash=$(git rev-parse HEAD | cut -c -7)
@@ -937,7 +932,9 @@ device_get_name() {
937932
esac
938933
if [[ -z $device_name && -n $device_type ]]; then
939934
log "Getting device name"
940-
device_name="$(curl "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/device/$device_type.json" | $jq -r ".name")"
935+
rm -f tmp.json
936+
$aria2c "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/device/$device_type.json" -o tmp.json >/dev/null
937+
device_name="$(cat tmp.json | $jq -r ".name")"
941938
fi
942939
}
943940

@@ -1459,7 +1456,9 @@ device_get_info() {
14591456
device_latest_vers="18.5"
14601457
device_latest_build="22F76"
14611458
# log "Getting latest iOS version for $device_type"
1462-
# local latestver="$(curl "https://api.ipsw.me/v4/device/$device_type?type=ipsw" | $jq -j ".firmwares[0]")"
1459+
# rm -f tmp.json
1460+
# $aria2c "https://api.ipsw.me/v4/device/$device_type?type=ipsw" -o tmp.json >/dev/null
1461+
# local latestver="$(cat tmp.json | $jq -j ".firmwares[0]")"
14631462
# device_latest_vers="$(echo "$latestver" | $jq -j ".version")"
14641463
# device_latest_build="$(echo "$latestver" | $jq -j ".buildid")"
14651464
fi
@@ -2187,7 +2186,7 @@ download_file() {
21872186
# usage: download_file {link} {target location} {sha1}
21882187
local filename="$(basename $2)"
21892188
log "Downloading $filename..."
2190-
curl -L $1 -o $2
2189+
$aria2c "$1" -o $2
21912190
if [[ ! -s $2 ]]; then
21922191
error "Downloading $2 failed. Please run the script again"
21932192
fi
@@ -2218,13 +2217,13 @@ device_fw_key_check() {
22182217
fi
22192218

22202219
if [[ ! -e "$keys_path/index.html" ]]; then
2221-
log "Getting firmware keys for $device_type-$build"
22222220
mkdir -p "$keys_path" 2>/dev/null
22232221
local try=("https://github.com/LukeZGD/Legacy-iOS-Kit-Keys/raw/master/$device_type/$build/index.html"
22242222
"http://127.0.0.1:8888/firmware/$device_type/$build"
22252223
"https://api.m1sta.xyz/wikiproxy/$device_type/$build")
22262224
for i in "${try[@]}"; do
2227-
curl -L $i -o index.html
2225+
log "Getting firmware keys for $device_type-$build: $i"
2226+
$aria2c "$i" -o index.html >/dev/null
22282227
if [[ $(cat index.html | grep -c "$build") == 1 ]]; then
22292228
break
22302229
fi
@@ -2276,7 +2275,9 @@ ipsw_get_url() {
22762275
1[789]* | [23]* ) phone="PadOS";; # iPadOS
22772276
esac
22782277
fi
2279-
url="$(curl "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/ios/i${phone};$build_id.json" | $jq -r ".sources[] | select(.type == \"ipsw\" and any(.deviceMap[]; . == \"$device_type\")) | .links[0].url")"
2278+
rm -f tmp.json
2279+
$aria2c "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/ios/i${phone};$build_id.json" -o tmp.json >/dev/null
2280+
url="$(cat tmp.json | $jq -r ".sources[] | select(.type == \"ipsw\" and any(.deviceMap[]; . == \"$device_type\")) | .links[0].url")"
22802281
local url2="$(echo "$url" | tr '[:upper:]' '[:lower:]')"
22812282
local build_id2="$(echo "$build_id" | tr '[:upper:]' '[:lower:]')"
22822283
if [[ $(echo "$url" | grep -c '<') != 0 || $url2 != *"$build_id2"* ]]; then
@@ -2676,7 +2677,7 @@ ipsw_download() {
26762677
fi
26772678
print "* If you want to download it yourself, here is the link: $ipsw_url"
26782679
log "Downloading IPSW... (Press Ctrl+C to cancel)"
2679-
curl -L "$ipsw_url" -o temp.ipsw
2680+
$aria2c "$ipsw_url" -c -s 16 -x 16 -k 1M -j 1 -o temp.ipsw
26802681
mv temp.ipsw "$ipsw_dl.ipsw"
26812682
fi
26822683
ipsw_verify "$ipsw_dl" "$build_id"
@@ -2719,7 +2720,9 @@ ipsw_verify() {
27192720
1[789]* | [23]* ) phone="PadOS";; # iPadOS
27202721
esac
27212722
fi
2722-
IPSWSHA1="$(curl "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/ios/i${phone};$build_id.json" | $jq -r ".sources[] | select(.type == \"ipsw\" and any(.deviceMap[]; . == \"$device_type\")) | .hashes.sha1")"
2723+
rm -f tmp.json
2724+
$aria2c "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/ios/i${phone};$build_id.json" -o tmp.json >/dev/null
2725+
IPSWSHA1="$(cat tmp.json | $jq -r ".sources[] | select(.type == \"ipsw\" and any(.deviceMap[]; . == \"$device_type\")) | .hashes.sha1")"
27232726
mkdir -p $device_fw_dir/$build_id 2>/dev/null
27242727

27252728
if [[ -n $IPSWSHA1 && -n $IPSWSHA1E && $IPSWSHA1 == "$IPSWSHA1E" ]]; then
@@ -4325,7 +4328,7 @@ ipsw_prepare_multipatch() {
43254328
fi
43264329
if [[ ! -s "$ipsw_name.ipsw" ]]; then
43274330
log "Downloading FS IPSW..."
4328-
curl -L "$ipsw_url" -o temp2.ipsw
4331+
$aria2c -c -s 16 -x 16 -k 1M -j 1 "$ipsw_url" -o temp2.ipsw
43294332
log "Getting SHA1 hash for FS IPSW..."
43304333
sha1L=$($sha1sum temp2.ipsw | awk '{print $1}')
43314334
if [[ $sha1L != "$sha1E" ]]; then
@@ -4785,7 +4788,7 @@ ipsw_prepare_s5l8900() {
47854788

47864789
if [[ $device_type != "iPhone1,2" ]]; then
47874790
log "Downloading IPSW: $ipsw_url"
4788-
curl -L "$ipsw_url" -o temp.ipsw
4791+
$aria2c -c -s 16 -x 16 -k 1M -j 1 "$ipsw_url" -o temp.ipsw
47894792
log "Getting SHA1 hash for IPSW..."
47904793
sha1L=$($sha1sum temp.ipsw | awk '{print $1}')
47914794
if [[ $sha1L != "$sha1E" ]]; then
@@ -5078,7 +5081,9 @@ restore_futurerestore() {
50785081
return
50795082
fi
50805083
log "Checking for futurerestore updates..."
5081-
#local fr_latest="$(curl https://api.github.com/repos/futurerestore/futurerestore/commits | $jq -r '.[0].sha')"
5084+
#rm -f commits
5085+
#$aria2c "https://api.github.com/repos/futurerestore/futurerestore/commits" >/dev/null
5086+
#local fr_latest="$(cat commits | $jq -r '.[0].sha')"
50825087
local fr_latest="2719b0d615987093191aa20ff6aad82c2ad937e6"
50835088
local fr_branch="main"
50845089
if (( target_det >= 16 )); then
@@ -6460,6 +6465,17 @@ device_ramdisk_setnvram() {
64606465
fi
64616466
;;
64626467
esac
6468+
: '
6469+
elif [[ $device_type == "iPad1,1" ]]; then
6470+
device_ramdisk_iosvers
6471+
if [[ $device_vers == "3"* && -n $($ssh -p $ssh_port root@127.0.0.1 "ls /mnt1/bin/bash 2>/dev/null") ]]; then
6472+
untether="${device_type}_${device_build}.tar"
6473+
log "Sending $untether"
6474+
$scp -P $ssh_port $jelbrek/greenpois0n/$untether root@127.0.0.1:/mnt1
6475+
log "Extracting $untether"
6476+
$ssh -p $ssh_port root@127.0.0.1 "tar -xvf /mnt1/$untether -C /mnt1; rm /mnt1/$untether"
6477+
fi
6478+
'
64636479
fi
64646480
log "Done"
64656481
}
@@ -6490,18 +6506,6 @@ device_ramdisk_ios3exploit() {
64906506
$scp -P $ssh_port $jelbrek/greenpois0n/$untether root@127.0.0.1:/mnt1
64916507
log "Extracting $untether"
64926508
$ssh -p $ssh_port root@127.0.0.1 "tar -xvf /mnt1/$untether -C /mnt1; rm /mnt1/$untether"
6493-
: '
6494-
log "Mounting data partition"
6495-
$ssh -p $ssh_port root@127.0.0.1 "mount.sh pv"
6496-
device_send_rdtar cydiasubstrate.tar
6497-
device_send_rdtar cydiahttpatch.tar
6498-
if [[ $device_vers == "3.1.3" || $device_vers == "3.2" ]]; then
6499-
device_send_rdtar freeze.tar data
6500-
fi
6501-
if [[ $ipsw_openssh == 1 ]]; then
6502-
device_send_rdtar sshdeb.tar
6503-
fi
6504-
'
65056509
fi
65066510
}
65076511

@@ -6684,7 +6688,9 @@ menu_ramdisk() {
66846688
continue
66856689
fi
66866690
log "Checking for latest TrollStore"
6687-
local latest="$(curl https://api.github.com/repos/opa334/TrollStore/releases/latest | $jq -r ".tag_name")"
6691+
rm -f latest
6692+
$aria2c "https://api.github.com/repos/opa334/TrollStore/releases/latest" >/dev/null
6693+
local latest="$(cat latest | $jq -r ".tag_name")"
66886694
local current="$(cat ../saved/TrollStore_version 2>/dev/null || echo "none")"
66896695
log "Latest version: $latest, current version: $current"
66906696
if [[ $current != "$latest" ]]; then
@@ -6961,7 +6967,9 @@ shsh_convert_onboard() {
69616967
}
69626968

69636969
shsh_save_cydia() {
6964-
local json=$(curl "https://api.ipsw.me/v4/device/${device_type}?type=ipsw")
6970+
rm -f tmp.json
6971+
$aria2c "https://api.ipsw.me/v4/device/${device_type}?type=ipsw" -o tmp.json >/dev/null
6972+
local json=$(cat tmp.json)
69656973
local len=$(echo "$json" | $jq -r ".firmwares | length")
69666974
local builds=()
69676975
local i=0
@@ -7423,7 +7431,9 @@ device_sideloader() {
74237431
fi
74247432
sideloader+="$arch"
74257433
log "Checking for latest Sideloader"
7426-
local latest="$(curl https://api.github.com/repos/LukeZGD/Sideloader/releases/latest | $jq -r ".tag_name")"
7434+
rm -f latest
7435+
$aria2c "https://api.github.com/repos/LukeZGD/Sideloader/releases/latest" >/dev/null
7436+
local latest="$(cat latest | $jq -r ".tag_name")"
74277437
local current="$(cat ../saved/Sideloader_version 2>/dev/null || echo "none")"
74287438
log "Latest version: $latest, current version: $current"
74297439
if [[ $current != "$latest" ]]; then
@@ -7452,12 +7462,8 @@ menu_zenity_check() {
74527462
menu_ipa_browse() {
74537463
local newpath
74547464
input "Select your IPA file(s) in the file selection window."
7455-
if [[ $mac_cocoa == 1 ]]; then
7456-
newpath="$($cocoadialog fileselect --with-extensions ipa)"
7457-
else
7458-
menu_zenity_check
7459-
newpath="$($zenity --file-selection --multiple --file-filter='IPA | *.ipa' --title="Select IPA file(s)")"
7460-
fi
7465+
menu_zenity_check
7466+
newpath="$($zenity --file-selection --multiple --file-filter='IPA | *.ipa' --title="Select IPA file(s)")"
74617467
[[ -z "$newpath" ]] && read -p "$(input "Enter path to IPA file (or press Enter/Return or Ctrl+C to cancel): ")" newpath
74627468
ipa_path="$newpath"
74637469
}
@@ -8417,12 +8423,8 @@ ipsw_custom_set() {
84178423
menu_logo_browse() {
84188424
local newpath
84198425
input "Select your $1 image file in the file selection window."
8420-
if [[ $mac_cocoa == 1 ]]; then
8421-
newpath="$($cocoadialog fileselect --with-extensions png)"
8422-
else
8423-
menu_zenity_check
8424-
newpath="$($zenity --file-selection --file-filter='PNG | *.png' --title="Select $1 image file")"
8425-
fi
8426+
menu_zenity_check
8427+
newpath="$($zenity --file-selection --file-filter='PNG | *.png' --title="Select $1 image file")"
84268428
[[ ! -s "$newpath" ]] && read -p "$(input "Enter path to $1 image file (or press Enter/Return or Ctrl+C to cancel): ")" newpath
84278429
[[ ! -s "$newpath" ]] && return
84288430
log "Selected $1 image file: $newpath"
@@ -8497,13 +8499,10 @@ menu_ipsw_browse() {
84978499

84988500
if [[ $picker == 1 ]]; then
84998501
input "Select your $text IPSW file in the file selection window."
8500-
if [[ $mac_cocoa == 1 ]]; then
8501-
newpath="$($cocoadialog fileselect --with-extensions ipsw)"
8502-
elif [[ $1 == "custom" ]]; then
8503-
menu_zenity_check
8502+
menu_zenity_check
8503+
if [[ $1 == "custom" ]]; then
85048504
newpath="$($zenity --file-selection --file-filter='IPSW | *.ipsw' --title="Select $text IPSW file")"
85058505
else
8506-
menu_zenity_check
85078506
newpath="$($zenity --file-selection --file-filter='IPSW | *Restore.ipsw' --title="Select $text IPSW file")"
85088507
fi
85098508
fi
@@ -8714,12 +8713,8 @@ menu_shsh_browse() {
87148713
[[ $1 == "base" ]] && text="Base"
87158714

87168715
input "Select your $text SHSH file in the file selection window."
8717-
if [[ $mac_cocoa == 1 ]]; then
8718-
newpath="$($cocoadialog fileselect)"
8719-
else
8720-
menu_zenity_check
8721-
newpath="$($zenity --file-selection --file-filter='SHSH | *.bshsh2 *.shsh *.shsh2' --title="Select $text SHSH file")"
8722-
fi
8716+
menu_zenity_check
8717+
newpath="$($zenity --file-selection --file-filter='SHSH | *.bshsh2 *.shsh *.shsh2' --title="Select $text SHSH file")"
87238718
log "Selected SHSH file: $newpath"
87248719
if [[ -n "$newpath" && ! -s "$newpath" ]]; then
87258720
warn "The selected SHSH blob file seems to be empty/invalid. It cannot be used for restoring."
@@ -8752,12 +8747,8 @@ menu_shsh_browse() {
87528747
menu_shshdump_browse() {
87538748
local newpath
87548749
input "Select your raw dump file in the file selection window."
8755-
if [[ $mac_cocoa == 1 ]]; then
8756-
newpath="$($cocoadialog fileselect --with-extensions raw)"
8757-
else
8758-
menu_zenity_check
8759-
newpath="$($zenity --file-selection --file-filter='Raw Dump | *.dump *.raw' --title="Select Raw Dump")"
8760-
fi
8750+
menu_zenity_check
8751+
newpath="$($zenity --file-selection --file-filter='Raw Dump | *.dump *.raw' --title="Select Raw Dump")"
87618752
[[ ! -s "$newpath" ]] && read -p "$(input "Enter path to raw dump file (or press Enter/Return or Ctrl+C to cancel): ")" newpath
87628753
[[ ! -s "$newpath" ]] && return
87638754
log "Selected raw dump file: $newpath"
@@ -9834,7 +9825,9 @@ device_altserver() {
98349825
mv AltServer-$arch $altserver
98359826
fi
98369827
log "Checking for latest anisette-server"
9837-
local latest="$(curl https://api.github.com/repos/LukeZGD/Provision/releases/latest | $jq -r ".tag_name")"
9828+
rm -f latest
9829+
$aria2c "https://api.github.com/repos/LukeZGD/Provision/releases/latest" >/dev/null
9830+
local latest="$(cat latest | $jq -r ".tag_name")"
98389831
local current="$(cat ../saved/anisette-server_version 2>/dev/null || echo "none")"
98399832
log "Latest version: $latest, current version: $current"
98409833
if [[ $current != "$latest" ]]; then

0 commit comments

Comments
 (0)