5,599,033 Members 31,994 Now Online
XDA Developers Android and Mobile Development Forum

Aroma, Edify, updater script Question and Answer thread.

Tip us?
 
Dblfstr
Old
(Last edited by Dblfstr; 25th July 2012 at 04:58 PM.)
#1  
Dblfstr's Avatar
Recognized Contributor - OP
Thanks Meter 720
Posts: 2,183
Join Date: Mar 2010
Location: Huntsville, AL

 
DONATE TO ME
Default Aroma, Edify, updater script Question and Answer thread.

Quote:

This thread is intended for those of you who are currently creating updater scripts or using Aroma and need some help with your scripts. Be it syntax errors, or things just not working properly. Here you can post your script and get some quick-time help to get your work up and running. I have notified Amarullz, the creator of Aroma, and he will be dropping by here as well to help guide you on your way.

The reason I created this thread is to not clutter up the original Aroma thread will questions on Syntax errors. There were enough posts in there that I felt a dedicated thread was justified.



More stuff to come...
If you do not know what AROMA is then you are missing out. Check out the Installer here, created by Amarullz
Original Aroma Thread:
[MOD][2.00] AROMA Installer :: 120425-020 :: Open Source

List of stuff pasted from the original Aroma thread, thanks to Amarullz

Quote:
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.

Code:
key1=value1
key2=value2
key_3=value3
last.name=amarullz
It can be easily accessed with file_getprop in updater-script like this:

Code:
file_getprop("example.prop","key1");
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:

Code:
key1="value1"     # add quotes
key2="value2"     # add quotes
first name=james  # Key name with space
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:

aroma-config:
Code:
writetmpfile(
  "kernel.prop",
  "snq =yes\n"+
  "call.2way=no\n"
);
updater-script:
Code:
if
  file_getprop("/tmp/aroma-data/kernel.prop","snq") == "yes"
then
  # Install Kernel
  write_raw_image("/tmp/boot.img", "boot");
endif;

if
  file_getprop("/tmp/aroma-data/kernel.prop","call.2way") == "yes"
then
  # Do Something here
else
  # Do Something here
endif;
With this feature, it's enough to archive customizable installation, and the aroma-config will be able to communicate with updater-script.
EDIFY SCRIPT
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, but use the same sintax, It's called edify.

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 (extract files, create symlinks, change permissions, format, mount, etc), 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 Edify Sintax
Edify Script was function base script, similar to C language, but without any supported statement except if else. You also can't create function, only bundled functions available for the script. All commands will call functions name with some arguments, and ends by semicolon, like this:

Code:
function_name( argument1, argument2, argument3 );
Edify also supporting simple concat-ing string, just like some other languages like Javascript or Java. Using plus (+).

Code:
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 it will be treated as string.

Code:
function_name( 50, 20, "55" );
We can't do any math calculation in edify script, so the script below is invalid:

Code:
function_name( 50 + 50 );
If you use the string with plus operator, it will only concat the strings just like the 2nd example:

Code:
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:

Code:
# 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:

Code:
function_name(
  "First Argument",
  getvar("config"),
  "Third Argument"
);
The functions in Edify Script can returned 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:

Code:
if
  "comparison"=="comparison"
then
  .. commands ..
endif;
And for if else structure is:

Code:
if
  "comparison"=="comparison"
then
  .. true commands ..
else
  .. false commands ..
endif;
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:

Code:
# Equal
val1 == val2

# Not Equal
val1 != val2

# Or
val1 || val2

# And
val1 && val2

# Not
!val1

# Logical & Comparison
(val1 == val2)||(val3 != val4)

(val1 == val2)&&(val3 != val4)

!((val1 == val2)&&(val3 != val4))
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:

Code:
# 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.
What UI's AROMA Installer Supported
AROMA Installer had 4 main type of Customizable User Interfaces, the Wizard UI, Dialog UI, Splash UI and Installer UI. And un-customizable Menu UI for selecting About, Help, Tools and Quit Installer.
Wizard UI
The Wizard UI was the main User Interface in AROMA Installer, it's contain Back and Next button in navigation bar just like Computer common Installer programs (Windows Installer, NSIS Install System, InstallShield). Users can navigate trough the screens, or back to previous screens if something not right in configurations. Users can select Typical or Customize installations, and Users can customize what packages to install.

