From d676325dc932061bfa22233e6692888055943a66 Mon Sep 17 00:00:00 2001 From: LukeZGD <26163116+LukeZGD@users.noreply.github.com> Date: Mon, 26 Aug 2024 00:10:15 +0800 Subject: [PATCH] Fix bb stitch condition, add warnings/messages for residual tmp folder(s) that may cause problems especially for Linux on device detection, since usbmuxd won't run if LiK detects other instances thru checking of existing tmp folders --- restore.sh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/restore.sh b/restore.sh index d5e37f8..30c4d12 100755 --- a/restore.sh +++ b/restore.sh @@ -242,7 +242,11 @@ set_tool_paths() { fi #sudo killall usbmuxd 2>/dev/null #sleep 1 + log "Running usbmuxd" sudo -b $dir/usbmuxd -pf &>../saved/usbmuxd.log + elif [[ $othertmp != 0 ]]; then + log "Detected existing tmp folder(s), there might be other Legacy iOS Kit instance(s) running" + log "Not running usbmuxd" fi fi @@ -774,6 +778,9 @@ device_get_info() { log "Finding device in Normal mode..." if [[ $platform == "linux" ]]; then print "* If it gets stuck here, try to restart your PC" + if [[ $othertmp != 0 ]]; then + print "* If it fails to detect devices, try to delete all \"tmp\" folders in your Legacy iOS Kit folder" + fi fi fi @@ -2525,7 +2532,7 @@ ipsw_prepare_jailbreak() { ExtraArgs+=" -ramdiskgrow 10" if [[ $device_use_bb != 0 && $device_type != "$device_disable_bbupdate" ]]; then ExtraArgs+=" -bbupdate" - elif [[ $device_type == "$device_disable_bbupdate" && $device_type == "iPhone"* && $device_deadbb != 1 ]]; then + elif [[ $device_type == "$device_disable_bbupdate" && $device_deadbb != 1 ]]; then device_dump baseband ExtraArgs+=" ../saved/$device_type/baseband-$device_ecid.tar" fi @@ -3177,7 +3184,7 @@ ipsw_prepare_32bit() { ExtraArgs+=" -ramdiskgrow 10" if [[ $device_use_bb != 0 && $device_type != "$device_disable_bbupdate" ]]; then ExtraArgs+=" -bbupdate" - elif [[ $device_type == "$device_disable_bbupdate" && $device_type == "iPhone"* && $device_deadbb != 1 ]]; then + elif [[ $device_type == "$device_disable_bbupdate" && $device_deadbb != 1 ]]; then device_dump baseband ExtraArgs+=" ../saved/$device_type/baseband-$device_ecid.tar" fi @@ -4035,7 +4042,7 @@ ipsw_prepare_powder() { fi if [[ $device_use_bb != 0 && $device_type != "$device_disable_bbupdate" ]]; then ExtraArgs+=" -bbupdate" - elif [[ $device_type == "$device_disable_bbupdate" && $device_type == "iPhone"* && $device_deadbb != 1 ]]; then + elif [[ $device_type == "$device_disable_bbupdate" && $device_deadbb != 1 ]]; then device_dump baseband ExtraArgs+=" ../saved/$device_type/baseband-$device_ecid.tar" fi @@ -8650,8 +8657,6 @@ trap "exit 1" INT TERM clean othertmp=$(ls "$(dirname "$0")" | grep -c tmp) -mkdir "$(dirname "$0")/tmp$$" -pushd "$(dirname "$0")/tmp$$" >/dev/null if [[ $no_color != 1 ]]; then TERM=xterm-256color # fix colors for msys2 terminal @@ -8662,6 +8667,17 @@ if [[ $no_color != 1 ]]; then color_N=$(tput sgr0) fi +if [[ $othertmp != 0 ]]; then + log "Detected existing tmp folder(s)." + print "* There might be other Legacy iOS Kit instance(s) running, or residual tmp folder(s) not deleted." + print "* Running multiple instances is not fully supported and can cause unexpected behavior." + print "* It is recommended to only use a single instance and/or delete all existing \"tmp\" folders in your Legacy iOS Kit folder before continuing." + pause +fi + +mkdir "$(dirname "$0")/tmp$$" +pushd "$(dirname "$0")/tmp$$" >/dev/null + main popd >/dev/null