[Desire 816 Android Development] idhx:
Sure, I'll take a shot at it. But I'm not sure how useful this will be for the script editor, since I basically decided not to meddle with the Android init scripts at all, and just used an app to load the kernel module at each boot.

(Before you try all the steps below, I just want to point out this thread: http://xdaforums.com/desire-816/general/help-mm-root-disable-write-protection-t3334921 I just found it, and it might be the single, flashable zip you are looking for... If somebody else wants to try it.)

If this is relevant at all, I did this on the DWG variant of the phone, CID HTC__038.

1. Flash the latest TWRP bootloader. I used 3.0.3-0, available here: https://dl.twrp.me/a5.

2. Reboot phone into TWRP bootloader. Flash the latest SuperSU. I used 2.65, the latest stable version: https://download.chainfire.eu/921/SuperSU/UPDATE-SuperSU-v2.65-20151226141550.zip

3. Reboot the phone and (optional) confirm that you have have root working, e.g. with the app "Root Checker".

4. Now you need to disable write protection. Download the zip mentioned in my last post, i.e. "m8-mmgpe-wp_mod.zip" from http://xdaforums.com/htc-one-m8/general/root-root-marshmallow-gpe-supersu-t3242210. There is one file that you want inside that zip archive, which is called "wp_mod.ko". It is in the following sub-directory in the zip archive: system/lib/modules/wp_mod.ko.

5. Transfer this wp_mod.ko file to your phone to any directory you want. I'll assume you transfer it to "/storage/emulated/0/", but really you could put it anywhere.

6. Fire up a terminal on your phone. I use the terminal included in the app "Rom Toolbox Pro", but you could use any terminal app available on the Play store. A popular choice is "Terminal Emulator for Android".

7. Now you need to enter a bunch of commands in the terminal on your phone. Hit the return key after each command. Start with "su" to gain root privileges. The supersu App will ask you to grant root permissions to the terminal app, go ahead and grant them.

8. Now enter the command "insmod /storage/emulate/0/wp_mod.ko" (or replace the second part with the path to the wp_mod.ko file where you transferred it to your phone, in step 5.)

9. Verify that the file has been loaded: use the command "lsmod", and check that there is a line which starts with "wp_mod" in the output. (There will be other lines, you can ignore those. If this works, congratulations, you have disabled write-protection... ...until the next reboot.

10. Now you want to disable the write-protection automatically at each boot. For this, install the app "Script Manager - SManager" from the play store. Open the app.

11. In SManager, you want to create a new script. You can store it anywhere on your phone. Use the icon with three vertical dots in the upper right corner and choose the option "New Script". You are prompted for a filename or URL, enter "wp_mod.sh". If you are then prompted with an "Open With" dialog, choose SM Editor.

12. You will see a text file which you can edit. The first line in the file is "#!/system/bin/sh". Do not change this. On a NEW line below this, write the same command as you used in step 8. So following our example, our file would look like

#!/system/bin/sh
insmod /storage/emulate/0/wp_mod.ko

Save the file. (Three dots in upper right -> save). Close it (X at the very upper right)

13. Now you are back SManager. Scroll down and search for the script you just created, called "wp_mod.sh". Press on this file once. In the window that opens, there are a few buttons (Run, Exit, Edit, Save). Below this are Icons that can be activated or de-activated. You want to activate the one with the "Su" label (second from the left) and the one with the "Boot" label (third from the left). Then press the Save Button.

14. All done. If you want to make sure everything is working, reboot, start up your terminal again, and check that when you use the "insmod" command, one of the lines it spits out starts with "wp_mod". Or, more obviously, just try any operation you could only do with write-protection disabled.

Wow, lots of rambling for just a few operations. This is the first time I give out such detailed explanations for this kind of process. Hope it will be clear and helpful. If not, my apologies.

---------- Post added at 04:03 PM ---------- Previous post was at 03:58 PM ----------

I used that command in a Terminal app on my phone. See steps 6-8 in the long explanation in my last post.