Catalogue
- Directory
- Edify Overview
- edify syntax
- Mount
- Format
- Delete
- Delete_recursive
- Show_progress
- Package_extract_dir
- Package_extract_file
- Symlink
- Set_perm
- Ui_print
- Run_program
- Write_raw_image
- Assert
- File_getprop
- Resources
edify Overview
Edify is used to parse the. zip file to further install the scripting language of the Android system. The edify script is not necessarily used to update the firmware, it can also be used to replace, add, delete specific files, or even format the partition. Typically, the edify script runs when the Flash Zip package is in recovery mode.
Edify has two important files, these two files can be found in the Meta-inf/com/google/android folder in the. zip file. Each of them is:
- Update-binary: The binary interpreter that executes when the user chooses to brush people. zip is a binary file.
- The Updater-script:edify language describes the Android operating system installation script, which is a text file.
edify Syntax
Next, introduce the functions commonly used in the edify language.
Mount
Grammar
mount(fs_type, partition_type, location, mount_point);
Role
Mounts a file system to the specified mount point.
return value
- The mount point was successfully returned.
- Failed to return null.
Description
- Fs_type: "YAFFS2" or "Ext4".
- Partition_type: "MTD" or "EMMC".
- Location: partition (partition) or drive (device).
- Mount_point: Mount the destination folder for the file system.
Example
mount("ext4""EMMC""/dev/block/mmcblk0p8""/system");
- Unmount
Syntax: Unmount (mount_point).
Function: Unlocks the file system mount.
Return value: The mount point was successfully returned, and the failure returned null.
Example: Unmount ("/system");
format
Grammar
format(fs_type, partition_type, location);
Role
Formats the specified file system.
Description
- Fs_type: "YAFFS2" or "EXT4"
- Partition_type: "MTD" or "EMMC"
- Location: partition or drive
Example
format("ext4""EMMC""/cache");
Delete
Grammar
delete(file1, file2, ..., fileN);
Role
删除文件。变长参数,支持删除多个文件。
Example
delete("/tmp/boot.img");
delete_recursive
Grammar
delete_recursive(<path>);
Role
recursively deletes the directory.
Example
delete_recursive("/data/media/AppStoreWidget");
show_progress
Grammar
show_progress(fraction, duration);
Role
Show the progress bar for the following program action in recovery. The progress bar will advance fraction according to duration.
Description
- Fraction: Progress completion value in percent.
- Duration: The total number of seconds, in seconds.
- M: The maximum percentage of recovery based on Cwm is 1.33, and the maximum percentage of recovery based on TWRP is 1.
Example
show_progress(0.95000050); (ps:show_progress后面的操作可能耗时50s,完成后进度条前进95%)
Package_extract_dir
Grammar
package_extract_dir(package_path, destination_path);
Role
Release the Package_path contents of the card brush package to Destination_path.
Example
package_extract_dir("system""/system"); (ps:释放rom包中system文件夹下所有文件和子文件夹至/system)
Package_extract_file
Grammar
package_extract_file(file_path, destination_path);
Role
Extracts a single file from the ROM package to the specified destination directory.
Example
package_extract_file("boot.img""/tmp/boot.img");
symlink
Grammar
symlink(target, src1, src2, ...);
Role
Establish symbolic links to target src1, src2 ...
Description
- Target: the symbolic link target.
- SRCX: The symbolic link target point to create.
Example
symlink("toolbox""/system/bin/cat");
Set_perm
Grammar
set_perm(uid, gid, mode, file1, file2, ..., fileN);
Role
Set permissions for a single file or multiple files.
Description
- UID: User ID.
- GID: User group ID.
- Mode: Permissions.
- File1: The file path that needs to be set.
Example
set_perm(0300402755"/system/bin/ping");
- Set_perm_recursive
Syntax: set_perm_recursive (UID, GID, Dir-mode, file-mode, Path);
Role: Set permissions on files in the specified folder and folder.
Example: set_perm_recursive (0, 0, 0755, 0644, "/system");
Ui_print
Grammar
ui_print("str");
Role
The STR string content is printed in recovery, similar to the SYSTEM.OUT.PRINTLN () in Java;
Example
ui_print("+++++++++++++++++++++++++++++++++++++++++++++");
Run_program
Grammar
run_program(path, arg1, ..., argN);
Role
Executes the program with the specified parameters.
Description
- Path: The path of the program to execute
- ARGX: Run parameter information
Example
run_program("/sbin/busybox""mount""/system");
Write_raw_image
Grammar
write_raw_image(file_path, partition);
Description
- File_path: the img source file to read.
- Partition: The destination partition to write to the img file.
Example
write_raw_image("/tmp/boot.img""bootimg");
assert
Grammar
assert(condition1, ..., conditionN);
Role
If the condition evaluates to False, the run of the script is terminated.
Example
assert(package_extract_file("boot.img","/tmp/boot.img"), write_raw_image("/tmp/boot.img","bootimg"), delete("/tmp/boot.img"));
File_getprop
Grammar
file_getprop(path, key);
Role
Checks whether the specified path file contains a string of Key=value and returns value if it is included.
Example
file_getprop("/tmp/bob.txt""cool""yes"
References
- Doc:about edify
- Edify Scripts in CWM recovery
- Aroma Graphic Brush Machine
About the Edify scripting language