PowerShell script to download current LineageOS build, extract boot image, patch with Magisk, and flash patched boot image to Android device.
Based on a bash script by NicolasWebDev, which itself is based on the Magisk installation guide.
Due to the lack of native USB support in Windows Subsystem for Linux (WSL), I ported the script to PowerShell and added some additional error checking for Windows users to easily upgrade LineageOS and repatch the boot image with Magisk.
-
Open
'Settings > System > Updater'
on your LineageOS device. Download and install an update. -
Reboot device and Magisk will show as no longer installed.
-
Connect your device to your computer.
-
Open a PowerShell prompt on your computer.
-
Download or clone the repository.
PS> git clone http://github.com/richardlock/Install-LineageMagiskPatchedBootImage
-
Get the device serial number of the connected LineageOS device.
PS> adb devices List of devices attached ABCD123456 device
-
Execute the script specifying the device serial number.
.\Install-LineageMagiskPatchedBootImage.ps1 -DeviceSerialNumber 'ABCD123456'
Android device requirements:
- LineageOS.
- Magisk.
- Rooted debugging enabled.
Windows device requirements:
- Android SDK Platform-Tools 'adb' and 'fastboot' (https://developer.android.com/studio/releases/platform-tools).
- Python 3 (https://www.python.org/downloads).
- PowerShell Logging module (https://www.powershellgallery.com/packages/Logging).