Edify script language
Edify is the script language for updates that is interpreted by update-binary. It is the successor to the Amend script language.
- The script file must use UNIX newlines as EOL.
- Whitespace (space, tab, LF 0x0a, but not CR 0x0d) may be freely used.
- Comments are any line prefaced with #
- All commands are terminated with a semicolon. Clauses (in ifelse) may contain any number of commands, each terminated with a semicolon.
- Strings are usually delimited with double quotation marks.
- Numbers are really just strings and are usually not delimited.
- Logical values are "t" for true or "" for false.
- The comparison operators are == (string equal), != (string not equal).
- The logical operators are || (logical or), && (logical and), ! (logical not).
- The concatenation operator is +. (Caution: 2+2==22)
- The conditional keywords if, then, else and endif operate as expected. The ifelse macro may be used instead.
- format(type, device)
- mount(type, device, mountpoint)
- package_extract_file(source, destination)
- package_extract_dir(source, destination)
- delete(file) – deletes a file
- delete_recursive(directory) – completely deletes a directory
- symlink(target, link0, ...) – create any number of links to a target
- set_perm(user, group, mode, file) – performs a chown, chmod on a file
- set_perm_recursive(user, group, mode, directory) – performs a chown, chmod on all contents of a directory
- getprop(key) – returns a string value of the associated key from the system properties
- file_getprop(file, key) – returns a string value of the associated key from a specific file
- run_program(program, arg0, ...)
- assert(condition0, ...) – aborts and prints on any false condition
- ifelse(condition, trueclause, falseclause) – conditional, falseclause is optional
- is_substring(substring, string) – checks to see if string constains substring anywhere
- less_than_int(x, y) – checks to see if x<y when considered as integers
- greater_than_int(x, y) – checks to see if x>y when considered as integers
- show_progress(fraction, seconds) – advance progress bar a fractional amount over a period of seconds
- set_progress(fraction) – advance progress bar a fractional amount
- ui_print(message0, ...) – print any number of strings
- sleep(seconds) – pause a number of seconds
Scripts may be tested by executing update-binary directly:
update-binary version output package
An example would be:
update-binary 2 stdout /sdcard/update.zip