android modding (edify)

every updater-script ends with empty line and doesn't start with any initial lines like common programming languages (just make file and literally start programming), every commands from these below ends with a semicolon (famous ' ; ' ) and new line.

getprop(property name) - checks for property in build.prop and returns ts value (eg. device name)

mount("filesystem type", "name of partition", "path to device file", "place it should be mounted") - mounts specified device as a folder. where it'll will be mounted - it depends on device

is_mounted("mount point") - checks if mount point exist in specified directory

unmount("mount point") - unmounts path from device (removes folder which mount command mounted)

format("filesystem type", "name of partition", "path to current device file") - formats selected partition to other or same type. erases content of partition.

ui_print("text") - displays text in user console.

package_extract_dir("folder in recovery.zip", "folder in system") - extracts folders from recovery.zip to system

package_extract_file("file in recovery.zip", "folder to place file into system") - extracts selected file from recovery.zip to system

symlink("symlink name or path", "file path", "optionally other file pathes", "", "" ... ) - symlinks folders or files to a file

delete("file path") - removes files or empty folders

delete_recursive("folder path") - removes files and folders (even non-empty, including its content)

set_perm("user id", "group id", "user permissions", "group permissions", "file or folder path") - changes user's permissions to files and folders (does NOT include subfolders)

set_perm_recursive("user id", "group id", "user permissions", "group permissions", "file or folder path") - changes user's permissions to files and folders (includes subfolders)

show_progress("size of progressbar defined in fraction", "duration - how long") - shows progress in recovery screen (oftenly at bottom)

set_progress("size of progress") - sets recovery' progressbar to defined size

write_raw_image(image.img , partition) - flashes selected partition (same way as bootloader)

wipe_cache() - resets cache (mostly temporary variables, useful to run when script ends)

abort() - leave script alone and leave it (ends script)

sleep(time) - waits specified time

run_program(program path [program args , , , ]) runs a custom bash script with passed arguments (so you can extend edify to custom linux commands)

read_file(path and name) - returns contents of specified file

for comparing is_mounted() and getprop() you can use double & like here:

is_mounted() && extract_package_dir()

where it checks if is_mounted() returns true and extracts files or

is_mounted() || mount()

where it checks if file is not mounted.

to compare output from getprop() we can compare it to a value and then pass to if condition. like here:

 

getprop() == device;

device || abort()

 

will stop if device doesnt match device name.

 

use these, cause otherwise these actions will become useless...

 

if you want to make your own update/recovery zip you need to also sign it and properly package (zip file, no compression/store). basic recovery/update zip contents are here (signed) : https://github.com/hacknorris-aka-penguin/update.zip-twrp-template-modify-update-script using language above and archive (in store mode).

also information - github zip download uses store mode in zip file, so if you'll fork repo and modify you can actually download working update/modification ready to install via custom recovery

Comments