Magisk gets uninstalled after each LineageOS update. So this little bash script run from a computer is used to reinstall Magisk on your phone.
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.
So now I can update my LineageOS phone every week without any hassle.
My solution is based on the official installation guide of Magisk.
This script is written in bash, so as any bash script it is run with the same permissions than your current user. 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!
Bash is one of the standard shells on Linux and MacOS systems.
If on Windows, you can use the Windows Subsystem for Linux to run it. See this guide to install it.
- Clone this repo somewhere on your computer (ex:
git clone https://github.com/NicolasWebDev/reinstall-magisk-on-lineageos
) - Edit the script to set the
PHONE_ADB_SERIAL_NUMBER
variable at the beginning of the program.
- Download an update of LineageOS on your phone.
- Install the update on your phone. The device should reboot automatically. After this step Magisk is no more installed on your phone.
- Connect your phone to your computer.
- Run
bash reinstall-magisk-on-lineageos
in the root of this project.
The script should be pretty readable and self-explanatory, without any bash knowledge.
To sum it up, it downloads the latest boot.img
corresponding to your device on your pc, transfers it on your phone, uses the Magisk app installed on your phone to patch the boot.img
image, reboots the phone in fastboot mode, then flashes the patched boot image and restarts the device.
See the current issues in the issue tracker of this repo.