AROMA Installer support many Wizard UI, and here the completed list of it's UI:
  • checkbox – UI to show checkboxes in groupable list, the selected items will be saved in prop format, and can be accessed with file_getprop.
  • selectbox – It's like checkbox, but it's only able to check 1 items per group.
  • textbox – It will show the textbox, you can read text file to show it into the textbox
  • viewbox – It's like Textbox, but not scrollable, and only supported limited text length
  • agreebox – It's like Textbox, but with agree checkbox, user can't step to next page if the checkbox not already checked. Useful to show License or Terms of Use Interface.
  • menubox – This UI will show list of menu to select, there is no Next button, because when User select the item, it will automatically step into next page. And The selected menu will be saved in temporary prop file.
Dialog UI
While Wizard UI will shown it's interface in Fullscreen, the Dialog UI will shown it's interface in Popup Window, It was useful for some needs, like show confirmation for "Are You Sure want to format the partitions?", or show Alert Dialog for "Thanks for using my ROM". Here the complete list of Dialog UI in AROMA Installer:
  • alert – Show popup dialog, with limited text length and Only the OK button.
  • confirm – Show popup dialog, with limited text length and contains 2 customizable Button "Yes" and "No", with return value true for "Yes" and false for "No".
  • textdialog – Show scrollable text popup dialog, with long text length support and Only OK Button.
Splash UI
This UI Simply show the Splash Screen from png files with custom delay before it show next page. The image will automatically position in center of screen depended from it's image size. The background will be blended in blur and darkest color.
Installer UI
When configuration invoke the install UI, it will start an installation, and show the installer UI with description text on top window, textbox for installer information in middle, and progress text and bar in bottom of screen. The installation will not cancelable, and there is no buttons or menu to select before installation finished, The Next and Save Logs button will be shown after installation finished. And next Wizard UI can't do Back command beyond this installer UI, so the Installer UI will only shown once time only in flash process.
What Functions AROMA Installer Supported
There is so many functions that you can used for your needs, The available functions was the common functions that may be usable for installations, but not supported very complex things. AROMA Installer support simple comparison, math, system partition information, and simple set and get variables.

Here the list of functions that you can used:
  • setcolor – Set UI Color Scheme
  • ini_set – Set Aroma Configuration settings
  • calibrate – Calibrating Touch Screen
  • getvar – Get Variable
  • setvar – Set Variable
  • appendvar – Append string into variable
  • prependvar – Prepend string into variable
  • file_getprop – Get prop value of some key from prop file.
  • readfile – Read text file from zip content
  • readfile_aroma – Read text file from zip content relatively from aroma META-INF folder.
  • getdisksize – Get partition total size
  • getdiskfree – Get partition free size
  • getdiskusedpercent – Get partition used size in percentage
  • cmp – Simple integer comparison ( >, <, ==, >=, <=, != )
  • cal – Simple math calculator ( +, -, /, * )
  • iif – Inline if
  • if else – If and Else Statement
  • pleasewait – Show please wait/loading progress when calculating/doing hard process that took a lot of time.
  • writetmpfile – Write/create temporary file with text contents
  • exit – terminate installation.
Custom Fonts
You can customize your AROMA Installer Fonts. The AROMA Installer use 2 type of fonts "Big" and "Small", the Big font used in Title and the Small Font used in almost any controls. To use the custom fonts, copy the big.png or small.png into META-INF/com/google/android/aroma/fonts.

List of Custom Fonts Currently Available to Download - by amarullz

Create Your Own Font
You can also create your own fonts, it was plain png (32 bit color depth). All letter was arranged in ASCII order Start from ASCII 32 (space) to ASCII 95 ( ~ char) then ( - Copyright ) character.

Here the letter list:
Code:
 !”#$%&’()*+,-./0123456789:;<=>?@ABCDEFGHI JKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
In the first row picture, there is pixel to seperate one letter to next letter, because AROMA Installer didn't use fixed size fonts ( console fonts like courier ). The fonts will rendering from 2nd row into end of rows. Here the example:


NOTE: AROMA Installer only need alpha channel for this, the color of fonts will using the AROMA color scheme defined in aroma-config. The width separator (in first row pixel) should be full opaque (alpha=100% or 255).

If you make your own fonts, please fell free to post here...
Other Custom Fonts
You can also use third party custom fonts created by other xda-developers users. Here some custom font list:
My current device:
────────────────────
HTC HD2 (LEO) TmoUS 1024
OS: HyperDroid-CM7-v2.0.1
Kernal:Tytung_R9


My Work:
────────────────────
Netflix Rotation Enabled Apps: Netflix
Boot Animations: Link
Enable rotation in ANY app: Link
My Game: Floppy Fish


The Following 45 Users Say Thank You to Dblfstr For This Useful Post: [ Click to Expand ]
 
