Compare commits
7 Commits
e7d977143f
...
01b95af7f3
Author | SHA1 | Date | |
---|---|---|---|
01b95af7f3 | |||
b99f91cf91 | |||
3d156e3161 | |||
49f51d6069 | |||
b3592929d2 | |||
|
157cfffdba | ||
|
f73cab41d1 |
@ -1,11 +1,9 @@
|
|||||||
FROM debian:stable-slim
|
FROM python:3.9.15-buster
|
||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y \
|
RUN apt-get install -y \
|
||||||
android-tools-adb \
|
android-tools-adb \
|
||||||
android-tools-fastboot \
|
android-tools-fastboot \
|
||||||
python3 \
|
|
||||||
python3-pip
|
|
||||||
RUN pip3 install protobuf
|
RUN pip3 install protobuf
|
||||||
COPY . /magisk
|
COPY . /magisk
|
||||||
WORKDIR /magisk
|
WORKDIR /magisk
|
||||||
|
15
README.md
15
README.md
@ -1,5 +1,7 @@
|
|||||||
# Reinstall Magisk on Lineageos
|
# Reinstall Magisk on Lineageos
|
||||||
|
|
||||||
|
This is a fork.
|
||||||
|
|
||||||
This little bash script is used to reinstall magisk, which gets uninstalled after each LineageOS update.
|
This little bash script is used to reinstall magisk, which gets uninstalled after each LineageOS update.
|
||||||
|
|
||||||
Before I had to patch once more the boot using the Magisk app doing all the steps manually, making some mistakes along the way. Now it takes less than 3 minutes to reinstall magisk (virtually all the time is taken by the download), and without any intervention on my part.
|
Before I had to patch once more the boot using the Magisk app doing all the steps manually, making some mistakes along the way. Now it takes less than 3 minutes to reinstall magisk (virtually all the time is taken by the download), and without any intervention on my part.
|
||||||
@ -15,11 +17,22 @@ Moreover it needs root privileges on your phone to run.
|
|||||||
|
|
||||||
So it may screw up both your computer and your phone, so I invite you to check its source code before running it and using it at your own risks!
|
So it may screw up both your computer and your phone, so I invite you to check its source code before running it and using it at your own risks!
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
|
We use docker to make it fastly reproducible.
|
||||||
|
Steps:
|
||||||
|
|
||||||
|
1. Build <br>
|
||||||
|
```docker build -t magiskupdate .```
|
||||||
|
2. Run <br>
|
||||||
|
```docker run --env ADB_DEVICE=<PUT YOUR ADB ADDR HERE> magiskupdate```
|
||||||
|
|
||||||
|
|
||||||
## Bash
|
## Bash
|
||||||
|
|
||||||
Bash is one of the standard shells on Linux and MacOS systems.
|
Bash is one of the standard shells on Linux and MacOS systems.
|
||||||
|
|
||||||
If on Windows, you can use the [Windows Subsystem for Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) to run it. See [this guide](https://docs.microsoft.com/en-us/windows/wsl/install) to install it.
|
If on Windows, you should run linux.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
@ -42,6 +42,15 @@ get_build_url() {
|
|||||||
head -1
|
head -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_exists_latest_lineageos_build() {
|
||||||
|
# The --location lets curl follow the redirection.
|
||||||
|
curl --location "$(get_build_url)?sha256" --output /tmp/lineageos.sha256
|
||||||
|
hash1=$( awk '{print $1}' lineageos.sha256 )
|
||||||
|
hash2=$( sha256sum lineageos.zip | awk '{print $1}' )
|
||||||
|
[[ "$hash1" =~ "$hash2" ]]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
download_latest_lineageos_build() {
|
download_latest_lineageos_build() {
|
||||||
# The --location lets curl follow the redirection.
|
# The --location lets curl follow the redirection.
|
||||||
curl --location "$(get_build_url)" --output /tmp/lineageos.zip
|
curl --location "$(get_build_url)" --output /tmp/lineageos.zip
|
||||||
@ -63,10 +72,6 @@ extract_boot_image_from_file_based_ota() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
install_python_protobuf() {
|
|
||||||
sudo python3 -m pip install protobuf
|
|
||||||
}
|
|
||||||
|
|
||||||
extract_payload_from_payload_based_ota() {
|
extract_payload_from_payload_based_ota() {
|
||||||
unzip -od /tmp /tmp/lineageos.zip payload.bin
|
unzip -od /tmp /tmp/lineageos.zip payload.bin
|
||||||
}
|
}
|
||||||
@ -76,11 +81,10 @@ generate_random_alnum_string_of_length_6() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extract_boot_image_from_payload_file() {
|
extract_boot_image_from_payload_file() {
|
||||||
install_python_protobuf
|
|
||||||
# For cases in which the repo has already been cloned, I prefer to create a random directory name to clone into, instead of deleting any file or directory on the user's machine.
|
# For cases in which the repo has already been cloned, I prefer to create a random directory name to clone into, instead of deleting any file or directory on the user's machine.
|
||||||
scripts_directory_name="scripts_$(generate_random_alnum_string_of_length_6)"
|
scripts_directory_name="scripts_$(generate_random_alnum_string_of_length_6)"
|
||||||
git clone https://github.com/LineageOS/scripts /tmp/$scripts_directory_name
|
git clone https://github.com/LineageOS/scripts /tmp/$scripts_directory_name
|
||||||
python /tmp/$scripts_directory_name/update-payload-extractor/extract.py --partitions boot --output_dir /tmp/ /tmp/payload.bin
|
python3 /tmp/$scripts_directory_name/update-payload-extractor/extract.py --partitions boot --output_dir /tmp/ /tmp/payload.bin
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_boot_image_from_payload_based_ota() {
|
extract_boot_image_from_payload_based_ota() {
|
||||||
@ -168,8 +172,12 @@ main() {
|
|||||||
is_rooted_debugging_enabled
|
is_rooted_debugging_enabled
|
||||||
print_message "Checking on phone if Magisk is installed"
|
print_message "Checking on phone if Magisk is installed"
|
||||||
check_magisk_app
|
check_magisk_app
|
||||||
print_message "Downloading build archive from $(get_build_url)"
|
if check_exists_latest_lineageos_build; then
|
||||||
download_latest_lineageos_build
|
print_message "Build archive already exists, skipping download"
|
||||||
|
else
|
||||||
|
print_message "Downloading build archive from $(get_build_url)"
|
||||||
|
download_latest_lineageos_build
|
||||||
|
fi
|
||||||
print_message "Extracting 'boot.img' from build archive in /tmp/boot.img"
|
print_message "Extracting 'boot.img' from build archive in /tmp/boot.img"
|
||||||
extract_boot_image
|
extract_boot_image
|
||||||
print_message "Copying from PC to phone the boot image in /sdcard/Download/boot.img"
|
print_message "Copying from PC to phone the boot image in /sdcard/Download/boot.img"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user