[Epic 4G Android Development] nubecoder:
OK, so I've been playing around a lot lately with some edify scripting and looking through the Clockwork Mod source code.

I found some built-in commands that do not appear to be widely known.

I'll probably be creating some sort of "Everything I know about edify scripting" post eventually, but for now, I wanted to share this.

The Concept::

Having control of the zip installation using a config file placed onto the SD card.​

A Fictional Example::

For instance, lets say we have a Rom, we'll call it NubeRom (pronounced Nuber-Om). ;]

OK, so let's say that NubeRom does not install any Stock Samsung Widgets by default.

But NubeRom comes with a file named "options.cfg" that is to be placed onto the root of the SD card.

Inside the "options.cfg" file looks like this:

install.samsung.widgets=no

That would be the default setting of NOT installing the Samsung Widgets.

Lets say that we wanted to install the Samsung Widgets. We could simply change the file to look like:

install.samsung.widgets=yes

And then NubeRom's install script would install the Stock Samsung Widgets.​

What the script would look like::

Here is an example of what the install script for the fictional "NubeRom" would look like:

# mount sdcard so it can be read from
run_program("/sbin/mount/", "/sdcard");

# beginning of ifelse
ifelse(
# read the "install.samsung.widgets" value from the file and compare to "yes"
file_getprop("/sdcard/options.cfg", "install.samsung.widgets") == "yes,
(
# the value was "yes", install stock samsung widgets
ui_print("Installing Stock Samsung Widgets");

# code would go here to install the widgets....
),
(
# the value was not "yes", do not install stock samsung widgets
ui_print("Skipping Stock Samsung Widgets");
)
);
# unmount sdcard
unmount("/sdcard");

The code above is, of course, only the configurable stock widgets portion of the fictional script.​

Testing::

This was tested on an Epic 4G using Clockwork Mod recovery v3.0.0.6.

I have not fully tested what happens when the config file is not in the correct place (in this case the correct place is "/sdcard/options.cfg").

I believe you will get a file not found error or something.

Count that as, this still needs a bit more testing.​

Usage::

Place the "options.cfg" file onto the root of your SD card ("/sdcard").

Flash the "file_getprop_test.zip" file with Clockwork Mod recovery.

Watch the output change based on the config file's setting.​

Other notes::

While looking at the script in the attached test file, some people might notice the use of the concat() and sleep() functions.

Syntax for those is as follows:

concat("string1", "string2");
sleep(frac);

Example usage:

concat("Product Device : ", getprop("ro.product.device"));

outputs "Product Device: ~Value~"

sleep(2.5);

pauses the script for 2.5 seconds.​

Share it::

Link this thread to your favorite Rom dev/packer.

They might find it useful, and maybe some people will do something with this info.​

I've attached two Proof of concept files.

The Clockwork Mod flash-able zip: "file_getprop_test.zip".

The options config file (in a zip): "options.zip".

The forum made me zip the config file. so just extract it first.

=]