Skip to content

Commit 074032e

Browse files
authored
Improve compatibility with different os (#10)
This PR adds: - Handle paths on different OS properly - Alternative commands for windows powershell - Metadata in configs - Minor improvements to configs - Automatically download adb, fastboot and heimdall - Enable packaging the tools in Linux to executable - Update how configs are named and detected - Add parts to README (improved install instructions, licence and used tools)
2 parents bbc46f7 + 32841e1 commit 074032e

14 files changed

Lines changed: 324 additions & 93 deletions

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
install:
2-
sudo apt update && sudo apt install android-tools-adb android-tools-fastboot
2+
curl -sSL https://install.python-poetry.org | python3 -
33
poetry install
4+
poetry run python scripts/download-tools.py
45

56
app:
67
poetry run python openandroidinstaller/openandroidinstaller.py
78

8-
build-app:
9-
poetry run pyinstaller openandroidinstaller/openandroidinstaller.py --noconsole --noconfirm --onefile --icon "/assets/favicon.ico" --add-data "openandroidinstaller/assets:assets"
9+
build-app: install
10+
poetry run pyinstaller openandroidinstaller/openandroidinstaller.py --noconsole --noconfirm --onefile --icon "/assets/favicon.ico" --add-data "openandroidinstaller/assets:assets" --add-binary "openandroidinstaller/bin/adb:bin" --add-binary "openandroidinstaller/bin/fastboot:bin" --add-binary "openandroidinstaller/bin/heimdall:bin"
11+
1012

1113
clean-build:
1214
rm -rf build/ dist/

README.md

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,31 @@ Samsung | Galaxy A5 2016 | a5xelte | | under development
3535
Google | Pixel 3a | sargo | sargo | tested
3636
Sony | Xperia Z | yuga | C6603 | tested
3737
Sony | Xperia Z3 | z3 | | under development
38+
Sony | Xperia ZX | kagura | | under development
39+
Fairphone | Fairphone 2 | FP2 | | under development
40+
41+
42+
## Usage
3843

39-
## Installation
4044
Currently, only linux is supported.
4145

4246
1. Download the AppImage, .exe or appropriate file for your OS.
43-
2. Install `adb` and `fastboot` by running `sudo apt install android-tools-adb android-tools-fastboot`
44-
3. OPTIONAL: Install `heimdall` for Samsung Devices:
45-
- download heimdall: https://androidfilehost.com/?w=files&flid=304516
46-
- install heimdall:
47-
- `$ unzip /path/to/heimdall_ubuntu.zip -d /tmp`
48-
- `$ cp /tmp/bin/heimdall* /usr/bin/`
49-
- `$ rm -rf /tmp/bin`
50-
51-
## Usage
47+
2. Download the lineageOS image and the custom recovery image. A source for files can be found here: https://lineageosroms.com
48+
3. Start the desktop app and follow the instructions.
5249

53-
Download the lineageOS image and the custom recovery image. A source for files can be found here: https://lineageosroms.com
54-
Start the desktop app and follow the instructions.
5550

5651
## Run OpenAndroidInstaller for development
5752

53+
Currently development is only supported on Ubunut Linux. MacOS should also work fine.
54+
5855
1. Clone the main branch of this repository
59-
2. Follow the steps 2. and 3. from 'Installation' above.
60-
3. Run `make poetry` and `make install` to setup poetry and the relevant requirements
61-
4. Run `make app` to start the desktop app from the source.
56+
2. Run `make install` to install poetry to manage python and install the requirend dependencies like adb, fastboot and heimdall.
57+
3. Run `make app` to start the desktop app from the source.
58+
59+
60+
## Contributing
6261

63-
## Contribute your own installation configurations
62+
### Contribute your own installation configurations
6463

6564
If you want to use the tool for a non-supported smartphone, the fastest way is to adapt an [existing config file](https://github.com/openandroidinstaller-dev/openandroidinstaller/tree/main/openandroidinstaller/assets/configs).
6665

@@ -82,8 +81,22 @@ Every step in the config file corresponds to one view in the application. These
8281
After you created a config file, you can open a pull request to make the file available to other users. The file should be named after device name output by `adb shell dumpsys bluetooth_manager | grep 'name:' | cut -c9-` when the devices is connected to the computer. Please also add the device to the supported devices table above.
8382

8483

85-
## Contributing
84+
## Tools
85+
86+
- The [Android SDK Platform Tools](https://developer.android.com/studio/releases/platform-tools) (such as adb and fastboot) are [Apache](https://android.googlesource.com/platform/system/adb/+/refs/heads/master/NOTICE)-licensed universal Android utilities
87+
- [Heimdall](https://gitlab.com/BenjaminDobell/Heimdall/) is an [MIT](https://gitlab.com/BenjaminDobell/Heimdall/-/blob/master/LICENSE)-licensed replacement for the leaked ODIN tool to flash Samsung devices.
88+
8689

8790
## Acknowledgements
8891

89-
* Funded from September 2022 until February 2023 by ![logos of the "Bundesministerium für Bildung und Forschung", Prodotype Fund and OKFN-Deutschland](resources/pf_funding_logos.svg)
92+
* Funded from September 2022 until February 2023 by ![logos of the "Bundesministerium für Bildung und Forschung", Prodotype Fund and OKFN-Deutschland](resources/pf_funding_logos.svg)
93+
94+
95+
## License
96+
Original development by [Tobias Sterbak](https://tobiassterbak.com). Copyright (C) 2022.
97+
98+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
99+
100+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
101+
102+
You should have received a copy of the GNU General Public License along with this program. If not, see [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
metadata:
2+
maintainer: Tobias Sterbak (tsterbak)
3+
devicename: Fairphone 2
4+
requirements:
5+
steps:
6+
- title: "Flash a custom recovery"
7+
type: confirm_button
8+
content: "Now you need to flash a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating, adapting and repairing of the operating system."
9+
- title: "Flash a custom recovery"
10+
type: call_button
11+
content: "Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue."
12+
command: "adb reboot bootloader"
13+
- title: "Flash a custom recovery"
14+
type: call_button
15+
content: "Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue."
16+
command: "fastboot flash recovery <recovery>"
17+
- title: "Flash temporary recovery"
18+
type: call_button
19+
content: "Press the button to reboot. Then confirm here to continue."
20+
command: "fastboot reboot"
21+
- title: "Flash LineageOS"
22+
type: confirm_button
23+
content: "In this step, you finally flash LineageOS. Confirm to continue."
24+
- title: "Flash LineageOS"
25+
type: confirm_button
26+
content: "Select 'Recovery Mode' on your smartphone screen and press the Start-Button to confirm. Then confirm here."
27+
- title: "Flash LineageOS"
28+
type: confirm_button
29+
content: "Now tap Factory Reset, then Format data / Factory reset on your phone screen and continue with the formatting process. This will remove encryption and delete all files stored in the internal storage, as well as format your cache partition (if you have one)."
30+
- title: "Flash LineageOS"
31+
type: confirm_button
32+
content: "Return to the main menu on the phone."
33+
- title: "Flash LineageOS"
34+
type: confirm_button
35+
content: "On the device, select “Apply Update”, then “Apply from ADB” to begin sideload. Then confirm here."
36+
- title: "Flash LineageOS"
37+
type: call_button
38+
content: "Now it's time to flash the LineageOS image. Don't remove the USB-Cable and press 'Confirm and run' to start! This might take a while. Confirm after it's done."
39+
command: "adb sideload <image>"
40+
- title: "Flash LineageOS"
41+
type: confirm_button
42+
content: "Flashing finished. Now press 'back' (arrow) and then 'Reboot system now' on the phone screen to finish the installation."

openandroidinstaller/assets/configs/Samsung Galaxy A5 2016.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.

openandroidinstaller/assets/configs/Samsung Galaxy A3 2017.yaml renamed to openandroidinstaller/assets/configs/a3y17lte.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
metadata:
2+
maintainer: Tobias Sterbak (tsterbak)
3+
devicename: Samsung Galaxy A3 (2017)
4+
requirements:
5+
- heimdall
16
steps:
27
- title: "Boot into bootloader"
38
type: call_button
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
metadata:
2+
maintainer: Tobias Sterbak (tsterbak)
3+
devicename: Samsung Galaxy A5 (2016)
4+
requirements:
5+
- heimdall
6+
steps:
7+
- title: "Boot into bootloader"
8+
type: call_button
9+
content: "As a first step, you need to boot into the bootloader. A bootloader is the piece of software, that tells your phone who to start and run an operating system (like Android). Your device should be turned on. Then press 'Confirm and run' to reboot into the bootloader. Continue once it's done."
10+
command: "adb reboot download"
11+
- title: "Flash custom recovery"
12+
type: call_button
13+
content: "In this step, you need to flash a custom recovery on your device. Press 'Confirm and run' to start the process. Confirm afterwards to continue."
14+
command: "heimdall flash --no-reboot --RECOVERY <recovery>"
15+
- title: "Boot into recovery"
16+
type: confirm_button
17+
content: "Unplug the USB cable from your device. Then manually reboot into recovery by pressing the Volume Down + Power buttons for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, hold Volume Up + Home + Power."
18+
- title: "Flash LineageOS"
19+
type: confirm_button
20+
content: "Now tap 'Wipe' on your phone. Then tap 'Format Data' and continue with the formatting process. This will remove encryption and delete all files stored in the internal storage. Confirm to continue once you are done."
21+
- title: "Flash LineageOS"
22+
type: confirm_button
23+
content: "Return to the previous menu on your phone and tap 'Advanced Wipe', then select the 'Cache' and 'System' partitions and then 'Swipe to Wipe'. Confirm to continue once you are done."
24+
- title: "Flash LineageOS"
25+
type: confirm_button
26+
content: "Now connect the phone to the computer again with the USB-cable. On the device, go back and select “Advanced”, “ADB Sideload”, then swipe to begin sideload. Then confirm here."
27+
- title: "Flash LineageOS"
28+
type: call_button
29+
content: "Now it's time to flash the LineageOS image. Don't remove the USB-Cable and press 'Confirm and run' to start! This might take a while. Confirm after it's done."
30+
command: "adb sideload <image>"
31+
- title: "Reboot into LineageOS"
32+
type: call_button
33+
content: "As a final step, reboot into LineageOS to finish the installation by pressing the button."
34+
command: "adb reboot"

openandroidinstaller/assets/configs/Pixel 3a.yaml renamed to openandroidinstaller/assets/configs/sargo.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
metadata:
2+
maintainer: Tobias Sterbak (tsterbak)
3+
devicename: Pixel 3a
4+
requirements:
15
steps:
26
- title: "Unlock the bootloader"
37
type: confirm_button

openandroidinstaller/assets/configs/Xperia Z.yaml renamed to openandroidinstaller/assets/configs/yuga.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
metadata:
2+
maintainer: Tobias Sterbak (tsterbak)
3+
devicename: Sony Xperia Z
4+
requirements:
15
steps:
26
- title: "Unlock the bootloader"
37
type: confirm_button

openandroidinstaller/installer_config.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,20 @@ def __init__(
3737

3838

3939
class InstallerConfig:
40-
def __init__(self, steps: List[Step]):
40+
def __init__(self, steps: List[Step], metadata: dict):
4141
self.steps = steps
42+
self.metadata = metadata
4243

4344
@classmethod
4445
def from_file(cls, path):
4546
with open(path, "r") as stream:
4647
try:
47-
raw_steps = yaml.safe_load(stream)
48-
raw_steps = dict(raw_steps)["steps"]
48+
raw_config = yaml.safe_load(stream)
49+
config = dict(raw_config)
50+
raw_steps = config["steps"]
51+
metadata = config["metadata"]
4952
except yaml.YAMLError as exc:
5053
print(exc)
5154

5255
steps = [Step(**raw_step) for raw_step in raw_steps]
53-
return cls(steps)
56+
return cls(steps, metadata)

0 commit comments

Comments
 (0)