Please remember to add a category to the bottom of each page that you create.
See categories help for further details, but most will probably be [[Category:HTC ModelName]].

Edify script language

From XDA-Developers
Revision as of 09:14, 15 September 2020 by Eladkarako (Talk | contribs) (File operations)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Edify is the script language for updates that is interpreted by update-binary. It is the successor to the Amend script language.


  • Syntax errors will result in this script not running (Installer skips right over it. In comparison, if Aroma Installer has a syntax error, phone will boot right past Installer into Android as if it never happened but VERY quickly show an error)
  • The script file must use UNIX newlines as EOL.
  • Whitespace (space, tab, LF 0x0a, but not CR 0x0d) may be freely used. EXCEPT last line cannot be a blank line!
  • 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.
  • The characters \n, \t, \", and \\ are understood, as are hexadecimal escapes like \x4a
  • 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 if they are unquoted. The ifelse macro may be used instead.


Disk operations

  • format(fs_type, partition_type, device, fs_size, mountpoint) - usually use "0" for fs_size (entire partition)
  • mount(fs_type, partition_type, device, mountpoint)
  • unmount(mountpoint)
  • is_mounted(mountpoint)
  • wipe_cache()

Image operations

  • write_raw_image(filename, device)
  • write_firmware_image

File operations

  • package_extract_file(source, destination) - returns "t" on success and "" on failure (e.g. if the file does not exist in the archive)
  • 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, directory-mode, files-mode, directory) – performs a chown, chmod on the directory itself, and 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
  • sha1_check(file) - return sha1 hash of file
  • sha1_check(file, sha1_hex, [sha1_hex2, ...]) - return the hash which matches or "" if none matches

Patching operations

  • apply_patch(srcfile, tgtfile, tgtsha1, tgtsize, sha1_1, patch_1, ...)
  • apply_patch_check(file, [sha1_1, ...])
  • apply_patch_space(bytes)
  • run_program(program, arg0, ...) - returns the exit code of the program


  • assert(condition0, ...) – aborts and prints on any false condition
  • abort(message)
  • 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

User feedback

  • 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/

See also


Inside OTA packages -- Google explanation on OTA packages, contains an extensive edify language reference.