mirror of
https://github.com/LukeZGD/Legacy-iOS-Kit.git
synced 2024-11-30 11:54:18 +01:00
Use irecovery instead of lsusb/system_profiler
for #54 - Also change 10 seconds to 8 seconds for entering DFU - Also remove firmware and ipwndfu folders on depends install
This commit is contained in:
parent
be4fcb5a70
commit
4a2435c007
42
restore.sh
42
restore.sh
@ -44,7 +44,6 @@ function Main {
|
|||||||
ideviceinfo="ideviceinfo"
|
ideviceinfo="ideviceinfo"
|
||||||
iproxy="iproxy"
|
iproxy="iproxy"
|
||||||
irecovery="sudo resources/tools/irecovery_linux"
|
irecovery="sudo resources/tools/irecovery_linux"
|
||||||
lsusb="lsusb"
|
|
||||||
python="python2"
|
python="python2"
|
||||||
futurerestore1="sudo LD_PRELOAD=resources/lib/libcurl.so.3 LD_LIBRARY_PATH=resources/lib resources/tools/futurerestore1_linux"
|
futurerestore1="sudo LD_PRELOAD=resources/lib/libcurl.so.3 LD_LIBRARY_PATH=resources/lib resources/tools/futurerestore1_linux"
|
||||||
futurerestore2="sudo LD_LIBRARY_PATH=resources/lib resources/tools/futurerestore2_linux"
|
futurerestore2="sudo LD_LIBRARY_PATH=resources/lib resources/tools/futurerestore2_linux"
|
||||||
@ -53,7 +52,6 @@ function Main {
|
|||||||
|
|
||||||
elif [[ $OSTYPE == "darwin"* ]]; then
|
elif [[ $OSTYPE == "darwin"* ]]; then
|
||||||
platform="macos"
|
platform="macos"
|
||||||
lsusb="system_profiler SPUSBDataType 2>/dev/null"
|
|
||||||
bspatch="resources/tools/bspatch_$platform"
|
bspatch="resources/tools/bspatch_$platform"
|
||||||
ideviceenterrecovery="resources/libimobiledevice_$platform/ideviceenterrecovery"
|
ideviceenterrecovery="resources/libimobiledevice_$platform/ideviceenterrecovery"
|
||||||
ideviceinfo="resources/libimobiledevice_$platform/ideviceinfo"
|
ideviceinfo="resources/libimobiledevice_$platform/ideviceinfo"
|
||||||
@ -73,12 +71,14 @@ function Main {
|
|||||||
SaveExternal iOS-OTA-Downgrader-Keys
|
SaveExternal iOS-OTA-Downgrader-Keys
|
||||||
SaveExternal ipwndfu
|
SaveExternal ipwndfu
|
||||||
|
|
||||||
DFUDevice=$($lsusb | grep -ci '1227')
|
[[ $($irecovery -q | grep 'MODE' | cut -c 7-) == "DFU" ]] && DFUDevice=1
|
||||||
RecoveryDevice=$($lsusb | grep -ci '1281')
|
[[ $($irecovery -q | grep 'MODE' | cut -c 7-) == "Recovery" ]] && RecoveryDevice=1
|
||||||
|
|
||||||
if [[ $1 == Install ]] || [ ! $(which $bspatch) ] || [ ! $(which $ideviceinfo) ] ||
|
if [[ $1 == Install ]] || [ ! $(which $bspatch) ] || [ ! $(which $ideviceinfo) ] ||
|
||||||
[ ! $(which git) ] || [ ! $(which ssh) ] || [ ! $(which $python) ]; then
|
[ ! $(which git) ] || [ ! $(which ssh) ] || [ ! $(which $python) ]; then
|
||||||
|
rm -rf resources/firmware resources/ipwndfu
|
||||||
InstallDependencies
|
InstallDependencies
|
||||||
elif [ $DFUDevice == 1 ] || [ $RecoveryDevice == 1 ]; then
|
elif [[ $DFUDevice == 1 ]] || [[ $RecoveryDevice == 1 ]]; then
|
||||||
ProductType=$($irecovery -q | grep 'PTYP' | cut -c 7-)
|
ProductType=$($irecovery -q | grep 'PTYP' | cut -c 7-)
|
||||||
[ ! $ProductType ] && read -p "[Input] Enter ProductType (eg. iPad2,1): " ProductType
|
[ ! $ProductType ] && read -p "[Input] Enter ProductType (eg. iPad2,1): " ProductType
|
||||||
UniqueChipID=$((16#$(echo $($irecovery -q | grep 'ECID' | cut -c 7-) | cut -c 3-)))
|
UniqueChipID=$((16#$(echo $($irecovery -q | grep 'ECID' | cut -c 7-) | cut -c 3-)))
|
||||||
@ -189,7 +189,7 @@ function Action {
|
|||||||
read -p "$(Input 'Path to IPSW (drag IPSW to terminal window): ')" IPSW
|
read -p "$(Input 'Path to IPSW (drag IPSW to terminal window): ')" IPSW
|
||||||
IPSW="$(basename $IPSW .ipsw)"
|
IPSW="$(basename $IPSW .ipsw)"
|
||||||
read -p "$(Input 'Path to SHSH (drag SHSH to terminal window): ')" SHSH
|
read -p "$(Input 'Path to SHSH (drag SHSH to terminal window): ')" SHSH
|
||||||
elif [[ $A7Device == 1 ]] && [[ $pwnDFUDevice != 1 ]]; then
|
elif [[ $A7Device == 1 ]] && [[ $pwnDFUDevice != 0 ]]; then
|
||||||
[[ $DFUDevice == 1 ]] && CheckM8 || Recovery
|
[[ $DFUDevice == 1 ]] && CheckM8 || Recovery
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ function kDFU {
|
|||||||
|
|
||||||
Log "Finding device in DFU mode..."
|
Log "Finding device in DFU mode..."
|
||||||
while [[ $DFUDevice != 1 ]]; do
|
while [[ $DFUDevice != 1 ]]; do
|
||||||
DFUDevice=$($lsusb | grep -ci '1227')
|
[[ $($irecovery -q | grep 'MODE' | cut -c 7-) == "DFU" ]] && DFUDevice=1
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
Log "Found device in DFU mode."
|
Log "Found device in DFU mode."
|
||||||
@ -273,12 +273,12 @@ function kDFU {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Recovery {
|
function Recovery {
|
||||||
RecoveryDevice=$($lsusb | grep -ci '1281')
|
[[ $($irecovery -q | grep 'MODE' | cut -c 7-) == "Recovery" ]] && RecoveryDevice=1
|
||||||
if [[ $RecoveryDevice != 1 ]]; then
|
if [[ $RecoveryDevice != 1 ]]; then
|
||||||
Log "Entering recovery mode..."
|
Log "Entering recovery mode..."
|
||||||
$ideviceenterrecovery $UniqueDeviceID >/dev/null
|
$ideviceenterrecovery $UniqueDeviceID >/dev/null
|
||||||
while [[ $RecoveryDevice != 1 ]]; do
|
while [[ $RecoveryDevice != 1 ]]; do
|
||||||
RecoveryDevice=$($lsusb | grep -ci '1281')
|
[[ $($irecovery -q | grep 'MODE' | cut -c 7-) == "Recovery" ]] && RecoveryDevice=1
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -289,18 +289,18 @@ function Recovery {
|
|||||||
$irecovery -n
|
$irecovery -n
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
Echo "* Hold POWER and HOME button for 10 seconds."
|
Echo "* Hold POWER and HOME button for 8 seconds."
|
||||||
for i in {10..01}; do
|
for i in {08..01}; do
|
||||||
echo -n "$i "
|
echo -n "$i "
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
echo -e "\n$(Echo '* Release POWER and hold HOME button for 10 seconds.')"
|
echo -e "\n$(Echo '* Release POWER and hold HOME button for 8 seconds.')"
|
||||||
for i in {10..01}; do
|
for i in {08..01}; do
|
||||||
echo -n "$i "
|
echo -n "$i "
|
||||||
DFUDevice=$($lsusb | grep -ci '1227')
|
sleep 1
|
||||||
|
done
|
||||||
|
[[ $($irecovery -q | grep 'MODE' | cut -c 7-) == "DFU" ]] && DFUDevice=1
|
||||||
[[ $DFUDevice == 1 ]] && CheckM8
|
[[ $DFUDevice == 1 ]] && CheckM8
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
Error "Failed to detect device in DFU mode. Please run the script again"
|
Error "Failed to detect device in DFU mode. Please run the script again"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,8 +310,8 @@ function CheckM8 {
|
|||||||
Log "Entering pwnDFU mode with ipwndfu..."
|
Log "Entering pwnDFU mode with ipwndfu..."
|
||||||
cd resources/ipwndfu
|
cd resources/ipwndfu
|
||||||
sudo $python ipwndfu -p
|
sudo $python ipwndfu -p
|
||||||
pwnDFUDevice=$(sudo $lsusb -v -d 05ac:1227 2>/dev/null | grep -ci 'checkm8')
|
pwnDFUDevice=$?
|
||||||
if [ $pwnDFUDevice == 1 ]; then
|
if [[ $pwnDFUDevice == 0 ]]; then
|
||||||
Log "Device in pwnDFU mode detected."
|
Log "Device in pwnDFU mode detected."
|
||||||
if [[ $A7Device == 1 ]]; then
|
if [[ $A7Device == 1 ]]; then
|
||||||
Log "Running rmsigchks.py..."
|
Log "Running rmsigchks.py..."
|
||||||
@ -324,7 +324,7 @@ function CheckM8 {
|
|||||||
Mode='Downgrade'
|
Mode='Downgrade'
|
||||||
SelectVersion
|
SelectVersion
|
||||||
else
|
else
|
||||||
Error "Failed to detect device in pwnDFU mode. Please run the script again" "./restore.sh Downgrade"
|
Error "Failed to enter pwnDFU mode. Please run the script again" "./restore.sh Downgrade"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ function Downgrade {
|
|||||||
$irecovery -f $iBSS.im4p
|
$irecovery -f $iBSS.im4p
|
||||||
$irecovery -f $iBEC.im4p
|
$irecovery -f $iBEC.im4p
|
||||||
sleep 5
|
sleep 5
|
||||||
RecoveryDevice=$($lsusb | grep -ci '1281')
|
[[ $($irecovery -q | grep 'MODE' | cut -c 7-) == "Recovery" ]] && RecoveryDevice=1
|
||||||
if [[ $RecoveryDevice != 1 ]]; then
|
if [[ $RecoveryDevice != 1 ]]; then
|
||||||
echo -e "\n$(Log 'Failed to detect device in pwnREC mode.')"
|
echo -e "\n$(Log 'Failed to detect device in pwnREC mode.')"
|
||||||
Echo "* If you device has backlight turned on, you may try re-plugging in your device and attempt to continue"
|
Echo "* If you device has backlight turned on, you may try re-plugging in your device and attempt to continue"
|
||||||
@ -399,7 +399,7 @@ function Downgrade {
|
|||||||
read -s
|
read -s
|
||||||
Log "Finding device in pwnREC mode..."
|
Log "Finding device in pwnREC mode..."
|
||||||
while [[ $RecoveryDevice != 1 ]]; do
|
while [[ $RecoveryDevice != 1 ]]; do
|
||||||
RecoveryDevice=$($lsusb | grep -ci '1281')
|
[[ $($irecovery -q | grep 'MODE' | cut -c 7-) == "Recovery" ]] && RecoveryDevice=1
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user