Skip to content
This repository was archived by the owner on Mar 6, 2022. It is now read-only.

Windows support #19

Open
mjthompson opened this issue Aug 21, 2020 · 1 comment
Open

Windows support #19

mjthompson opened this issue Aug 21, 2020 · 1 comment

Comments

@mjthompson
Copy link

mjthompson commented Aug 21, 2020

Getting this to work on Windows was a pain.
In the end I accomplished it by installing MinGW.
The relevant code change was on line 78 as follows:
p = subprocess.Popen(['C:\\MinGW\\msys\\1.0\\bin\\'+command+'.exe', '-'], stdout=subprocess.PIPE, stdin=subprocess.PIPE)
Where command is bzcat and xzcat respectively.

There's probably a fancier way to accomplish this using Windows Subsystem for Linux, but I'm not fully across that yet.

@TheArkive
Copy link

TheArkive commented Jun 20, 2021

I got this working by using msys2, adding the X:\msys2\usr\bin to my user PATH environment variable (I suggest the user PATH, not the system PATH.. I refined this approach by making a batch file to act as a sort of proxy to setup the environment:

@ECHO OFF
set PATH=%PATH%;X:\msys2\usr\bin
python %*

This batch file exists in the same folder as python.exe. I called mine pyth.bat. Line 2 is the important one for solving the problem mentioned by @mjthompson without modifying this repo script. Of course replace X:\msys2\usr\bin with the actual path to these binaries on your system. You could put this in the permanent system or user PATH var, but it might conflict with other setups. For me, I have MinGW, MinGW64, msys2, and Cygwin on my system, and they all need separate batch files to load the proper environment without conflicting, so I can't put these in my PATH var permanently.

Assuming you also have Python in the PATH environment variable, Just call this batch like so:

pyth extract_android_ota_payload.py payload.bin dest_folder

So in total, this script doesn't need to change, but users need to be aware that they need to get a hold of binary copies of bzcat and xzcat and then need to specify the location of these binaries in the PATH environment variable. For the benefit of noobs trying to understand this, there are several sources you can get these from:

  • MinGW / MinGW64
  • Cygwin
  • Msys2
  • any other environment that lets you download windows binaries of linux commands

All of the above list are actual programs you download (package managers), and you then select the packages you want. I can't imagine the repo owner actually making a full tutorial on this, because this can get in-depth, but it's not hard to experiment with these environments. These environments are usually self contained, and you can generally just delete the folder and start from scratch and try again to get the setup you are looking for.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants