diff --git a/build.gradle b/build.gradle index 02c58ac..0c58785 100644 --- a/build.gradle +++ b/build.gradle @@ -216,3 +216,29 @@ task _setup(type: Copy) { into '.' } +void Run(List inCmd) { + println("CMD: " + inCmd) + ProcessBuilder pb = new ProcessBuilder(inCmd) + .directory(new File(".")) + .redirectErrorStream(true); + Process p = pb.start() + p.inputStream.eachLine {println it} + p.waitFor(); + assert 0 == p.exitValue() +} + +void Run(String inCmd) { + Run(Arrays.asList(inCmd.split())) +} + + +void updateBootImage() { + Run("adb root") + Run("adb push boot.img.signed /cache/") + List cmd2 = ["adb", "shell", "dd if=/cache/boot.img.signed of=/dev/block/by-name/boot"]; + Run(cmd2) +} + +task flash << { + updateBootImage() +}