Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Build: Switch to Magisk as the built in root [2/2]
Pretty much identical to DirtyUnicorns/android_build@2871a7b

Modified and updated for TWRP 3.0.3-x by @nathanchance

Change-Id: Ic0cc0b6e96723a87298edb5cded9f6ef93c05b9d
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
  • Loading branch information
LorDClockaN authored and Miccia94 committed Feb 6, 2017
1 parent 1d2522f commit 2b25066
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/releasetools/edify_generator.py
Expand Up @@ -173,6 +173,11 @@ def ValidateSignatures(self, command):
def RunPersist(self, command):
self.script.append(('run_program("/tmp/install/bin/persist.sh", "%s");' % command))

def FlashMagisk(self):
self.script.append('package_extract_dir("magisk", "/tmp/magisk");')
self.script.append('run_program("/sbin/busybox", "unzip", "/tmp/magisk/magisk.zip", "META-INF/com/google/android/*", "-d", "/tmp/magisk");')
self.script.append('run_program("/sbin/sh", "/tmp/magisk/META-INF/com/google/android/update-binary", "dummy", "1", "/tmp/magisk/magisk.zip");')

def ShowProgress(self, frac, dur):
"""Update the progress bar, advancing it over 'frac' over the next
'dur' seconds. 'dur' may be zero to advance it via SetProgress
Expand Down
8 changes: 8 additions & 0 deletions tools/releasetools/ota_from_target_files.py
Expand Up @@ -800,6 +800,14 @@ def output_sink(fn, data):
script.ShowProgress(0.05, 5)
script.WriteRawImage("/boot", "boot.img")

if block_based:
script.Print(" ")
script.Print("Flashing Magisk...")
script.Print(" ")
common.ZipWriteStr(output_zip, "magisk/magisk.zip",
""+input_zip.read("SYSTEM/addon.d/magisk.zip"))
script.FlashMagisk()
script.Print(" ")
script.ShowProgress(0.2, 10)
device_specific.FullOTA_InstallEnd()

Expand Down

0 comments on commit 2b25066

Please sign in to comment.