[Galaxy Note II General] Tha TechnoCrat:
100% is not worthwhile using since it never gets to display if all tasks are done. Just let it display Update Done on it's own.

I am trying to learn how to create the edify scripts. I have several ring tones and live wall papers that I like to install and want to just flash them instead of using the adb. I have two folders in the root of the zip file the META-INF and system. Under the system folder I have an app folder, with apk's, and a lib folder for their libraries. These were created on Wnidows 7 64bit using Notepad++. One of the best test editors for Windows I may say, been using it for years. There is an extra blank line at the end, just does not show in the code blocks. I am testing this on my Evo 4g running CM7 nightly 91.

Here was my amend script that worked

Code:

show_progress 0.1 0

copy_dir PACKAGE:system SYSTEM:

set_perm_recursive 0 0 0755 0644 SYSTEM:app

set_perm_recursive 0 0 0755 0644 SYSTEM:lib

show_progress 0.1 10

This is my first edify script that does not work (Status 6)

Code:

show_progress(0.1, 0);

mount("MTD", "system", "/system");

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

set_perm_recursive(0, 0, 0755, 0644, "/system/app");

set_perm_recursive(0, 0, 0755, 0644, "/system/lib");

unmount("/system");

show_progress(0.1, 10);

Then my latest edify script that runs but does not install the files

Code:

ui_print("Installing Live Wall Paper...");

ui_print("Mounting mount points...");

show_progress(0.1, 0);

run_program("/sbin/mount", "/dev/block/mtdblock4", "/system");

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

show_progress(0.1, 10);

ui_print("Setting Permissions...");

show_progress(0.2, 0);

set_perm_recursive(0, 0, 0755, 0644, "system/app");

set_perm_recursive(0, 0, 0755, 0644, "system/lib");

show_progress(0.2, 10);

ui_print("Unmounting mount points...");

run_program("/sbin/umount", "/system");

ui_print("Update Complete.");

This code works Finally!

Code:

ui_print("Installing Live Wall Paper...");

ui_print("Mounting mount points...");

show_progress(0.1, 0);

run_program("/sbin/busybox", "mount", "/system");

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

show_progress(0.1, 10);

ui_print("Setting Permissions...");

show_progress(0.2, 0);

set_perm_recursive(0, 0, 0755, 0644, "system/app");

set_perm_recursive(0, 0, 0755, 0644, "system/lib");

show_progress(0.2, 10);

ui_print("Unmounting mount points...");

run_program("/sbin/busybox", "umount", "/system");

ui_print("Update Complete.");

I want to learn this but I'm just going in circles now.

1. Why would my first edify script not run and gave me a "Status 6".

2. Why does run_program("/sbin/busybox", "mount", "/system"); work but not mount("MTD", "system", "/system"); for me.

Any help would be really really helpful. Thanks in advance.

i know many use the dsixda kitchen so here's another way on installing busybox:

set_perm(0, 1000, 0755, "/system/xbin/busybox");

run_program("/sbin/sh","-c",

concat("( cd /system/xbin ; ",

" ./busybox --install -s /system/xbin )"));

Also useful as a temple for executing more then one operation

Below is a list of functions that can be used in Edify scripts and explanations about them.

This info was compiled from here.

Credit: http://www.netmite.com/android/mydro.../releasetools/

As you can see this is from "www.netmite.com/android/mydroid/2.0/build/tools/releasetools/" so it may be outdated.

NOTE: I also compared this info with the leaked DK28 FROYO updater-script, it seems that for the samsung phones BML is used in place of MTD.

If someone can confirm this I will edit the values below.

Note: The double quotes are shown where they are required.

If someone has a better resource for this stuff, please share it!

I hope someone finds this useful.

==================================================

Assert that the current system build fingerprint is one of the given strings.

Code:

assert(file_getprop("/system/build.prop", "ro.build.fingerprint") == "string" ||

file_getprop("/system/build.prop", "ro.build.fingerprint") == "string");

Assert that the build on the device is older (or the same as) the given timestamp.

Code:

assert(!less_than_int(timestamp, getprop("ro.build.date.utc")));

Assert that the device identifier is the given string.

Code:

assert(getprop("ro.product.device") == "string1" ||

getprop("ro.build.product") == "string2");

Asert that the bootloader version is one of the given strings.

Code:

assert(getprop("ro.bootloader") == "string1" ||

getprop("ro.bootloader") == "string2");

Update the progress bar, advancing it over 'frac' over the next 'dur' seconds. 'dur' may be zero to advance it via SetProgress commands instead of by time.

Code:

show_progress(frac, dur);

Set the position of the progress bar within the chunk defined by the most recent ShowProgress call. 'frac' should be in [0,1] format.

Code:

set_progress(frac);

Check that the given file (or MTD reference) has one of the given sha1 hashes. See notes above about MTD!

Code:

assert(apply_patch_check("filepath", "sha1Hash", "sha1Hash"));

Check that there's at least 'amount' space that can be made available on /cache.

Code:

assert(apply_patch_space(amount));

Mount the given 'what' at the given path. 'what' should be a partition name if kind is "MTD", or a block device if kind is "vfat". No other values of 'kind' are supported. See notes above about MTD!

Code:

mount("kind", "what", "path");

Unpack a given directory from the OTA package into the given destination directory.

Code:

package_extract_dir("src", "dst");

Log a message to the screen (if the logs are visible).

Code:

ui_print("message");

Format the given MTD partition. See notes above about MTD!

Code:

format("MTD", "partition");

Delete files

Code:

delete("pathToFile1", "pathToFile2", "pathToFile3");

Apply binary patches to the given srcfile to produce tgtfile (which may be "-" to indicate overwriting the source file.

Code:

apply_patch("sourceFile", "targetFile", targetSHA1, targetSize, "patchSHA1:patchFile");

Arrange to update the given firmware image.

Code:

assert(package_extract_file("firmware.bin", "/tmp/firmware.bin"),

write_firmware_image("/tmp/firmware.bin", "firmware.bin"),

delete("/tmp/firmware.bin"));

Write the given package file into the given MTD partition. See notes above about MTD!

Code:

assert(package_extract_file("partition.img", "/tmp/partition.img"),

write_raw_image("/tmp/partition.img", "partition"),

delete("/tmp/partition.img"));

Set file ownership and permissions.

Code:

set_perm(uid, gid, mode, "pathtofile");

Recursively set path ownership and permissions.

Code:

set_perm_recursive(uid, gid, dmode, fmode, "path");

Create symlinks.

Code:

symlink("dest", "pathToLink1", "pathToLink2", "pathToLink3");

RESERVED for updater-script examples.

Syntax:

Code:

Amend Code

Edify Code

Copying a directory from the update package to the phone:

Code:

Amend: copy_dir PACKAGE:system SYSTEM:

Edify: package_extract_dir("system", "/system");

The first parameter is the direct location inside of the package.

The second location is the destination on the phone.

Mounting /data /system and /cache in Edify

Code:

run_program("/sbin/mount", "/dev/block/stl9", "/system");

run_program("/sbin/mount", "/dev/block/stl10", "/data");

run_program("/sbin/mount", "/dev/block/stl11", "/cache");

Printing a UI Message in Edify

Code:

ui_print("Some text here");

Create a symlink in Edify:

Code:

symlink("from","to");

Setting permissions in Edify:

Code:

Single file: set_perm(0, 0, 06755, "/system/xbin/su");

Recursive: set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");

Run a program in Edify:

Code:

run_program("filetorun", "option1", "option 2", "option 3");

Delete a location recursively (like Amend's format):

Code:

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

Remember that script functions that take options (For example, run_program) must have each item that would require a space between it to be surrounded in double quotes, and followed by a comma. The last parameter must not have a comma afterwards.

Remember that ALL edify commands must end with a semi-colon.

SOURCE

#INTERNET

#XDA

#LITTLE bit MINE