Dblfstr
Old
(Last edited by Dblfstr; 13th July 2012 at 02:28 PM.)
#2  
Dblfstr's Avatar
Recognized Contributor - OP
Thanks Meter 720
Posts: 2,183
Join Date: Mar 2010
Location: Huntsville, AL

 
DONATE TO ME
Default Functions Reference

__________________________________________________ __________________________________________________ ______


Quote:
Originally Posted by amarullz View Post
CONFIGURATION FUNCTIONS
setcolor

Descriptions:
Set AROMA Installer Color Scheme. It can also defined in themes with theme.prop file
Sintax:

void setcolor(colorname, hexcolor);
Parameters:
  • colorname - Name of color to be set. colorname with "_g" for gradient color.
    • winbg, winbg_g : Main/Top Most Window Backgroud
    • winfg : Main/Top Most Window Text Foreground
    • winfg_gray : Main/Top Most Window Gray Text Foreground
    • dialogbg, dialogbg_g : Popup Window Backgroud (Alert, Confirm, About)
    • dialogfg : Popup Window Text Foreground
    • textbg, textbg_g : Textbox, Checkbox, and any scrollable UI Background
    • textfg : Textbox, Checkbox, and any scrollable UI Text Foreground
    • textfg_gray : Gray Text ( on Optionbox/Checkbox Item Description )
    • controlbg, controlbg_g : Control / Button / Checkbox border - Background Color
    • controlfg : Button Text Color
    • selectbg, selectbg_g : Selected Element Background ( Pushed/focused Button/items, etc )
    • selectfg : Selected Element Text/Foreground Color
    • titlebg, titlebg_g : Window Title Background
    • titlefg : Window Title Text Foreground Color
    • navbg, navbg_g : Bottom Bar (Navigation Bar) Background. Next-Previous Area
    • scrollbar : Scrollbar indicator color
    • border, border_g : Common Border Color
    • progressglow : Progress Animation Color
  • hexcolor - Hexadecimal Color in RGB. it support 3 and 6 characters hexadecimal started with #. example: "#a8e" or "#ff5599".
Return Value: none
Examples:
Code:
# Set Color with 3 chars hexcolor
setcolor("winbg", "#444");
setcolor("winbg_g", "#222");
setcolor("textbg", "#333");
setcolor("textfg", "#fff");

# Set Color with 6 chars hexcolor
setcolor("textfg_gray", "#bbbbbb");
setcolor("controlbg", "#446699");
setcolor("controlbg_g", "#223355");
ini_set

Descriptions:
Sets the value of a AROMA Installer configuration option
Sintax:

void setcolor(configname, newvalue);

Parameters:
  • configname - Configuration name to be set.
    • roundsize : Set Corner size of rounded rectangle for common controls (default:"3")
    • button_roundsize: Set Corner size of rounded rectangle for button controls (default:"2")
    • window_roundsize : Set Corner size of rounded rectangle for main window (default:"4")
    • transition_frame : Set number of frames for transition (default:"5")
    • text_ok : Set text for common OK text (default:"OK")
    • text_next : Set text for wizard next button (default:"Next >")
    • text_back : Set text for wizard back button (default:"< Back")
    • text_yes : Set text for default yes button (default:"Yes")
    • text_no : Set text for default no button (default:"No")
    • text_about : Set text for About menu (default:"About & Informations")
    • text_calibrating : Set text for Calibration Menu (default:"Calibrating Tools")
    • text_quit : Set text for Quit Menu (default:"Quit Installation")
    • text_quit_msg : Set text for Quit Confirmation Message (default:"Are you sure to quit the Installer?")
    • rom_name : Set ROM Name Information
    • rom_version : Set ROM Version Information
    • rom_author : Set ROM Author Information
    • rom_device : Set ROM Device Information
    • customkeycode_up : Set Alternative keycode for up key (navigate up)
    • customkeycode_down : Set Alternative keycode for down key (navigate down)
    • customkeycode_select : Set Alternative keycode for select key (select an item)
    • customkeycode_back : Set Alternative keycode for back key
    • customkeycode_menu : Set Alternative keycode for menu key
  • newvalue - New value to be set for configname
Return Value: none
Examples:
Code:
# Set ROM Informations
ini_set("rom_name", "AROMA ROM");
ini_set("rom_version", "1.0");
ini_set("rom_author", "amarullz");
ini_set("rom_device", "HTC Desire (bravo)");

# Set Custom Text
ini_set("text_ok", "OK Man");
ini_set("text_next", ">>");
ini_set("text_back", "<<");

