Untested MSYS MinGW64 support

This commit is contained in:
LukeeGD 2020-08-25 14:42:57 +08:00
parent d823cfcb0d
commit 3e340b5e75

View File

@ -38,27 +38,34 @@ function Main {
futurerestore2="${futurerestore2}_bionic" futurerestore2="${futurerestore2}_bionic"
tsschecker="${tsschecker}_bionic" tsschecker="${tsschecker}_bionic"
fi fi
elif [[ $OSTYPE == "darwin"* ]]; then else
platform='macos' if [[ $OSTYPE == "darwin"* ]]; then
bspatch="resources/tools/bspatch_macos" platform='macos'
ideviceenterrecovery="resources/libimobiledevice/ideviceenterrecovery" lsusb="system_profiler SPUSBDataType 2>/dev/null"
ideviceinfo="resources/libimobiledevice/ideviceinfo" elif [[ $(uname -s) == "MINGW64_NT"* ]]; then
iproxy="resources/libimobiledevice/iproxy" platform='win'
irecovery="resources/tools/irecovery_macos" lsusb="wmic path Win32_USBControllerDevice get Dependent"
lsusb="system_profiler SPUSBDataType 2>/dev/null" ping="ping -n 1"
fi
bspatch="resources/tools/bspatch_$platform"
ideviceenterrecovery="resources/libimobiledevice_$platform/ideviceenterrecovery"
ideviceinfo="resources/libimobiledevice_$platform/ideviceinfo"
iproxy="resources/libimobiledevice_$platform/iproxy"
irecovery="resources/libimobiledevice_$platform/irecovery"
python="python" python="python"
futurerestore1="resources/tools/futurerestore1_macos" futurerestore1="resources/tools/futurerestore1_$platform"
futurerestore2="resources/tools/futurerestore2_macos" futurerestore2="resources/tools/futurerestore2_$platform"
tsschecker="resources/tools/tsschecker_macos" tsschecker="resources/tools/tsschecker_$platform"
fi fi
partialzip="resources/tools/partialzip_$platform" partialzip="resources/tools/partialzip_$platform"
[[ ! $ping ]] && ping="ping -c1"
[[ ! $platform ]] && Error "OSTYPE unknown/not supported." "Supports Linux and macOS only" [[ ! $platform ]] && Error "Platform unknown/not supported."
[[ ! $(ping -c1 google.com 2>/dev/null) ]] && Error "Please check your Internet connection before proceeding." [[ ! $($ping google.com 2>/dev/null) ]] && Error "Please check your Internet connection before proceeding."
[[ $(uname -m) != 'x86_64' ]] && Error "Only x86_64 distributions are supported. Use a 64-bit distro and try again" [[ $(uname -m) != 'x86_64' ]] && Error "Only x86_64 distributions are supported. Use a 64-bit distro and try again"
DFUDevice=$($lsusb | grep -c '1227') DFUDevice=$($lsusb | grep -ci '1227')
RecoveryDevice=$($lsusb | grep -c '1281') RecoveryDevice=$($lsusb | grep -ci '1281')
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
InstallDependencies InstallDependencies
@ -244,7 +251,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 -c '1227') DFUDevice=$($lsusb | grep -ci '1227')
sleep 2 sleep 2
done done
Log "Found device in DFU mode." Log "Found device in DFU mode."
@ -252,12 +259,12 @@ function kDFU {
} }
function Recovery { function Recovery {
RecoveryDevice=$($lsusb | grep -c '1281') RecoveryDevice=$($lsusb | grep -ci '1281')
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 -c '1281') RecoveryDevice=$($lsusb | grep -ci '1281')
sleep 2 sleep 2
done done
fi fi
@ -276,7 +283,7 @@ function Recovery {
echo -e "\n* Release POWER and hold HOME button for 10 seconds." echo -e "\n* Release POWER and hold HOME button for 10 seconds."
for i in {10..01}; do for i in {10..01}; do
echo -n "$i " echo -n "$i "
DFUDevice=$($lsusb | grep -c '1227') DFUDevice=$($lsusb | grep -ci '1227')
[[ $DFUDevice == 1 ]] && CheckM8 [[ $DFUDevice == 1 ]] && CheckM8
sleep 1 sleep 1
done done
@ -289,7 +296,7 @@ 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 -c 'checkm8') pwnDFUDevice=$(sudo $lsusb -v -d 05ac:1227 2>/dev/null | grep -ci 'checkm8')
if [ $pwnDFUDevice == 1 ]; then if [ $pwnDFUDevice == 1 ]; then
Log "Device in pwnDFU mode detected." Log "Device in pwnDFU mode detected."
if [[ $A7Device == 1 ]]; then if [[ $A7Device == 1 ]]; then
@ -363,7 +370,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 -c '1281') RecoveryDevice=$($lsusb | grep -ci '1281')
if [[ $RecoveryDevice != 1 ]]; then if [[ $RecoveryDevice != 1 ]]; then
echo "[Error] Failed to detect device in pwnREC mode." echo "[Error] 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"
@ -371,7 +378,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 -c '1281') RecoveryDevice=$($lsusb | grep -ci '1281')
sleep 2 sleep 2
done done
fi fi
@ -381,7 +388,7 @@ function Downgrade {
Log "Preparing for futurerestore... (Enter root password of your PC/Mac when prompted)" Log "Preparing for futurerestore... (Enter root password of your PC/Mac when prompted)"
cd resources cd resources
sudo bash -c "$python -m SimpleHTTPServer 80 &" [[ $platform != win ]] && sudo bash -c "$python -m SimpleHTTPServer 80 &" || python3 -m http.server --bind 127.0.0.1 80 &
cd .. cd ..
if [ $Baseband == 0 ]; then if [ $Baseband == 0 ]; then
@ -482,17 +489,29 @@ function InstallDependencies {
# macOS # macOS
xcode-select --install xcode-select --install
SaveFile https://github.com/libimobiledevice-win32/imobiledevice-net/releases/download/v1.3.4/libimobiledevice.1.2.1-r1079-osx-x64.zip libimobiledevice.zip 2812e01fc7c09b5980b46b97236b2981dbec7307 SaveFile https://github.com/libimobiledevice-win32/imobiledevice-net/releases/download/v1.3.4/libimobiledevice.1.2.1-r1079-osx-x64.zip libimobiledevice.zip 2812e01fc7c09b5980b46b97236b2981dbec7307
rm -rf ../resources/libimobiledevice
mkdir ../resources/libimobiledevice elif [[ $platform == "win" ]]; then
unzip libimobiledevice.zip -d ../resources/libimobiledevice # Windows MSYS2 MinGW64
chmod +x ../resources/libimobiledevice/* pacman -Sy --noconfirm --needed mingw-w64-x86_64-python openssh unzip
SaveFile https://github.com/libimobiledevice-win32/imobiledevice-net/releases/download/v1.3.4/libimobiledevice.1.2.1-r1079-win-x64.zip libimobiledevice.zip 6d23f7d28e2212d9acc0723fe4f3fdec8e2ddeb8
if [[ ! $(ls resources/tools/*win) ]]; then
SaveFile https://github.com/LukeZGD/iOS-OTA-Downgrader/releases/download/tools/tools_win.zip tools_win.zip 92dd493c2128ad81255180b2536445dc1643ed55
unzip tools_win.zip -d ../resources/tools
fi
ln -sf /mingw64/bin/libplist-2.0.dll /mingw64/bin/libplist.dll
else else
Error "Distro not detected/supported by the install script." "See the repo README for supported OS versions/distros" Error "Distro not detected/supported by the install script." "See the repo README for supported OS versions/distros"
fi fi
if [[ $platform == linux ]]; then if [[ $platform == linux ]]; then
Compile libimobiledevice libirecovery Compile libimobiledevice libirecovery
ln -sf /usr/local/lib/libirecovery-1.0.so.3 ../resources/lib/libirecovery-1.0.so.3 ln -sf /usr/local/lib/libirecovery-1.0.so.3 ../resources/lib/libirecovery-1.0.so.3
else
rm -rf ../resources/libimobiledevice_$platform
mkdir ../resources/libimobiledevice_$platform
unzip libimobiledevice.zip -d ../resources/libimobiledevice_$platform
chmod +x ../resources/libimobiledevice_$platform/*
fi fi
Log "Install script done! Please run the script again to proceed" Log "Install script done! Please run the script again to proceed"
@ -633,6 +652,10 @@ function BasebandDetect {
iBEC="iBEC.$iBSS.RELEASE" iBEC="iBEC.$iBSS.RELEASE"
iBSS="iBSS.$iBSS.RELEASE" iBSS="iBSS.$iBSS.RELEASE"
SEP=sep-firmware.$HWModel.RELEASE.im4p SEP=sep-firmware.$HWModel.RELEASE.im4p
if [[ $platform == win ]] && [[ $A7Device == 1 ]]; then
Error "A7 devices are not supported on Windows." "Supports Linux and macOS only"
fi
} }
Main $1 Main $1