0

I'm using cm13 on my OnePlus 3, along with systemless SuperSu and suhide. When I update cm (often), I need to flash both SuperSu and suhide. The problem is that cm comes with root access and when updating, makes a su directory in /system/bin/su that suhide detects so that it won't install. I need to delete that directory in between of the flashes, and I would like to make a script that does that for me when i flash it so that I can flash all files together on update using CyanDelta. I know that this is possible because I have seen other zips that execute command scripts as i flash them.

1 Answer 1

0

Find an empty flashable package somewhere; edit META-INF/com/google/android/updater-script and add delete_recursive("/path/to/your/directory"); to remove the directory in question.

(On second thought, is it really necessary to make a flashable zip for this single purpose? If your phone has TWRP recovery available, why not just use its built-in file manager?)

9
  • 1
    OP could also make their own flashable ZIP, with the structure META-INF/com/google/android, create an update-binary file inside the last directory and write #!/sbin/sh, followed by mount -o rw /partition_name and rm -rf /path/to/your/directory inside the file. Finally, just zip the META-INF folder and here's the flashable ZIP.
    – Grimoire
    Commented Oct 13, 2016 at 10:54
  • 1
    @DeathMaskSalesman Wow, I don't know you could actually write update-binary yourself (the ones I've seen are mostly in unreadable format, except for SuperSU's). Thanks for the info.
    – Andy Yan
    Commented Oct 13, 2016 at 11:22
  • In fact, the classical update-binary is a compiled binary, just like a sh. The workaround for those which want more flexibility is just to write the file as a simple shell script, and by doing so you can also ignore the updater-script.
    – Grimoire
    Commented Oct 13, 2016 at 11:38
  • @DeathMaskSalesman How can a binary be replaced by a script? It sounds weird to me that this is even feasible.
    – Andy Yan
    Commented Oct 13, 2016 at 12:37
  • 1
    Ah, I don't know the procedure employed by a recovery. Still, if you don't believe me, you're free to unpack a CyanogenMod flashable ZIP and examine its update-binary. For instance, the one I analyzed began with the bytes 7F 45 4C 46, which stand for .ELF, identifying the file as a compiled binary.
    – Grimoire
    Commented Oct 13, 2016 at 12:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .