Skip to content

Commit

Permalink
Merge "Build: Switch to Magisk as the built in root [2/2]" into n7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
eyosen authored and Gerrit Code Review committed Feb 11, 2017
2 parents 36fbc6b + 2b25066 commit 95ba5e4
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 95ba5e4

Please sign in to comment.