extract_android_ota_payload
extract_android_ota_payload copied to clipboard
Windows support
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.
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.