Bridging Between
Technically and Asthetically.

Edify Script in AROMA Installer
Home / Articles / AROMA Installer / source:

on xda
Edify Script in AROMA Installer
Edify Script was simple script sintax to configure the behavior of binaries executable. In AROMA Installer, there is 2 edify script in the META-INF/com/google/android folder. The aroma-config and updater-script. Both files has it own use, and accessed by different binary executable.
The aroma-config used to configuring the UI in AROMA Installer, it will accessed directly by AROMA Binary Executable ( update-binary ), and updater-script will be used to configuring commands for installations, and will be accessed directly by update-binary-installer. This couple script use the same sintax but have different functions that can be used.

Basic Sintax

Edify Script use function base script, similar to C language, but without any supported statement except if else. All commands will call functions name with some arguments, and ends by semicolon, like this:
function_name( argument1, argument2, argument3 );
Edify also supporting simple concat-ing string, just like some other languages like Javascript or Java. Using plus (+).
function_name("Concat this " + "Strings" + " as one argument");
All Edify function's arguments was in type string. Edify doesn't support others data type, however, we can insert some integer values into arguments, but it in the fact will be treated as string.
function_name( 50, 20, "55" );
We can't do any math calculation in edify script, so the script below is invalid:
function_name( 50 + 50 );
If you use the string with plus operator, it will only concat the strings just like the 2nd example:
function_name( "50" + "50" ); # Result = "5050"
For commenting the code, we can use the sign character (#), only line comment was supported, just like an unix shell comment sintax:
# This is comments
function_name("Lorem ipsum dolore…");
Code writing isn't strict, so we can safely use space or new line between function and arguments:
  "First Argument",
  "Third Argument"
The functions in Edify Script can returned return values. But just like an arguments, it's only supported string type data. The good thing is this String can be converted into Boolean for conditions need. The string with contents will have true Boolean, and the empty string will have false Boolean.
"" = false, "1" = true, "yes" = true, "no"=true, "0"=true.

Control Structures

Edify only supported limited control structure. Only if, and if else supported. But this control structures is enough to make an interactive installer. The basic sintax of if structure is:
  .. commands ..
And for if else structure is:
  .. true commands ..
  .. false commands ..
We don't have any looping control structure, the Next and Back features in Wizard UI was handled by program automatically.

Comparison & Logical Operators

Edify script doesn't supporting arithmetic operators, but it supported simple comparison and logical operators, Just like other programming languages base on C (java, php, javascript). It use simple operator sintax:
# Equal
val1 == val2

# Not Equal
val1 != val2

# Or
val1 || val2

# And
val1 && val2

# Not
Yes, it doesn't support less than and greater than comparison, because it's only supported with string and Boolean string only. For Integer comparison use cmp function, but it's only supported in aroma-config script.

String and Escape Characters

Fortunately Edify support common string sintax. It's also supported escape characters for newline. The string in Edify defined with double quoted (") and ended with double quoted. Here the basic manipulation of string in Edify:
# Newline use \n:
"Hi, AROMA Installer is\nAWSOME!!!"

# Concat multiple lines:
"Lorem Ipsum Dolore sit\n"+
"Amet, lorem ipsum dolore\n"+
"sit amet, lorem ipsum\n"+
"dolore sit amet."

# Escape Characters:
"You can add\tTabs, \" Quote, \\ Backslash…"

# Hex Characters:
"It was character A : \x41"


Not Supported Operators in Edify

There is a lot of operator features in common programming languages that not supported by edify, like assignment operator for inserting something into variable, bitwise operator for manipulating bits within integer, and arithmetic operators for doing simple math calculations.
All this limited has been added via functions (except bitwise), but only available for aroma-config script, and only simple operations supported.


Link Between aroma-config and updater-script

It was main section to be knowing by anyone that how can the aroma-config communicated with updater-script, so please read it carefully.
aroma-config and updater-script runs in different process, and can't share it's memory resource, so the only possible way to communicate is with temporary files. updater-script was original updater-script commonly used in old installer (without AROMA Installer), it's only supported bunch of functions to be used for manipulating system files, like delete_recursive, set_perm, format, mount, package_extract_dir, etc. But it's also support 1 function for read prop file, it was file_getprop.
That's why the AROMA Installer UI always save the result in prop files ( checkbox, optionbox, menubox ). Other than the UI, aroma-config has the feature to create temporary file in plain text (writetmpfile) which able easily create prop files.


Prop File Format

The prop file format was simple plain text format with (=) token as delimiter between key and values, and newline as delimiter between one key=values with another key=values.
It can be easily accessed with file_getprop like this:
With above code, the file_getprop function will return the value of key1, it will returned "value1". We can use it for our needs in if/if else statement. We can use others characters in keys, like dot (.) and underscore, but please be careful, that you don't add some quotes in the values. Here the wrong prop file format:
first name=james

AROMA Installer Default Prop Temporary Locations

When playing with AROMA Installer aroma-config files, almost all things that manipulated prop files will be saved relatively on AROMA temporary directory located in /tmp/aroma-data/, so if we pass the prop filename like this: writetmpfile("test.prop","key1=ok");, the test.prop will be located at /tmp/aroma-data/test.prop.

Quick Example

In this example case, the aroma-config will create temporary prop file that will be readed by updater-script:
  "snq =yes\n"+
  file_getprop("/tmp/aroma-data/kernel.prop","snq") == "yes"
  # Install Kernel
  write_raw_image("/tmp/boot.img", "boot");

  file_getprop("/tmp/aroma-data/kernel.prop","call.2way") == "yes"
  # Do Something here
  # Do Something here
With this feature, it's enough to archive customizable installation, and the aroma-config will be able to communicate with updater-script.
By : Ahmad Amarullah source on 24 Jan 2012 - 14:12
Related Articles

Configuring and Customizing AROMA Installer

24 Jan 2012 - 14:12 · AROMA Installer can be configured and customized as you like, there is so many features and functions you can used to implemented many things. In this manual, we will learn all the features and functions in technical ways and can be implemented directly in configuration for practice, or production.

Other Categories
ads kotak
Submit your Comment
blog comments powered by Disqus - Bridging Between Technically and Asthetically. Stay Up to Date :
About Us
© 2012 - All Rights Reserved. Design by