You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: functionality to pass image as argument, better error handling, and debugging
List of changes:
* Determine runtime environment by checking for Termux-specific environment variable. Otherwise, set $DEBUG variable and start shell debugging for Magisk.
* Modify find_boot_image():
- Check whether $DEBUG variable was set and true, if not, assume running in Termux and further handle passed image as an argument or search for image in the current directory if no argument is provided.
- Return specific error codes at various failure points, replacing the previous singular error handling for ZIP extraction failure using exit_with_error(), which was also not terminating the script correctly with the actual error message!
* Enhance exit_with_error():
- Add optional parameter for custom exit status code.
- Use provided status code to terminate the script instead of always exiting with 1.
* Update main():
- Improve error handling using a case statement for each error code returned by find_boot_image().
- Ensure proper display of error messages and script termination.
- Accept image as an argument and pass it to find_boot_image when invoked.
- Display provided image name when flashing to the boot block.
* Minor structural changes and better code organization, including more context-appropriate variable names and slight adjustments to initialization in device detection logic.
Signed-off-by: Abhijeet <98699436+gitclone-url@users.noreply.github.com>
Boot Image Flasher is a shell script developed to simplify the process of flashing boot images on Android devices, supporting both A/B and legacy (non-A/B) devices. Typically, flashing boot images involves using custom recovery or fastboot, which can be complex and time-consuming. This script eliminates the need for those methods, offering a straightforward, efficient, and user-friendly solution.
12
+
Boot Image Flasher is a shell script designed to simplify the process of flashing boot images on Android devices, supporting both A/B and legacy (non-A/B) devices. typically, flashing boot images involves using custom recovery or fastboot, which can be complex and time-consuming. This script eliminates the need for those methods, offering a straightforward, efficient, and user-friendly solution.
13
13
14
14
### Key Features
15
15
16
16
-**Automated and User-Friendly:** Simplifies the boot image flashing process with minimal user intervention.
17
17
-**Broad Device Support:** Compatible with any Android device, including both A/B and legacy (non-A/B) partition styles.
18
18
-**Saves Time and Effort:** Reduces the time and complexity involved in flashing boot images using fastboot or custom recoveries, making it accessible for users with varying levels of technical expertise.
19
-
-**Flexible Usage:** Can be used via Termux or as a Magisk module, providing flexibility based on user preferences.
19
+
-**Flexible Usage:** Can be used via Termux or flashed as a Magisk module, providing flexibility based on user preferences.
20
20
21
21
### Prerequisites
22
22
@@ -28,17 +28,23 @@ Boot Image Flasher is a shell script developed to simplify the process of flashi
28
28
#### Method 1: Via Termux
29
29
30
30
1. Open [Termux](https://github.com/termux/termux-app) on your Android device.
31
-
2. Navigate to the directory where the boot image file is located using `cd`. For example:
31
+
2. Navigate to the directory where you want to download the script using `cd`. For example:
32
32
```bash
33
33
cd /storage/emulated/0/Download
34
34
```
35
-
3.Copy and paste the following command and hit enter to start running the script:
35
+
3.Download the script and necessary tools using the following command:
> **Note:** It may take some time to run for the first time because the script will be downloaded first along with the required tools. Please be patient.
39
+
> **Note:** It may take some time for the script to be downloaded first along with the required tools. Please be patient.
40
40
41
-
4. Restart your device after the flashing process is complete.
41
+
4. Run the script by executing:
42
+
```bash
43
+
sudo bash boot-img-flasher.sh
44
+
```
45
+
> **Optional Argument:** You can also specify the path to your boot image as an argument. If you don't provide one, the script will search for the boot image in the current directory.
46
+
47
+
5. Restart your device after the flashing process is complete.
42
48
43
49
#### Method 2: Magisk
44
50
@@ -72,7 +78,7 @@ This script is intended for advanced users only. Improper use of this script can
72
78
73
79
### Credits
74
80
75
-
Special thanks to [topjhonwu](https://github.com/topjohnwu) for [Magisk](https://github.com/topjohnwu/Magisk) and its general utility functions.
81
+
Special thanks to [topjohnwu](https://github.com/topjohnwu) for [Magisk](https://github.com/topjohnwu/Magisk) and its general utility functions.
0 commit comments