Add bin directory checks and pyenv stuff

This commit is contained in:
LukeZGD 2023-08-23 20:37:39 +08:00
parent d5a9cfa238
commit d0eabcf25b

View File

@ -209,9 +209,10 @@ set_tool_paths() {
ipwnder="sudo " ipwnder="sudo "
irecovery="sudo " irecovery="sudo "
irecovery2="sudo " irecovery2="sudo "
sudo chmod +x $dir/* if [[ ! -d $dir && $(ls ../bin/linux) ]]; then
if [[ $? != 0 ]]; then log "Running on platform: $platform ($platform_ver)"
error "Failed setting up permissions, cannot continue." error "Failed to find bin directory, detected $(ls -x ../bin/linux) instead of $platform_arch." \
"* Download the \"linux_$platform_arch\" or \"complete\" version to continue (or do a git clone)"
fi fi
if [[ -z $device_disable_usbmuxd ]]; then if [[ -z $device_disable_usbmuxd ]]; then
sudo systemctl stop usbmuxd sudo systemctl stop usbmuxd
@ -247,7 +248,16 @@ set_tool_paths() {
error "Your platform ($OSTYPE) is not supported." "* Supported platforms: Linux, macOS" error "Your platform ($OSTYPE) is not supported." "* Supported platforms: Linux, macOS"
fi fi
log "Running on platform: $platform ($platform_ver)" log "Running on platform: $platform ($platform_ver)"
if [[ $device_sudoloop != 1 ]]; then if [[ ! -d $dir ]]; then
error "Failed to find bin directory ($dir), cannot continue." \
"* Re-download Legacy iOS Kit from releases (or do a git clone/reset)"
fi
if [[ $device_sudoloop == 1 ]]; then
sudo chmod +x $dir/*
if [[ $? != 0 ]]; then
error "Failed setting up permissions, cannot continue."
fi
else
chmod +x $dir/* chmod +x $dir/*
fi fi
@ -917,7 +927,8 @@ device_enter_mode() {
log "Entering kDFU mode..." log "Entering kDFU mode..."
print "* This may take a while, but should not take longer than a minute." print "* This may take a while, but should not take longer than a minute."
if [[ $device_det == 1 ]]; then if [[ $device_det == 1 ]]; then
print "* If the script seems to be stuck here, try to start over from step 1 in the GitHub wiki." print "* If the script seems to be stuck here, try to re-install the requirements and restart the device."
print "* Follow the steps in the GitHub wiki."
fi fi
$scp -P 2222 ${sendfiles[@]} root@127.0.0.1:/tmp $scp -P 2222 ${sendfiles[@]} root@127.0.0.1:/tmp
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
@ -1119,11 +1130,9 @@ device_ipwndfu() {
local pyenv=$(which pyenv 2>/dev/null) local pyenv=$(which pyenv 2>/dev/null)
local pyenv2="$HOME/.pyenv/versions/2.7.18/bin/python2" local pyenv2="$HOME/.pyenv/versions/2.7.18/bin/python2"
if [[ $1 == "send_ibss" ]]; then if [[ -z $pyenv && -e "$HOME/.pyenv/bin/pyenv" ]]; then
patch_ibss pyenv="$HOME/.pyenv/bin/pyenv"
cp pwnediBSS ../resources/ipwndfu/
fi fi
if [[ $platform == "macos" ]]; then if [[ $platform == "macos" ]]; then
mac_ver=$(echo "$platform_ver" | cut -c -2) mac_ver=$(echo "$platform_ver" | cut -c -2)
fi fi
@ -1132,14 +1141,19 @@ device_ipwndfu() {
elif [[ -z $python2 && ! -e $pyenv2 ]]; then elif [[ -z $python2 && ! -e $pyenv2 ]]; then
warn "python2 is not installed. Attempting to install python2 before continuing" warn "python2 is not installed. Attempting to install python2 before continuing"
print "* You may install python2 from pyenv: pyenv install 2.7.18" print "* You may install python2 from pyenv: pyenv install 2.7.18"
if [[ -z $pyenv && ! -d $HOME/.pyenv ]]; then if [[ -z $pyenv ]]; then
warn "pyenv is not installed. Attempting to install pyenv before continuing" warn "pyenv is not installed. Attempting to install pyenv before continuing"
print "* You may install pyenv by running: curl https://pyenv.run | bash" print "* You may install pyenv by running: curl https://pyenv.run | bash"
log "Installing pyenv" log "Installing pyenv"
curl https://pyenv.run | bash curl https://pyenv.run | bash
pyenv="$HOME/.pyenv/bin/pyenv" pyenv="$HOME/.pyenv/bin/pyenv"
if [[ ! -e $pyenv ]]; then
error "Cannot detect python2 from pyenv, its installation may have failed." \
"* Also try installing pyenv and python2 manually before retrying."
fi
fi fi
log "Installing python2 using pyenv" log "Installing python2 using pyenv"
print "* This may take a while, but should not take longer than a few minutes."
$pyenv install 2.7.18 $pyenv install 2.7.18
if [[ ! -e $pyenv2 ]]; then if [[ ! -e $pyenv2 ]]; then
warn "Cannot detect python2 from pyenv, its installation may have failed." warn "Cannot detect python2 from pyenv, its installation may have failed."
@ -1158,6 +1172,11 @@ device_ipwndfu() {
python2+="$pyenv2" python2+="$pyenv2"
fi fi
if [[ $1 == "send_ibss" ]]; then
patch_ibss
cp pwnediBSS ../resources/ipwndfu/
fi
device_enter_mode DFU device_enter_mode DFU
if [[ ! -d ../resources/ipwndfu ]]; then if [[ ! -d ../resources/ipwndfu ]]; then
download_file https://github.com/LukeZGD/ipwndfu/archive/0883efd7de10e806e8d5e3d825950b04bb5a12b7.zip ipwndfu.zip 1f5dd30102b968ceb1f8ed361b265011e6daed98 download_file https://github.com/LukeZGD/ipwndfu/archive/0883efd7de10e806e8d5e3d825950b04bb5a12b7.zip ipwndfu.zip 1f5dd30102b968ceb1f8ed361b265011e6daed98