[EVO 4G General] Karadorde:
First and foremost I take no credit for the majority of this thread. I am merely posting this here as a reference for you all. I had to dig around a lot for this information and piece it together from several different threads as well as pull examples from updater-scripts in several different roms/theme/etc. Everyone else put in the work, I am just trying to make it easier for the rest of us :D.

Mounting Partitions:

MTD:

mount("MTD", "system", "/system");
mount("MTD", "userdata", "/data");
mount("MTD", "cache", "/cache");
mount("MTD", "sdcard", "/sdcard");

EMMC with EXT3 and EXT4 file systems:

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");

“mountpoint” will vary from device to device. Decide what partition you want to mount, find where it mounts (there will be resources in the second post, and paste it in place of “mountpoint” in your script.

Mounting system, data, and cache on the EVO 3D

mount("ext4", "EMMC", "/dev/block/mmcblk0p23", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p24", "/data");
mount("ext4", "EMMC", "/dev/block/mmcblk0p25", "/cache");

Amend

[I][COLOR="Gray"]none[/COLOR][/I]

Unmounting Partitions:

MTD and EMMC:

unmount("/system");
unmount("/data"); [COLOR="Red"]OR[/COLOR] unmount("/userdata");
unmount("/cache");
unmount("/sdcard");

Amend

[I][COLOR="Gray"]none[/COLOR][/I]

Format Partitions:

MTD:

format("MTD", "system");
format("MTD", "cache");
format("MTD", "data");
format("MTD", "boot");

EMMC EXT3/4:

format("ext4", "EMMC", "/dev/block/mountpoint");

format("ext3", "EMMC", "/dev/block/mountpoint");

Formatting system, data, cache, and boot on EVO 3D.

format("ext4", "EMMC", "/dev/block/mmcblk0p23");
format("ext4", "EMMC", "/dev/block/mmcblk0p24");
format("ext4", "EMMC", "/dev/block/mmcblk0p25");
format("ext4", "EMMC", "/dev/block/mmcblk0p22");

Amend:

[I][COLOR="Gray"]format SYSTEM:
format DATA:
format BOOT:
format CACHE:[/COLOR][/I]

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

package_extract_dir("Source", "Destination");

“Source” = folder in .zip file. "Destination" = partition to copy to,

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

Amend:

[I][COLOR="Gray"]copy_dir PACKAGE:system SYSTEM:
copy_dir PACKAGE:data DATA:
copy_dir PACKAGE:sdcard SDCARD:
[/COLOR][/I]

Write an .img file:

MTD:

assert(package_extract_file("boot.img", "/tmp/boot.img"),
write_raw_image("/tmp/boot.img", "boot"),
delete("/tmp/boot.img"));

EMMC:

package_extract_file("boot.img", "/dev/block/mountpoint");

Amend

[I][COLOR="Gray"]write_raw_image PACKAGE:boot.img BOOT:[/COLOR][/I]

Output a line of text:

MTD/EMMC:

ui_print("Text Here");

Amend

[I][COLOR="Gray"]none[/COLOR][/I]

Delete a file:

Use delete for a single file. Use delete recursive for an entire folder.

delete_recursive("file/path");

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

Amend

[I][COLOR="Gray"]delete_recursive PARTITION:path/to/file[/COLOR][/I]

[I][COLOR="Gray"]delete PARTITION:path/to/file[/COLOR][/I]

Set ownership and permissions for folder:

set_perm_recursive(uid, gid, dmode, fmode, “/path/to/folder”);

Amend

[COLOR="Gray"]set_perm_recursive uid gid dmode fmode PARTITION:path[/COLOR]

Set ownership and permissions for a file:

set_perm(uid, gid, mode, “/path/to/file”);

Amend

[COLOR="Gray"]set_perm uid gid mode PARTITION:file[/COLOR]

Run a program:

run_program("programtorun");

Amend

[I][COLOR="gray"]run_program PACKAGE:programtorun[/COLOR][/I]

Creating symlinks:

symlink("/path/to/file", "/path/tofile");

Amend

[COLOR="gray"][I]symlink /path/to/file PARTITION:path/to/file[/I][/COLOR]

Progress bar:

show_progress(fraction, duration);

Amend

[COLOR="gray"][I]show_progress fraction, duration[/I][/COLOR]