Android: sintassi e comandi per il file updater-script di un file update.zip

Di seguito riporto la sintassi dei comandi da inserire nel file updater-script di un file update.zip utilizzato per flashare gli aggiornamenti su una rom Andorid. Il tutto è stato ripreso da XDA, da qui e qui.

Mounting Partition

MTD
mount("MTD", "system", "/system");
mount("MTD", "userdata", "/data");
mount("MTD", "cache", "/cache");
mount("MTD", "sdcard", "/sdcard");
EMMC
mount("ext4", "EMMC", "/dev/block/mountpoint", "/system");
mount("ext4", "EMMC", "/dev/block/mountpoint", "/data");
mount("ext4", "EMMC", "/dev/block/mountpoint", "/cache");
 
mount("ext3", "EMMC", "/dev/block/mountpoint", "/system");
mount("ext3", "EMMC", "/dev/block/mountpoint", "/data");
mount("ext3", "EMMC", "/dev/block/mountpoint", "/cache");
 
mount("ext4", "EMMC", "/dev/block/mmcblk0p23", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p24", "/data");
mount("ext4", "EMMC", "/dev/block/mmcblk0p25", "/cache");

Unmounting Partitions

unmount("/system");
unmount("/data"); OR unmount("/userdata");
unmount("/cache");
unmount("/sdcard");

Format Partitions

format("MTD", "system");
format("MTD", "cache");
format("MTD", "data");
format("MTD", "boot");
 
format("ext4", "EMMC", "/dev/block/mountpoint");
 
format("ext3", "EMMC", "/dev/block/mountpoint");
 
format("ext4", "EMMC", "/dev/block/mmcblk0p23");
format("ext4", "EMMC", "/dev/block/mmcblk0p24");
format("ext4", "EMMC", "/dev/block/mmcblk0p25");
format("ext4", "EMMC", "/dev/block/mmcblk0p22", "/boot");

Copy files from .zip file to phone partition or sd card:

package_extract_dir("Source", "Destination");

Example:

package_extract_dir("system", "/system");
package_extract_dir("data", "/data");
package_extract_dir("sdcard", "/sdcard");

Output a line of text:

ui_print("Text Here");

Delete a file:

delete_recursive("file/path");
delete("/path/to/file");

Run Program

run_program("command", "parameter_1", "parameter_2" [, "parameter_2"[, ... ] ] );

Example:

run_program("/sbin/busybox", "umount", "/sd-ext");

Symbolic Link

symlink("source", "destination")

Example:

symlink("/data/etc/hosts", "/system/etc/hosts")