How To, Tutorials

How To Create or Edit An Updater Script In Android

How To Create or Edit An Updater Script In Android

In this article, we are going to learn how to create an updater script for Android or edit a script you already have. An updater-script file is simply a text file that contains all the commands which tell the clockworldmod CWM what to do with a zip file. The updater-script file is written with a scripting language.

To create an updater script you need Notepad++, It’s strongly recommended to use it instead of Notepad. You can download Notepad++ from here and install it on your PC. After downloading Notepad++, open it and from the File Menu select New, create the commands and create your own updater-script.

Warning

We are not responsible for anything that could happen to your phone. If you don’t know what you are doing then go and make some searches. If you wanna go further do it at your own risk and don’t put the finger on us if something goes wrong.

The updater-script is located in Meta-inf/com/google/android/updater-script. Below you will find all the command used in the updater-script file with the explanation what the commands do.

updater script location

Ui_print. This command prints the word inside the quotations.

Example – ui_print(“xolo – next level”); prints Xolo next level in your cwm recovery.

Mount – This command mounts the partition, so if you want to add files to system partition you have to mount system partition, data for data partition
To mount system – mount(“ext4″, “EMMC”, “/dev/block/mmcblk0p5″, “/system”);
Here mmcblk0p5 is the name of system partition for mtk 6589 chipsets (this name varies from device to device)
To mount data – mount(“ext4″, “EMMC”, “/dev/block/mmcblk0p7″, “/data”); (partition name varies from device to device)

format – This command formats the specified partition.
It is highly recommended to include this command to format system and data if you are making updater-script for ROM
To Format system – format(“ext4″, “EMMC”, “/dev/block/mmcblk0p5″, “0″);(partition name varies from device to device)
To Format data – format(“ext4″, “EMMC”, “/dev/block/mmcblk0p7″, “0″);(partition name varies from device to device)
package_extract_dir(” “, “/”) – This command extracts all the files from the folder mentioned inside first quotation to the partition or directory inside second quotation
For system – package_extract_dir(“system”, “/system”);
(this copies all files from system folder in zip to system partition in phone)
For data – package_extract_dir(“data”, “/data”);

package_extract_file(” “,”/”) – This command extracts the single file inside between the first quotation from zip to the partition or directory inside the second quotation

symlink – This command creates links to its executable files

Here is an example for super su binaries – symlink(“/system/xbin/su”, “/system/bin/su”);

create or edit updater srcipt

set_perm_recursive – This command sets permission for folders
here android uses Unix permission system
in Unix
4 – read
2 – write
1 – execute
so
rwx is 4+2+1 = 7
rw is 4+2 = 6
rx is 4+1 = 5 
Example – set_perm_recursive(0, 0, 0755, 0644, “/system”);
In this 0 is a user id for the owner that refers to root. It means that permission owner for system folder. and 0 is root user means it unrestricted access to the system. it is given in order to run programs to run properly
second 0 also refers to root. but here it refers to group id 0

set_perm – This command sets permission for a specific file
Example – set_perm(1000, 1000, 0640, “/system/etc/bluetooth/auto_pairing.conf”);
here 1000 refers to user id system and 0640 is rw-r—–
and this command sets the permission rw-r—– for the file auto_pairing.conf.

unmount – This command unmounts the partition
Example – unmount(“/system”); – unmounts system.

Related posts

Leave a Reply

Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

WordPress Theme built by Shufflehound. © 2023 All rights reserved by DoryLabs