# Set Alternative Key Code - You can use keycapture tool
# to capture your device keycode
ini_set("customkeycode_up", "115");
ini_set("customkeycode_down", "114");
ini_set("customkeycode_select", "116");
ini_set("customkeycode_menu", "229");
ini_set("customkeycode_back", "158");
calibrate

Descriptions:
Set Touch Screen Calibration Data. Different device may had different touch screen calibration data. To get calibration data, press menu, select calibration tools then follow the intructions.
Sintax:

void calibrate(divx, addx, divy, addy [, alternative_method]);
Parameters:
  • divx - Division value for horizontal touchscreen to display resolution.
  • addx - Add value for horizontal alignment.
  • divy - Division value for vertical touchscreen to display resolution.
  • addy - Add value for vertical alignment.
  • alternative_method [Optional] - Use alternative method for touch screen handling if normal method not works in your device (default:"no")
Return Value: none
Examples:
Code:
# HTC Desire Calibrated Data
calibrate("7.90","20","7.90","20");

# Alternative method Calibrated Data
calibration("1.8447", "37", "1.2158", "27", "yes");
calibtool

Descriptions:
Start calibration tool.
Sintax:

void calibtool(dummy_arguments);
Parameters:
  • dummy_arguments - Edify should pass at least 1 arguments. Just Pass "" for it
Return Value: none
Examples:
Code:
# Start Calibrating Tools
calibtool("");
theme

Descriptions:
Set AROMA Installer Theme will be used in next display.
Sintax:

void theme(theme_name);
Parameters:
  • theme_name - Theme Name will be used. It was theme directory name located in "META-INF/com/google/android/aroma/themes"
Return Value: none
Examples:
Code:
# Use ICS Theme located at:
# META-INF/com/google/android/aroma/themes/ics
theme("ics");
VARIABLE FUNCTIONS
getvar

Descriptions:
Get Variable
Sintax:

variable_value getvar(varname);
Parameters:
  • varname - Variable Name
Return Value: Variable Value
Examples:
Code:
# Show "testvar" value in alert
alert(
 "Value of testvar",
 getvar("testvar")
);
setvar

Descriptions:
Set Variable
Sintax:

void setvar(varname, value);
Parameters:
  • varname - Variable Name to be set
  • value - New Value for Variable
Return Value: none
Examples:
Code:
# Set new value for "testvar"
setvar("testvar", "This is only test!!");

# Now Show the "testvar" value in alert
alert(
 "Value of testvar",
 getvar("testvar")
);
appendvar

Descriptions:
Append new value after previous value, it's like concating strings ( previous_value + newvalue )
Sintax:

void appendvar(varname, value);
Parameters:
  • varname - Variable Name to be set
  • value - New Value to be appended in variable
Return Value: none
Examples:
Code:
# Set new value for "testvar"
setvar("testvar", "This is only test!!");

# Append new value
appendvar("testvar", "Add String");

# "testvar" now will contain "This is only test!!Add String"
prependvar

Descriptions:
Prepend new value before previous value, it's like concating strings ( newvalue + previous_value )
Sintax:

void prependvar(varname, value);
Parameters:
  • varname - Variable Name to be set
  • value - New Value to be prepended in variable
Return Value: none
Examples:
Code:
# Set new value for "testvar"
setvar("testvar", "This is only test!!");

# Prepend new value
prependvar("testvar", "Add String!! ");

# "testvar" now will contain "Add String!! This is only test!!"
PROP FILE HANDLER FUNCTIONS
file_getprop

Descriptions:
Read prop file value for given keyname
Sintax:

prop_value file_getprop(filename, keyname);
Parameters:
  • filename - Absolute path of prop file in filesystem
  • keyname - Prop Key Name
Return Value: Value of prop for given keyname
Examples:
Code:
# Get value of "item.1.1" from /tmp/aroma-data/custom.prop
alert(
 "Value of Prop",
 file_getprop("/tmp/aroma-data/custom.prop", "item.1.1")
);
prop

Descriptions:
Same with file_getprop, but will read relatively from AROMA Temporary Directory "/tmp/aroma-data/"
Sintax:

prop_value prop(filename, keyname);
Parameters:
  • filename - Relative path of prop file in AROMA Temporary Directory "/tmp/aroma-data/"
  • keyname - Prop Key Name
Return Value: Value of prop for given keyname
Examples:
Code:
# Get value of "item.1.1" from /tmp/aroma-data/custom.prop
alert(
 "Value of Prop",
 prop("custom.prop", "item.1.1")
);
zipprop

Descriptions:
Same with file_getprop, but will read the prop file from Zip
Sintax:

prop_value zipprop(zip_path, keyname);
Parameters:
  • zip_path - Absolute path of prop file in Zip ( don't add "/" in first character )
  • keyname - Prop Key Name
Return Value: Value of prop for given keyname
Examples:
Code:
# Get value of "item.1.1" from META-INF/com/google/android/aroma/custom.prop
alert(
 "Value of Prop",
 zipprop("META-INF/com/google/android/aroma/custom.prop", "item.1.1")
);
resprop

Descriptions:
Same with zipprop, but will read the prop file from Zip relatively from AROMA Resource Directory "META-INF/com/google/android/aroma/"
Sintax:

prop_value resprop(zip_path, keyname);
Parameters:
  • zip_path - Relative path of prop file in Zip from AROMA Resource Directory "META-INF/com/google/android/aroma/"
  • keyname - Prop Key Name
Return Value: Value of prop for given keyname
Examples:
Code:
# Get value of "item.1.1" from META-INF/com/google/android/aroma/custom.prop
alert(
 "Value of Prop",
 resprop("custom.prop", "item.1.1")
);
sysprop, property_get

Descriptions:
Read system property value for given keyname
Sintax:

prop_value property_get(keyname);

prop_value sysprop(keyname);
Parameters:
  • keyname - Prop Key Name
Return Value: Value of prop for given keyname
Examples:
Code:
# Get Device Board Name
alert(
 "Device Board Name",
 sysprop("ro.product.board")
);

# Get Board Platform
alert(
 "Device Board Name",
 property_get("ro.board.platform")
);
FILESYSTEM FUNCTIONS
writetmpfile

Descriptions:
Write string into file in AROMA temporary
Sintax:

void writetmpfile(filename, value);
Parameters:
  • filename - Destination file in AROMA temporary directory
  • value - String that will be write into the file
Return Value: none
Examples:
Code:
# It will saved in from /tmp/aroma-data/test.txt
writetmpfile("test.txt", "This is test text");

# Show the content in alert with readtmpfile
alert(
 "Value of test.txt",
 readtmpfile("test.txt")
);

# Show the content in alert with read
alert(
 "Value of test.txt",
 read("/tmp/aroma-data/test.txt")
);
write

Descriptions:
Write string into file in filesystem
Sintax:

void write(filename, value);
Parameters:
  • filename - Absolute path to Destination file
  • value - String that will be write into the file
Return Value: none
Examples:
Code:
# It will saved in from /sdcard/test.txt
writetmpfile("/sdcard/test.txt", "This is test text");

# Show the content in alert with read
alert(
 "Value of test.txt",
 read("/sdcard/test.txt")
);
readtmpfile

Descriptions:
Read string from file in AROMA temporary directory
Sintax:

content_of_file readtmpfile(filename);
Parameters:
  • filename - File in AROMA temporary directory that will be readed
Return Value: Content of file in String
Examples:
Code:
# It will read data from /tmp/aroma-data/test.txt
# then save it in variable
setvar(
 "testvar",
 readtmpfile("test.txt")
);
read

Descriptions:
Read string from file in filesysten
Sintax:

content_of_file read(filename);
Parameters:
  • filename - Absolute path to Destination file that will be readed
Return Value: Content of file in String
Examples:
Code:
# It will read data from /sdcard/test.txt
# then save it in variable
setvar(
 "testvar",
 read("/sdcard/test.txt")
);
ZIP CONTENT HANDLING FUNCTIONS
readfile

DEPRECATED!!! - Identical with zipread. Will be deleted soon.
readfile_aroma

DEPRECATED!!! - Identical with resread. Will be deleted soon.
zipread

Descriptions:
Read string from file in zip
Sintax:

content_of_file zipread(zip_path);
Parameters:
  • zip_path - Absolute path to Destination file in zip that will be readed
Return Value: Content of file in String
Examples:
Code:
# It will read data from zip content "META-INF/com/google/android/aroma/text.txt"
# then save it in variable
setvar(
 "testvar",
 zipread("META-INF/com/google/android/aroma/text.txt")
);

# It will read data from zip content "tmp/text.txt"
# then save it in variable
setvar(
 "testvar2",
 zipread("tmp/text.txt")
);
resread

Descriptions:
Read string from file in zip relatively from AROMA Resource Directory "META-INF/com/google/android/aroma/"
Sintax:

content_of_file resread(zip_path);
Parameters:
  • zip_path - Relative path of file in Zip from AROMA Resource Directory "META-INF/com/google/android/aroma/" that will be readed
Return Value: Content of file in String
Examples:
Code:
# It will read data from zip content "META-INF/com/google/android/aroma/text.txt"
# then save it in variable
setvar(
 "testvar",
 resread("text.txt")
);

ZIP EXTRACT FUNCTIONS
ziptotmp

Descriptions:
Extract file from zip content into AROMA Temporary directory, and automatically chmod it for executable.
Sintax:

void ziptotmp(zip_path, destination_name);
Parameters:
  • zip_path - Absolute path to Destination file in zip that will be extracted
  • destination_name - Extracted target filename
Return Value: none
Examples:
Code:
# It will extract "tmp/busybox" into "/tmp/aroma-data/busybox"
ziptotmp("tmp/busybox", "busybox");

# Now we can execute it
exec("/tmp/aroma-data/busybox","ls","-l");
restotmp

Descriptions:
Extract file from zip content in AROMA Resource Directory "META-INF/com/google/android/aroma/" into AROMA Temporary directory, and automatically chmod it for executable.
Sintax:

void restotmp(zip_path, destination_name);
Parameters:
  • zip_path - Relative path of file in Zip from AROMA Resource Directory "META-INF/com/google/android/aroma/" that will be extracted
  • destination_name - Extracted target filename
Return Value: none
Examples:
Code:
# It will extract "META-INF/com/google/android/aroma/busybox" into "/tmp/aroma-data/busybox"
restotmp("busybox", "busybox");

# Now we can execute it
exec("/tmp/aroma-data/busybox","ls","-l");
EXEC FUNCTIONS
zipexec

Descriptions:
Extract file from zip into AROMA temporary, chmod it, and execute it.
Sintax:

exit_status zipexec(zip_path [, argument1, argument2, ... ]);
Parameters:
  • zip_path - Absolute path of zip content that will be executed
  • arguments [Optional] - Command line Arguments
Return Value: Return exit status. "0" for common success status
The output buffer/stdout will be automatically saved into "exec_buffer"
Examples:
Code:
# It will extract and run "META-INF/com/google/android/aroma/test.sh"
zipexec("META-INF/com/google/android/aroma/test.sh");

# With Arguments
zipexec("META-INF/com/google/android/aroma/test.sh", "argument1", "argument2");

# Get Return Status
if
 zipexec("META-INF/com/google/android/aroma/test.sh") == "0"
then
 alert(
 "Exec Status",
 "Shell was executed successfully"
 );
endif;

# Get STDOUT
zipexec("META-INF/com/google/android/aroma/test.sh");
alert(
 "Exec STDOUT",
 getvar("exec_buffer")
 );
resexec

Descriptions:
Same as zipexec, but it will extract and run the file from zip relatively from AROMA Resource Directory "META-INF/com/google/android/aroma"
Sintax:

exit_status resexec(zip_path [, argument1, argument2, ... ]);
Parameters:
  • zip_path - Relative path of zip content from AROMA Resource Directory "META-INF/com/google/android/aroma/" that will be executed
  • arguments [Optional] - Command line Arguments
Return Value: Return exit status. "0" for common success status
The output buffer/stdout will be automatically saved into "exec_buffer"
Examples:
Code:
# It will extract and run "META-INF/com/google/android/aroma/test.sh"
resexec("test.sh");

# With Arguments
resexec("test.sh", "argument1", "argument2");

# Get Return Status
if
 resexec("test.sh") == "0"
then
 alert(
 "Exec Status",
 "Shell was executed successfully"
 );
endif;

# Get STDOUT
resexec("test.sh");
alert(
 "Exec STDOUT",
 getvar("exec_buffer")
 );
run_program, exec

Descriptions:
Run executable from filesystem
Sintax:

exit_status run_program(path [, argument1, argument2, ... ]);
exit_status exec(path [, argument1, argument2, ... ]);
Parameters:
  • zip_path - Absolute path to executable
  • arguments [Optional] - Command line Arguments
Return Value: Return exit status. "0" for common success status
The output buffer/stdout will be automatically saved into "exec_buffer"
Examples:
Code:
# It will run "ls" command
run_program("/sbin/ls");

# or
exec("/sbin/ls");

# With some Arguments
run_program("/sbin/ls", "-l", "/sdcard");

# Mounting Device
exec("/sbin/mount", "-t", "auto", "/system");

# Get Return Status
if
 exec("/sbin/mount", "-t", "auto", "/system") == "0"
then
 alert(
 "Exec Status",
 "Mount was executed successfully"
 );
endif;

# Get STDOUT
exec("/sbin/ls", "-l", "/sdcard/*.zip");
alert(
 "List of Zip in SDCARD",
 getvar("exec_buffer")
 );
My current device:
────────────────────
HTC HD2 (LEO) TmoUS 1024
OS: HyperDroid-CM7-v2.0.1
Kernal:Tytung_R9


My Work:
────────────────────
Netflix Rotation Enabled Apps: Netflix
Boot Animations: Link
Enable rotation in ANY app: Link
My Game: Floppy Fish


The Following 18 Users Say Thank You to Dblfstr For This Useful Post: [ Click to Expand ]
 
Dblfstr
Old
(Last edited by Dblfstr; 4th February 2013 at 08:20 PM.)
#3  
Dblfstr's Avatar
Recognized Contributor - OP
Thanks Meter 720
Posts: 2,183
Join Date: Mar 2010
Location: Huntsville, AL

 
DONATE TO ME
XDA forum topic on Edify Script Syntax:
Edify script language
Tutorial on Edify Script Syntax
[TUT] Edify Installation Script Syntax's
Information on Edify scripts and CWM
[INFO] Edify scripts in CWM recovery
Aroma Log/Tmp Puller V1
This can pull log files/tmp files and other files from an aroma execution. It also allows packaging of just aroma or whole rom files
Aroma Log/Tmp Puller V1
By: Kevinrocksman
The Following 6 Users Say Thank You to Dblfstr For This Useful Post: [ Click to Expand ]
 
Dblfstr
Old
(Last edited by Dblfstr; 26th September 2012 at 02:58 PM.)
#4  
Dblfstr's Avatar
Recognized Contributor - OP
Thanks Meter 720
Posts: 2,183
Join Date: Mar 2010
Location: Huntsville, AL

 
DONATE TO ME
Default Common Errors

This post is intended to display the most common errors made while writing a script:

1.
Adding that damn extra comma that we all know you do not need:
Code:
selectbox(
    #-- Title
      "Main Title",
	  
    #-- Sub Title
      "Your lovely subtitle:",
	  
    #-- Icon: <AROMA Resource Dir>/icons/default.png or <ThemeDir>/icon.default.png
      "@default",
	  
    #-- Will be saved in /tmp/aroma/mods.prop
      "mods.prop",
	  
	  #----------------[ Selectbox With Groups ]--------------------#
	  # TITLE      |             SUBTITLE                  | Initial Value  #
	  #-------------+------------------------------------+-----------------#
	  
	  "Words",       "",          2,      #-- Group 1. key = "selected.1"
	  "Words",       "",          1,      #-- selected.1 = 1
          "Words",       "",          0       #-- selected.1 = 2  
  );
NO COMMA AFTER THAT LAST '0'
************************************************** ************************************************** ************************************
************************************************** ************************************************** ************************************
************************************************** ************************************************** ************************************
************************************************** ************************************************** ************************************

2.
End all of your if statements:

Code:
if
     something then
          if
               something then
                              Do stuff
                              stuff happens
         endif;
endif;
Many nested if statements can be difficult to track, and it is very easy to forget to end them all.
You can go down your list of code to count your if and endif statements.
When I write code and write any ifs, I also write the endif so I do not forget to add it later.
If you get a random syntax error on the LAST LINE of your script, it is usually caused by an expected end statement.
************************************************** ************************************************** ************************************
************************************************** ************************************************** ************************************
************************************************** ************************************************** ************************************
************************************************** ************************************************** ************************************

3.
Selected options are not executed but no error is reported.

aroma-config
Code:
menubox(
#-- Title
  "Would you like to rdo stuff?",
#-- Sub Title
  "Please Select:",
#-- Icon
  "icons/apps",
#-- Will be saved in /tmp/aroma/whatever.prop
  "whatever.prop",

#-------------------------+-----------------[ Menubox Items ]-------------------+---------------#
# TITLE                      |  SUBTITLE                                                           |   Something  #
#-------------------------+-----------------------------------------------------------+-----------------#

  
  "Option 1","This will do some stuff",0, #-- selected.0
  "Option 2","This will something different",0, #-- selected.0
  "Option 4","This will probably explode",0, #-- selected.0
  "Option 4!","This option doesn't do sh*t but you can select if you want",1 #-- selected.0

  );
Notice #-- selected.0

updater-script

Code:
if prop("whatever.prop","selected.0")=="1" then
    #-- Do Option 1
    alert(
      #-- Title
        "This is option  1",
      #-- Text
        "Option 1, do some stuff."
    );
Notice the key is selected.0 also. If these are not matched, nothing will happen, or something else will happen depending on the key specified.

Makes sure your key values in your select boxes, check boxes, menu boxes etc. translate properly to your updater-script.
Here is a way to find out if you have your keys coded correctly:

Quote:
Originally Posted by Turge View Post
if you guys use "adb shell" and verify the contents of the prop file before running the install script (or immediately after moving to the next menu), you can see exactly what to expect and update your aroma/updater-script code accordingly:

Code:
adb shell
cat /tmp/aroma/choice.prop
cat /tmp/aroma/tweaks.prop
************************************************** ************************************************** ************************************
************************************************** ************************************************** ************************************
************************************************** ************************************************** ************************************
************************************************** ************************************************** ************************************

4. not really an error
icon usage:

Icons of any size can be supplied. But they will automatically be rendered at 72x72 pixels.
The Following 10 Users Say Thank You to Dblfstr For This Useful Post: [ Click to Expand ]
 
Dblfstr
Old
(Last edited by Dblfstr; 13th July 2012 at 02:37 PM.)
#5  
Dblfstr's Avatar
Recognized Contributor - OP
Thanks Meter 720
Posts: 2,183
Join Date: Mar 2010
Location: Huntsville, AL

 
DONATE TO ME
and this one
The Following 2 Users Say Thank You to Dblfstr For This Useful Post: [ Click to Expand ]
 
Dblfstr
Old
(Last edited by Dblfstr; 13th July 2012 at 02:37 PM.)
#6  
Dblfstr's Avatar
Recognized Contributor - OP
Thanks Meter 720
Posts: 2,183
Join Date: Mar 2010
Location: Huntsville, AL

 
DONATE TO ME
another one???
The Following 2 Users Say Thank You to Dblfstr For This Useful Post: [ Click to Expand ]
 
Dblfstr
Old
(Last edited by Dblfstr; 13th July 2012 at 02:37 PM.)
#7  
Dblfstr's Avatar
Recognized Contributor - OP
Thanks Meter 720
Posts: 2,183
Join Date: Mar 2010
Location: Huntsville, AL

 
DONATE TO ME
ok, last one...
The Following 3 Users Say Thank You to Dblfstr For This Useful Post: [ Click to Expand ]
 
ssojyeti2
Old
(Last edited by ssojyeti2; 13th July 2012 at 02:59 PM.)
#8  
ssojyeti2's Avatar
Recognized Themer
Thanks Meter 2563
Posts: 3,042
Join Date: Jan 2011
Location: North Miami Beach

 
DONATE TO ME
First lol

Great thread idea! I know you didn't exactly come up with it but glad someone finally decided to post it...
The Following 2 Users Say Thank You to ssojyeti2 For This Useful Post: [ Click to Expand ]
 
abo_mara7
Old
#9  
Senior Member
Thanks Meter 554
Posts: 555
Join Date: Oct 2010
Thanks for all your efforts. Let me kick the start off, my aroma-config is attached since it is long. I get a syntax error in line 744 which doesn't exist, last line is 740. Before that there was a code but I removed it but still get an error in the same line.
Attached Files
File Type: zip aroma-config.zip - [Click for QR Code] (4.6 KB, 268 views)
 
Dblfstr
Old
(Last edited by Dblfstr; 13th July 2012 at 03:29 PM.)
#10  
Dblfstr's Avatar
Recognized Contributor - OP
Thanks Meter 720
Posts: 2,183
Join Date: Mar 2010
Location: Huntsville, AL

 
DONATE TO ME
Quote:
Originally Posted by abo_mara7 View Post
Thanks for all your efforts. Let me kick the start off, my aroma-config is attached since it is long. I get a syntax error in line 744 which doesn't exist, last line is 740. Before that there was a code but I removed it but still get an error in the same line.
What error does it give you?

EDIT:

Code:
  #-- Uninstall button mapping
  if prop("cammode-clean.prop","selected")=="1" then
	#-- Confirm Demo 1
    if
      confirm(
        #-- Title
          "Stock mapping",
        #-- Text
          "Are you sure that you want to return to stock button mapping?",
        #-- Icon (Optional)
          "@info"
      )=="yes"
    then
      alert("Result","Done...");
    else
      alert("Result","Cancelled...");
  endif;
Line 668, I think you need another endif here. You have two 'if' but one 'endif'
My current device:
────────────────────
HTC HD2 (LEO) TmoUS 1024
OS: HyperDroid-CM7-v2.0.1
Kernal:Tytung_R9


My Work:
────────────────────
Netflix Rotation Enabled Apps: Netflix
Boot Animations: Link
Enable rotation in ANY app: Link
My Game: Floppy Fish



The Following User Says Thank You to Dblfstr For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes