[TUT] Create your own updater-script! - Galaxy S Advance I9070 General

To create updater-script or to edit updater-script you need Notepad++ (don’t use notepad). Download it from here and install in your pc
updater-script is located in Meta-inf/com/google/android/updater-script
To create your own updater-script
Open notepad++ and from file menu select new and create the commands and create your own updater-script with this tutorial
After typing the commands save it as all types(*.*) and name it as updater-script and click save and put it in folder Meta-inf/com/google/android/updater-script
In this tutorial i will explain you all commands used in updater-script so that you can edit or create updater-script
ui_print – This command prints the prints the word inside the quotations
Example – ui_print(“galaxy s advance”); prints galaxy s advance in your cwm recovery
mount – This command mounts the partition, 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/mmcblk0p3″, “/system”);
Here mmcblk0p3 is the name of system partition for galaxy s advance(this name varies from device to device)
format - This command formats the partition specified
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/mmcblk0p3″, “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 extract the single file inside between first quotation from zip to the partition or directory inside 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”);
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 owner that refers to root. It means that permission owner for system folder. and 0 is root user means it unrestricted access to 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
we are only seeing about folders because “set_perm_recursive” is a command that sets permission to folders
next 0755 it means rwxr-xr-x permission has been given to system folder and rw-r-r is set for all folders inside system folder
set_perm – This command sets permission for a specific file
Example - set_perm(1000, 1000, 0640, “/system/etc/bluetooth/auto_pairing.conf”);
here the 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
General rule in updater-script – all commands should end with semi colon ; otherwise it will show error and if cwm or twrp shows status 7 error the error is in updater-script
try fixing it by going through this thread

Great!!!!! I was looking for something like this, thanks
Enviado desde mi GT-I9070 mediante Tapatalk

Thanks. it took lot of time for me to understand this, after looking through suid, Unix and going through Linux permissions I understood
So I made a tut for in simple way that everyone could understand
Sent from my GT-I9070 using xda app-developers app

Thanx A lot

@PradeepMurugan Usefull Post for all. Keep it up bro.

abhinav2hd said:
@PradeepMurugan Usefull Post for all. Keep it up bro.
Click to expand...
Click to collapse
Thanks I will update this thread by adding information how to create updater-script for flashable zips soon and make thread some what beautiful soon
Sent from my GT-I9070 using Tapatalk

Thanks mate
keep up the good work

Related

[Tutorial] Edify Scripts,Making Flashable Zips

This is a WIP.
Edify Scripting Commands
I came across the problem of creating flash-able ZIP files and Edify scripting and in the interests of sharing and helping this great community I would like to share what I have found and hopefully learn more through discussion, I certainly am no expert and am always willing to learn.
So I would like to try and put together a guide to Edify scripting commands and what their function is. I hope we can all collaborate to make this a helpful source of information to all budding devs...we all have to start somewhere right!?
***Please, if there are any mistakes in this post or if you can help by adding further info please post below, thanks***
If any of you have ever flashed a zip,ROM you most probably see things written on the recovery screen like wiping data,wiping cache or CM10 by so and so.You ever wonder how these things are written??
Well the answer is in Edify script.So all those of you who wanna learn how to do all that have to learn the commands used in Edify scripting.
Interested???
Ok lets begin...
Print text in the recovery during flashing process:
Code:
ui_print("Your text here");
Code:
ui_print(" ");
This simply prints a line of text in the recovery, it has no actual effect on the flashing process, if you want a blank line just leave a blank space as the second example.
Controlling the progress bar:
I believe I understand this correctly, if not please do post below with further clarification.
Code:
show_progress(0.000000, 0);
or
Code:
set_progress(0.000000);
You have two choices when controlling the progress bar, the first example allows you to define fractions of the progress bar and how long they will take to fill. The second example just allows you to specify that the bar fills to a certain fraction at whatever point during the flashing process.
The command is defined as:
set_progress(progress bar fraction, duration in seconds to fill defined fraction);
Click to expand...
Click to collapse
For example the following code lines interspersed with your other commands would fill a fifth of the progress bar every five seconds:
Code:
show_progress(0.200000, 5);
ui_print(" ");
show_progress(0.200000, 5);
ui_print(" ");
show_progress(0.200000, 5);
ui_print(" ");
show_progress(0.200000, 5);
ui_print(" ");
show_progress(0.200000, 5);
This process will only complete if the script takes long enough to flash, therefore you need to be aware of what you are actually flashing and how long it will take when defining these values.
If you wish to just define a fraction without fill without a time scale you can use the following command:
Code:
set_progress(0.000000);
It is also best practice to include this element in your scripts as it will reassure people that their handset hasn't frozen during a flash.
Mounting/Unmounting a partition:
This has to be dealt with care as without mounting the required partition you can't do any modification.
To mount a partition you need to use the following syntax:
mount("filesystem-type", "partition-type", "device-specific-location", "mount-point");
filesystem-type: "ext3" or "yaffs2" (edison is ext4)
partition-type: "EMMC" or "MTD" (edison is EMMC)
location: Device specific address(eg. system is /dev/block/mmcblk1p21 )
mount-point: the partition you want to mount (eg./system etc)
Click to expand...
Click to collapse
Example command would be:
Code:
mount("ext3", "EMMC", "/dev/block/mmcblk1p21", "/system");
To unmount a partition you need to input the following command:
Code:
unmount("/system");
Obviously replace the mount partition with whatever partition you are working in.
Format a partition:
To format a partition you need to use the following syntax:
format("filesystem-type", "partition-type", "device-specific-location", "0");
Click to expand...
Click to collapse
Example:
format("ext3", "EMMC", "/dev/block/mmcblk1p21", "0");
Some scripts include the "0" and some do not, not sure exactly on the function difference when included or not, again clarification would be great.
Flashing the contents of your ZIP file:
To flash an entire directory i.e. to copy the contents of the entire directory from your zip into the respective folders in ROM:
Code:
package_extract_dir("system", "/system");
To flash a single file:
Code:
package_extract_file("youtube.apk", "/data");
These commands are structured as follows:
Entire directory:
package_extract_dir ("zipfileSource", "destination-partition");
Click to expand...
Click to collapse
Single File:
package_extract_file ("file", "device-specific-mountpoint");
Click to expand...
Click to collapse
Deleting folders & files:
You can delete multiple folders or files using just one command, as follows:
To delete files:
Code:
delete("file-path-1", "file-path-2", "file-path-3);
To delete folders/directories:
Code:
delete_recursive("directory-path-1", "directory-path-2", "directory-path-3");
Setting Permissions
Here are the basics for setting permissions.
If you want to research the reasons behind this, there is some useful information on Linux permissions here: chmod wiki,
Set permissions of a file or set of files:
set_perm(uid, gid, mode, "filepath1", "filepath2")
uid - user id
gid - group id
mode - permission mode
filepath... - file to set permission on
Click to expand...
Click to collapse
Example:
Code:
set_perm(0, 0, 06755, "/system/xbin/su");
Set permissions of a directory or set of directories and all files and folders within them:
set_perm_recursive(uid, gid, dirmode, filemode, "dirpath1", "dirpath2")
uid - user id
gid - group id
dirmode - permission to set to directories contained within the specified directory
filemode - permission to set to files contained within the specified directory
dirpath... - directory to set permission on
Click to expand...
Click to collapse
Example:
Code:
set_perm_recursive(0, 0, 0755, 0644, "/system");
Permissions syntax explained...so I can understand it lol (if I do then anyone can!):
The following are the pre-defined Android UID's & GID's. Taken from the following link: Android UIDs and GIDs
AID_ROOT 0 /* traditional unix root user */
AID_SYSTEM 1000 /* system server */
AID_RADIO 1001 /* telephony subsystem, RIL */
AID_BLUETOOTH 1002 /* bluetooth subsystem */
AID_GRAPHICS 1003 /* graphics devices */
AID_INPUT 1004 /* input devices */
AID_AUDIO 1005 /* audio devices */
AID_CAMERA 1006 /* camera devices */
AID_LOG 1007 /* log devices */
AID_COMPASS 1008 /* compass device */
AID_MOUNT 1009 /* mountd socket */
AID_WIFI 1010 /* wifi subsystem */
AID_ADB 1011 /* android debug bridge (adbd) */
AID_INSTALL 1012 /* group for installing packages */
AID_MEDIA 1013 /* mediaserver process */
AID_DHCP 1014 /* dhcp client */
AID_SHELL 2000 /* adb and debug shell user */
AID_CACHE 2001 /* cache access */
AID_DIAG 2002 /* access to diagnostic resources */
/* The 3000 series are intended for use as supplemental group id's only. */
/* They indicate special Android capabilities that the kernel is aware of. */
AID_NET_BT_ADMIN 3001 /* bluetooth: create any socket */
AID_NET_BT 3002 /* bluetooth: create sco, rfcomm or l2cap sockets */
AID_INET 3003 /* can create AF_INET and AF_INET6 sockets */
AID_NET_RAW 3004 /* can create raw INET sockets */
AID_MISC 9998 /* access to misc storage */
AID_NOBODY 9999
AID_APP 10000 /* first app user */
"root", AID_ROOT
"system", AID_SYSTEM
"radio", AID_RADIO
"bluetooth", AID_BLUETOOTH
"graphics", AID_GRAPHICS
"input", AID_INPUT
"audio", AID_AUDIO
"camera", AID_CAMERA
"log", AID_LOG
"compass", AID_COMPASS
"mount", AID_MOUNT
"wifi", AID_WIFI
"dhcp", AID_DHCP
"adb", AID_ADB
"install", AID_INSTALL
"media", AID_MEDIA
"shell", AID_SHELL
"cache", AID_CACHE
"diag", AID_DIAG
"net_bt_admin", AID_NET_BT_ADMIN
"net_bt", AID_NET_BT
"inet", AID_INET
"net_raw", AID_NET_RAW
"misc", AID_MISC
"nobody", AID_NOBODY
Click to expand...
Click to collapse
You will need to also understand the way file permissions are represented:
Example = drwxrwxrwx
-Use Root Explorer to find the UID, GID, and permissions for a file. Permissions are the string that looks like some variation on 'rwxr-xr--' next to each file. Long press and choose "change owner" to get the UID and GID. You just want the number next to "owner" and "group", respectively.
-If you're replacing a file, look up these settings for the existing copy and use them. If you're adding a file, just find a file that does the same functions and copy what it has (for example, installing an app to /system/app? Just look at these settings for any other app in that directory).
-MODE is technically a 4-bit string, but the first character can be omitted. There doesn't seem to be any android file permissions with the first character set. For good practice, I think it's safe to assume you can always use a leading 0 unless you know otherwise for something specific. Or, just use a 3-digit MODE, which says to leave those settings as they are (disabled by default). (I.e. 0644=644).
The next 9 characters define the file permissions. These permissions are
given in groups of 3 each.
The first 3 characters are the permissions for the owner of the file or directory.
Example = -rwx------
The next 3 are permissions for the group that the file is owned by.
Example = ----rwx---
The final 3 characters define the access permissions for everyone not part of the group.
Example = -------rwx
There are 3 possible attributes that make up file access permissions.
r - Read permission. Whether the file may be read. In the case of a
directory* this would mean the ability to list the contents of the
directory.
w - Write permission. Whether the file may be written to or modified. For
a directory* this defines whether you can make any changes to the contents
of the directory. If write permission is not set then you will not be able
to delete* rename or create a file.
x - Execute permission. Whether the file may be executed. In the case of a
directory* this attribute decides whether you have permission to enter*
run a search through that directory or execute some program from that
directory
You set these permissions using the following binary based numerical system:
Code:
0: --- No Permissions (the user(s) cannot do anything)
1: --x Execute Only (the user(s) can only execute the file)
2: -w- Write Only (the user(s) can only write to the file)
3: -wx Write and Execute Permissions
4: r-- Read Only
5: r-x Read and Execute Permissions
6: rw- Read and Write Permissions
7: rwx Read, Write and Execute Permissions
Click to expand...
Click to collapse
Default Linux permissions:
For Files:
"Read" means to be able to open and view the file
"Write" means to overwrite or modify the file
"eXecute" means to run the file as a binary
For Directories:
"Read" means to be able to view the contents of the directory
"Write" means to be able to create new files/directories within the directory
"eXecute" means to be able to "Change Directory" (cd) into the directory
Most of the time you set "Read" and "eXecute" together on directories (kind of useless when set by themselves)
Interestingly through further research it seems this system is based on the Octal Binary system...I may be wrong...
Further Commands:
In progress...
So, this is by no means an exhaustive list and I would appreciate it that if I have made any mistakes people make me aware in this thread and I can update this tutorial.
I would also like to add further commands and their uses, if people can provide more I will add them too.
I hope this helps people out! Many thanks!
Credits: wilskywalker for his guide from which I got the ideas and the knowledge.
How to create the flashable zip:
You will need the following:
Android SDK, ADB & Fastboot set up for your handset.
Notepad++
7Zip
Setting up your zip directories:
you will need to create the following folder structure (these are case sensitive):
/META-INF/com/google/android
Click to expand...
Click to collapse
All flash-able zips include this file structure, the final folder 'android' will contain two files:
update-binary
updater-script
Click to expand...
Click to collapse
update-binary: I have been unable to find much information on the update-binary file other than they seem to be chip set specific (if anyone can shed further light on these I will include it here). For the sake of compatibility I have attached the update binary from the latest CyanogenMod Nightlies for the Atrix 2 at the bottom of this thread - You can of course download the latest nightly and extract the update-binary file yourself as the attached one will obviously begin to date.
For anybody having problems flashing it is worth ensuring you have an up to date version of the update-binary (obviously the one attached to this thread will gradually become out of date).
updater-script: This we can create ourselves, to ensure it works properly we will use Notepad++.
Open Notepad++ and start a new file, with the following settings:
Format: Unix
Encoding: ANSI
Default Language: Normal Text
Click to expand...
Click to collapse
Save this file as:
File name: updater-script
File type: All types (*.*)
Click to expand...
Click to collapse
You can now begin writing your edify script in this file.
I'm explaining a simple example script for your better understanding.
Code:
assert(getprop("ro.product.board") == "edison");
ui_print(" ");
ui_print("confirming device edison");
ui_print(" ");
ui_print("success");
ui_print(" ");
show_progress(0.200000, 5);
ui_print("Mounting your system...");
mount("ext3", "EMMC", "/dev/block/mmcblk1p21", "/system");
ui_print(" ");
show_progress(0.200000, 5);
ui_print("updating system files");
package_extract_dir("system", "/system");
ui_print(" ");
show_progress(0.200000, 5);
ui_print("unmounting system");
unmount("/system");
ui_print(" ");
show_progress(0.200000, 5);
ui_print("by your name");
show_progress(0.200000, 5);
ui_print(" ");
***EMPTY LINE***
assert(getprop("ro.product.board") == "edison");
Click to expand...
Click to collapse
This is checking you are flashing the correct handset, this is not a requirement, but is best practice. Just insert another device name in the place of "edison" if you so wish, or remove the command all together.
mount("ext3", "EMMC", "/dev/block/mmcblk1p21", "/system");
Click to expand...
Click to collapse
This is the specific mount point for the edison system partition, if you wish to flash a different partition, data for instance you can get the mount points for your device by entering the following code over ADB:
Code:
adb shell "mount > /sdcard/PHONENAME_mountinfo.txt"
This will place a text file on your sdcard with the mount points for your specific device (remember to swap 'PHONENAME' with your device name e.g. 'edison').
Additionaly here are the mount points for data and cache for A2
Cache:
mount("ext3", "EMMC", "/dev/block/mmcblk1p22", "/cache");
Click to expand...
Click to collapse
Data:
mount("ext3", "EMMC", "/dev/block/mmcblk1p25", "/data");
Click to expand...
Click to collapse
package_extract_dir("system", "/system");
Click to expand...
Click to collapse
This command extracts the files you wish to flash from the zip and flashes them to the phone, it is formatted as follows ("package-path", "/destination-path"). So for this example you are telling it to flash everything from the 'system' folder in your zip to the /system partition of your handset. You can obviously change these values for different partitions.
unmount("/system");
Click to expand...
Click to collapse
This simply unmounts whatever partition you previously mounted.
ui_print(" ");
Click to expand...
Click to collapse
Shows text in the recovery whilst the flash is ongoing, you can put whatever you please between the double quotes, you must leave a space if you wish to have a blank line.
show_progress(0.200000, 5);
Click to expand...
Click to collapse
Controls what the progress bar in the background is displaying, it is formatted as follows (fragment, seconds).
***EMPTY LINE***
Click to expand...
Click to collapse
This is not actually text, you simply need to leave a blank line at the end of your script before you save it for it to work.
FYI, this means in fact your script could look like this and still work:
Code:
ui_print(" ");
show_progress(1.000000, 30);
mount("ext3", "EMMC", "/dev/block/mmcblk1p21", "/system");
package_extract_dir("system", "/system");
unmount("/system");
ui_print(" ");
***EMPTY LINE***
But that just isn't that pretty, or as deceptively complicated lol!
Make sure you save your edify script.
Files to flash:
You now need to create a further folder, this needs to be named based on where within the system you are flashing, for the sake of this example we are flashing to the system partition, so create this folder path(of course the structure depends on what are files you need to flash and their location):
/system/app
Click to expand...
Click to collapse
Place whatever files you wish to flash within this file e.g:
/system/app/nameofapp.apk
Click to expand...
Click to collapse
Creating your .zip file:
Select both of your top directories and their contents 'META-INF' and 'system' and package them into a .zip file with 7zip using the following settings:
Archive: name_of_your_file
Archive Format: zip
Compression level: Store
Update mode: Add and replace files
Click to expand...
Click to collapse
And there you have it, your very own flash-able .zip file.
How to sign your update.zip:
You don't actually need to sign your zip file for it to work as most custom recoveries now support unsigned zips, for aspiring developers and the more cautious among us though the how to will be updated later.
For now you can use the META-INF folder from the attached zip as is just modify the updater-script according to your requirments.
How to create your own private signing key & certificate:
You will need the following download:
Open SSL
If you want to create your own private keys for signing, here's what you need to do.
As before extract the OpenSSL files to a folder in the root of your c:\ drive, preferably named 'openssl' for ease of cmd line navigation. Then input the following:
Code:
cd\openssl\
openssl genrsa -out key.pem 1024
openssl req -new -key key.pem -out request.pem
openssl x509 -req -days 9999 -in request.pem -signkey key.pem -out certificate.pem
openssl pkcs8 -topk8 -outform DER -in key.pem -inform PEM -out key.pk8 -nocrypt
You can then replace 'key.pk8' & 'certificate.pem' with your own files.
I have attached an example flashable .zip file that includes a updater-script and the update-binary.Use that as a base or example to set your zip up.
I really hope this has helped folks out, if so please consider hitting the 'Thanks' button!
Happy flashing!
May the -Mass times Acceleration-be with you...
Thanks a TON!! You must've read my mind because I planned on trying to figure this out this weekend.lol BTW, what program are you using to write these scripts?
Brought to you by time and relative dimensions in space.
1BadWolf said:
Thanks a TON!! You must've read my mind because I planned on trying to figure this out this weekend.lol BTW, what program are you using to write these scripts?
Brought to you by time and relative dimensions in space.
Click to expand...
Click to collapse
Lol.
Notepad++ is the unanimous choice.
Also always leave one blank line at the bottom or the script won't work.
May the -Mass times Acceleration-be with you...
deveshmanish said:
Notepad++ is the unanimous choice.
Also always leave one blank line at the bottom or the script won't work.
May the -Mass times Acceleration-be with you...
Click to expand...
Click to collapse
I thought so but wanted to be sure. Thanks again.
Brought to you by time and relative dimensions in space.
Thanks for putting this together..
At first it seems a little complex for an aspiring modder, but still a great reference for the novice as well as the experienced modders..
Maybe offer some example scripts..? Feel free to use some from any of my zips.. Also, that goes for people trying to make their own - look at what others have done as examples.
Also might be worth noting the default permissions for system are 0644 - meaning if you are only installing things that need those perms (like an .apk, .jar or .so, etc), then you don't need to specify permissions in the updater-script.
EDIT: another text editor worth trying is Sublime Text 2 (thanks to cogeary for the tip) - need to eventually pay for the license (or find another way around it) or you will get pop-ups.
It's for both Windows and Linux (I use it in Ubuntu constantly, and mostly Notepad++ in Windows).
Sent from my MB865 using xda app-developers app
alteredlikeness said:
Thanks for putting this together..
At first it seems a little complex for an aspiring modder, but still a great reference for the novice as well as the experienced modders..
Maybe offer some example scripts..? Feel free to use some from any of my zips.. Also, that goes for people trying to make their own - look at what others have done as examples.
Also might be worth noting the default permissions for system are 0644 - meaning if you are only installing things that need those perms (like an .apk, .jar or .so, etc), then you don't need to specify permissions in the updater-script.
Sent from my MB865 using xda app-developers app
Click to expand...
Click to collapse
I'm definitely going to try and make this simpler.BTW great idea of putting sample zips together for reference.Thanks.
And yeah some stuff needs to be added even the path for data and cache partitions.And also I'm thinking of adding a slight explanation of busybox.The folder structure of a zip and what files it contains those are also on the to-do list.
Will get back to this once I'm done playing with MIUIv5.Enjoying it so far.
May the -Mass times Acceleration- be with You...
OP updated with guide to create the flashable zip.
Nice Tut Sir Its Very Helpful...
Yeah... I love this thread and use it often too excellent job op!
Interesting tutorial. What got me interested in this thread is. I want to convert a recovery.img to a flashable recovery zip so I can easily switch recoveries without odin. I have seen apps that can create flash zip automatically, but none of them support of adding recovery.img. Thanks.

[Guide] Making Mod Pack for a ROM

its about making patch modpack for my rom and
making update script full...
So,Let's start...
________________________________________
________________________________________
How to make modpack or patch...
Frist make sure that what you want to add on your
rom..like i want to add my modded
systemui,framwork_res,some importent app,some
brinery like su,mkbootimg,some wallpaper,new
ringtone,boot logo,boot animation and some app
with data...
ok now i explain you somethings which are very
very important...
frist in a modpack this folders are added..like>>>
1.Meta_inf
2.data
3.sdcard
4.system...etc etc...
you will also see more folder or file but now i will
tell you about this folders ^^^...
1.Meta_inf...
i think everybody know this folder...i give a short
example...
in this folder you will found update script and
update brinary...
[Q]what is update script?
[Ans.] updater-script - it is just a text file which
contains all the commands which tells the
clockworkmod what to do with the given
zip file. the updater-script is written in the edify
scripting language.
[Q]what is update brinary?
[ans] update-binary - it is a binary which is
requiered by the clockworkmod to translate the
human readable format of the updater-
script to machine readable format for execution
of the updater-script in our device.
now i think you would understand what is update
script and brinary...
ok now 2.Data folder...in data folder you can add
some app with data...fir this what you need?!!
Frist install your app on your mobile and mod
it...like i want to add Xposed installer with
frimwere updated in my modpack...so frist i
installed the app and open it..then click on install/
update...then reboot my device...now my modding
was complete...now its time to add it with data...
.
so i made a folder on sdcard like (modpack for my
rom) then open it and made another folder name
(data) then in data folder i made two folders like
(app) and (data)
then i opened root explorer and went to root
derectory...then go to data...then go to app folder
and choosed my app thats mean xposed...then
copied it to sdcard/modpack/data/app and again
go to root derectory/data...this time i go to data
folder and find my apps data.then copy it to
sdcard/modpack/data/data...thats all...
This is an example...now you can add you app
with data like i had added...but i recommend you
that dont add more then 4 apps with data...
ok now 3.sdcard...
by this folder you can add anythings to your
sdcard...like i want to add some themes of mi
home luncher and all kernel,profile of viper 4
fx...frist made (sdcard)folder on your sdcard/
modpack...now copy all things from your sdcard
which you want to add..like i copied viper4fx
folder from my sdcard and paste it to sdcard/
modpack/sdcard...you can add themes in this way
too...just copied the themes with the whole
derctory in your sdcard/modpack/sdcard
folder...like i copied miui folder to my sdcard/
modpack/sdcard folder...beacuse all themes of
miui are in miui folder...
now comes 4.System folder.. so make a folder
(system) on your sdcard/modpack...then open
system folder and made some folder like
app,etc,lib,bin,xbin etc if you want to add
somethings on your roms system folder..i think
every body know this folder...if you want to add
your modded app,just sing it and drop it to...
Now full completed...you can see some extra
folders and files...if you want to add these to then
comment here i will told you how add these
folder...or you can pm me too
________________________________________
now its time to make update script for your
modpack..
...........
frist copy a meta_inf to your sdcard/modpack and
open update script...delect all things...
you can edit this line as your wish>>>
ui_print(“xolo – next level”);
now see what is ui print?
ui_print – This command prints the prints the
word inside the quotations
Example – ui_print(“xolo – next level”); prints
xolo next level in your cwm recovery
______________________
then you need to mount system partition...and
also another pertition like data,etc (if you want
to add anythings to this folderd)...but no need to
mount sdcard...For mount system-
mount(“ext4″, “EMMC”, “/
dev/block/mmcblk0p5″, “/system”);
if you want to mount data folder then write data
insted of system like-
mount(“ext4″, “EMMC”, “/
dev/block/mmcblk0p5″, “/data”);
okey...done mounting...
Now see what is mount?
mount – This command mounts the partition, 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)
_____________________
Now formating...what is format>
format - This command formats the partition
specified
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)
NB.dont use it in your modpacks script its for
custom rom....
_______________________
Now you done mounting and its time to install all
things in all folder thats mean extracting...like
sustem folder will extract in your system
pertition...data folder will be in data pertition
and sdcard folder in your sdcard...for extract
system files use this command>>>
package_extract_file(”system“,”/system”)
for data>>> just delect system and add data like.
package_extract_file(”data“,”/data”)
for sdcard do same...
Now what is this>>>
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”);
____________________
Ok now symlink...
symlink("mksh", "/system/bin/sh");
the above command creates a symlink.
okay, now let's see about symlinks,
symlink is nothing but shortcuts, for example if
a file is requiered in two different places instead
of copy pasting the file
in two different locations, the file is copied to
one of the two locations and in the other
location a shortcut to the file(symlink)
is created. the source and the symlink can have
different names (actually this is the prime use
of symlinks).
to explain in a noob friendly manner,
take the above symlink, it creates a shortcut
(symlink) for the command "mksh" and places
it in the path of the operating system.
the shortcut(symlink) directs to the file "/
system/bin/sh" , so whenever the os gets a
request to execute the "mksh" command, the
actual
binary that gets excuted will be "/system/bin/
sh" .
creating symlinks saves a lot of space because
instead of copying the whole file and placing it
in requiered places we are just
creating shortcuts which directs to the source
file which can be placed anywhere in the file
system (generally placed in the path of the os)
i think you understood...if you not then dont
use...its just use then when you want to add
somethings on system/bin folder and its for
advance user..
______________________
ok now seting permission..its not need if you
wont want anything in system/bin...but if add
then you must need add permission for this gile
and seting petmission are really too much easy
and so funny just see what is it and how to
set>>>
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 owner that refers to
root. It means that permission owner for
system folder. and 0 is root user means it
unrestricted access to 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
we are only seeing about folders because
“set_perm_recursive” is a command that sets
permission to folders
next 0755 it means rwxr-xr-x permission has
been given to system folder and rw-r-r is set
for all folders inside system folder
hope you understan...
___________________
Now another things...and its use in seting
permissions to but its defferent just see>>>
set_perm – This command sets permission for
a specific file
Example - set_perm(1000, 1000, 0640, “/
system/etc/bluetooth/auto_pairing.conf”);
here the 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
this is use for one files auto_praing.conf
__________________
Now you need to unmount these folder which you
mounted...see it>>>
unmount – This command unmounts the
partition
Example - unmount(“/system”); – unmounts
system...you need to unmount another folder
too..like for unmount data>>>
unmount(“/data”);
___________________
ok guys all done...i hope you understood all that i
have told...if you not then ignore it...and now try
to make a script for your modpack...
____________________
now give you a short example of my modpack and
update script...
...................
in my modpack i have these folders>>>
1.meta_inf,
2.data,
3.sdcard,
4.system,
.....now have a look in my script >>>
ui_print("====================
===============");
ui_print("Installing cayno x v2 modpack for all
cayno x users");
ui_print(" ");
ui_print(" By: MD.Shafikul main dev of cayno x ");
ui_print("====================
===============");
ui_print("");
ui_print("mounting system");
show_progress(0.500000, 0);
mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/
system");
ui_print("mounting data");
mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/
data");
show_progress(0.200000, 0);
ui_print("[ ] Installing all files");
package_extract_dir("system", "/system");
show_progress(0.200000, 0);
package_extract_dir("data", "/data");
ui_print("installing themes ");
package_extract_dir("sdcard", "/sdcard");
set_perm(0, 1000, 0755, "/system/xbin/busybox");
symlink("/system/xbin/busybox", "/system/bin/
busybox");
ui_print("letast busybox installed");
run_program("/system/xbin/busybox", "--install", "-
s", "/system/xbin");
ui_print("installing abrouted!");
show_progress(0.500000, 0);
set_perm(0, 0, 06755, "/system/xbin/su");
symlink("/system/xbin/su", "/system/bin/su");
set_perm_recursive(0, 0, 0777, 0777, "/system/etc/
init.d");
ui_print("init.d activated!");
ui_print("jocking man... ");
show_progress(0.200000, 0);
unmount("/system");
ui_print("[*] unmount system succeced! ");
unmount("/data");
ui_print("[*] unmount dataoo succeced! ");
unmount("/sdcard");
ui_print("");
ui_print(" Thanks for downloading cayno x ");
ui_print(" Auto rebooting ");
sleep(2);
ui_print(" Please wait... ");
sleep(2);
run_program("/sbin/sleep", "5");
run_program("/sbin/reboot");
^^^^^thats all that i wrote
_______________________________________
NB.(must read)>>>1.General rule in updater-script
– all commands
should end with semi colon ; otherwise it
will show error and if cwm or twrp shows status
7 error the error is in updater-script
2.if you dont understand then ignore beacuse its
can bootlooped...
3.if felt in installing zip then pm me pr comment
here or give me your script i will try my best to
correct it...
4.if the post help you,then give me some
respect...please..
5.dont forget to click on like botton its can
inspared me to write more post...
6.if you copy these post then give me credit,if
you not then i will understood that you are a
busted...
7.and never stop customization
Credit goes to my friend Md. Shafiqul for writting this..
HIT A THANKS IF I HAVE HELPED YOU

[Tutorial] How to emulate Second Partition on SD-Card without formatting

[TUTORIAL] SCROLL DOWN BELOW TO NEXT POST
Seems i have accidentially written the nearly same Init.d Enabler like term-init.sh by Ryuinferno @ XDA.
the small different, no busybox run-parts required, and install-recovery-2.sh is used (because SuperSU is running from install-recovery.sh)
However, main intent was to increase internal memory with Bulent Akpinar's Link2SD, but without using a 2. partition.
First have installed Androguide.fr's Universal Init.d, but the scripts were executed delayed. a quick view in SuperSU daemon install-recovery.sh proposed me to write my own script, so i decided to uninstall the App. besides this i highly recommend this app! always give it a try first (i just later realized that this is another version of term-init.sh - which i found on XDA after i was finished and decided to share...)
Once the init.d job was running, it turned out the delay wasn't Universal Init.d App's fault. instead the reason is the Android OS is mounting sdcard delayed. this means the provisional watchdog mount script 00_mount_sdext2.sh becames unusable for me. anyway i keep it attached for using with 2. partition. the final Link2sd mount script 4.3+ 00_mount_sdcardtmp.sh is pre-mounting the sdcard first, then mounting the ext4 image file. both files are just examples and will not work for you without modifying the paths.
Stock kernel does support init.d, but SuperSU is required for this. for better understanding please read Pandages' short description how it works.
For Link2SD i have installed a ext4 image file located on external microSD Card. Due the limitation of FAT32 file systems, the maximum file size is 4 GB. However, some busybox binaries are compiled without large file support and cannot create files bigger then 2 GB - thats why this download comes with busybox. if you don't have arm cpu, there is a copy of busybox /system/xbin/busybox.bak which you must manually rename.
initial create empty ext4 image file
Code:
busybox dd if=/dev/zero of=/sdcard/.data.sdext2.img bs=4k count=1048576
busybox mke2fs -T ext4 -F -q /sdcard/.data.sdext2.img
run the commands from adb shell or terminal emulator
the dd command creates a new file on sdcard. the file size is specified with count.
the mke2fs command is formatting the image file with ext4 file system.
the (.) dot in front makes a filename hidden.
helpful commands for initial gathering
Code:
busybox df
busybox cat /proc/partitions
busybox mount
all mount points with same size usually have identical partition (group by block size). query for matching major + minor in /proc/partitions and find the name (for example /dev/block/mmcblk1p1). make sure the mount point exists and is empty, or create a new folder (for example /storage/sdcardtmp). mount shows the file system type (for example vfat).
modify the paths in 00_mount_sdcardtmp. you have to define two different mounts. the mount point for Link2SD is /data/sdext2.
After this, Link2SD now detects 2. partition on boot. but instead of a 2. partition you just have a single image file on sdcard (which can easily copied for backup)
the download includes a small install shell script which just copy the files into /system. provision for making files executable is unpacking the downloaded zip file init_d.zip to /data/local/tmp. don't forget to set permissions after unpacking.
[TUTORIAL] PLEASE CLICK HERE TO EXPAND PICTURES
(rotate the page to landscape for best view)
1. UNPACK THE FILES2. SET PERMISSIONS
extract file init_d.zip tomake busybox and
/data/local/tmpinstall.sh executable
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
3. INSTALL init.d
execute the shell scriptmake sure script was
install.sh with su permissionsfinished successfully
(or terminal command: "su -c sh install.sh)"(or you already have init.d support?)
4. GATHER SDCARD PARTITION PARAMETERS
Read Driver and Device Numbers
open a root shell. make sure you have su permissions (type "su").
type "busybox df"
identify the external microSD Card folder. its usually "/storage/sdcard"
(or something, and symlinked to "/sdcard")
group all mount points with same size (group by block size)
find the related filesystem, starting with "/dev/block/vold/puplic:179,97"
(or something)
Find the Block Partition
open a shell
type "busybox cat /proc/partitions"
identify Driver and Device Numbers, for example major = 179, minor = 97
find the name. complete the path, starting with "/dev/block/mmcblk1p1" (or something)
Copy the Mount Options
open a shell
type "busybox mount"
identify the related filesystem, starting with "/dev/block/vold/puplic:179,97" (or something)
find the filesystem type, for example "vfat" (depends on microSD Card)
copy the mount options. usually from "rw" to "uid/gid"
5. CREATE THE MOUNT SCRIPT
use Mount-Button to make system partition read-write able
(or terminal command: "su -c busybox mount -o remount,rw /system")
navigate to folder "/system/etc/init.d"
delete the example file "00_mount_sdext2" (not required)
open the example file "00_mount_sdcardtmp" in text editor
MODIFYING THE init.d MOUNT SCRIPT EXAMPLE
Pre-mounting external microSD Card
edit the first mount line. usage: mount -t <type> -o <options> <source> <target>
Source: "/dev/block/mmcblk1p1" (Block Partition, see above 4.)
Target: "/storage/sdcardtmp"
Filesystem type: "vfat" (see above 4.)
Options: "rw, ..." (see above 4.)​example: "mount -t vfat -o rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015 /dev/block/mmcblk1p1 /storage/sdcardtmp"​Mounting the ext4 image file
the second mount line is like the first mount, except the source is a file. thus requires the additional mount option "loop". further use same mount options as used for "/data" (usually from "rw" to "uid/gid"). these might be different from above.
Source: "/storage/sdcardtmp/.data.sdext2.img" (Image File, see below 7.)
Target: "/data/sdext2" (see below 6.)
Filesystem type: "ext4" (see below 7.)
Options: "loop,rw, ..."​
6. PREPARING MOUNT POINTS
Make sure the target folders exists and folders are empty. consider that file names are case-sensitive.
You can create a new mount point asFor Link2SD a fixed mount point
well. the folder name for microSD Cardis defined, the folder name is
is an example, vary it as you like.detected from app.
use Mount-Button to make root directory read-write able
(or terminal command: "su -c busybox mount -o remount,rw /")
navigate to folder "/storage"
create new folder "/storage/sdcardtmp"
navigate to folder "/data"
make sure the identical path is specified
in mount script "00_mount_sdcardtmp"
(see above)
create new folder "/data/sdext2"
7. CREATE THE EXT4 IMAGE FILE
Finally, create the Image File "/storage/sdcardtmp/.data.sdext2.img". the file name is an example, vary it as you like. choose a location anywhere on external microSD Card. the (.) dot in front of filename makes a file hidden.
identify the external microSD Card folder.
its usually "/storage/sdcard" symlinked to "/sdcard"
calculate the number of blocks.
the maximum file size is 4096 bytes x 1048576 = 4294967296 bytes (4 GiB)
open a shell
create a new file with busybox "dd" command
Code:
busybox dd if=/dev/zero of=/sdcard/.data.sdext2.img bs=4k count=1048576
wait 10 minutes
format the file with busybox "mke2fs" command. the filesystem type is "ext4"
Code:
busybox mke2fs -T ext4 -F -q /sdcard/.data.sdext2.img
make sure the identical file name is specified in mount script "00_mount_sdcardtmp"
(see above)
8. MOUNT THE (EMULATED) SECOND PARTITION
Test the mount script
open a root shell. make sure you have su permissions (type "su")
type "sh /system/etc/init.d/00_mount_sdcardtmp"
type "busybox df"
if successful, there are two new mounts "/storage/sdcardtmp" and "/data/sdext2"​
Check the mount options
type "busybox mount"
identify the new mount points "/storage/sdcardtmp" and "/data/sdext2"
compare the mount options. they should be similar:
"/dev/block/vold/puplic:179,97" = "/storage/sdcardtmp"
"/data" = "/data/sdext2"
(or something)
FINISH. REBOOT THE PHONE. CHECK IF SUCCESSFUL
NOTE: IF YOU WON'T GO THROUGHT THIS MANUALLY CODING TORTURE
there is an app from google play called Mount2SD the solution as it has most of the mount scripts needed. It won't work with encryption. I personally prefer the loop file method descriped here (and never tested it), but looks like a good alternative for Link2SD
NOTE: The following apps are used:
For older versions (screenshots) please see Attached Files below
I found the tar.gz but its so difficult for me i dont understand
for unpacking, busybox or any unpacking app is needed. for example root explorer can browse tar.gz files and extract it.
for manually unpacking the tar.gz
Code:
busybox gunzip -c init_d.tar.gz | busybox tar -vxC /data/local/tmp
This is the screenshot command u ask me for
But i just download your file it is still in download folder .. should i unpack init.d.tar.gz first ? And then send u the command ?
Btw the screenshot is from last to first start with busybox df
Sorry i never seen newer android, knox is a new thing to me. seems like the /data partition is emulated, maybe it is not available during boot?
you can try to pre-mount sdcard. in your case it is /dev/block/vold/puplic:179,33 - (major = 179, minor = 33) - which is equal to /dev/block/mmcblk1p1. the mount point is /storage/31D1-1308 - but its not empty, so you have to create a new folder for example /storage/31D1-1308tmp (which must re-created from your init.d script on every boot). the file system type is sdfat. the mount options i am not sure. try rw,dirsync,nosuid,nodev,noexec,noatime,nodiratime,uid=1023,gid=1023 (taken from your screenshots)
this is for the first mount. check if it works, you should see files in /storage/31D1-1308tmp (and new mount is listed in busybox df). you can check the mount command on adb shell or terminal emulator, it works during runtime.
for the second mount then create a ext4 image file first. then mount /storage/31D1-1308tmp/.data.sdext2.img to /data/sdext2 type ext4 with options loop,rw,nosuid,nodev,noexec,relatime,low_uid=1023,low_gid=1023,gid=9997 if success /data/sdext2 is listed in busybox df.
if mount works on adb shell, but not in mount script, increase the timer busybox sleep 4

CONVERSION CWM/TWRP backup-files to .IMG files (for Bootloader>FlashBoot Flash) ?

Hello all,
My Chinese notwellknown phone model does not have TWRP, but I have made live TWRP/CWM (yes both) backup files:
system.ext4.win (TWRP) and its md5
system.ext4.tar and (CWM) and its md5.
If one day, I have a bootloop and want to restore those file via Bootloader: (Power button & Vol-)
then: fastboot -S 130M flash system system.img
So how do I create a "system.img" from one of the files above (system.ext4.win or system.ext4.tar) ?
A) Before someone sidetrack the topic, I have done MANY TIMES SUCCESSFULLY the command: fastboot -S 130M flash system "stock-system-file.img" with this phone ( .img extracted from stock zip/tar). (* 1)
B) I didn't ask: "Is there other way to restore ?" I asked: How to convert *.ext4.win (twrp) or *.ext4.tar (cwm) files to .img files just like the ones uncompressed from a stock zip/tar.
(*1) Of course there are other ways to restore, like temporarily fastboot boot twrp.img then restore from there or from twrp>adb. But that's not what the question is asking.
........... Thank you everyone ...........
sintoo said:
Hello all,
My Chinese notwellknown phone model does not have TWRP, but I have made live TWRP/CWM (yes both) backup files:
system.ext4.win (TWRP) and its md5
system.ext4.tar and (CWM) and its md5.
If one day, I have a bootloop and want to restore those file via Bootloader: (Power button & Vol-)
then: fastboot -S 130M flash system system.img
So how do I create a "system.img" from one of the files above (system.ext4.win or system.ext4.tar) ?
A) Before someone sidetrack the topic, I have done MANY TIMES SUCCESSFULLY the command: fastboot -S 130M flash system "stock-system-file.img" with this phone ( .img extracted from stock zip/tar). (* 1)
B) I didn't ask: "Is there other way to restore ?" I asked: How to convert *.ext4.win (twrp) or *.ext4.tar (cwm) files to .img files just like the ones uncompressed from a stock zip/tar.
(*1) Of course there are other ways to restore, like temporarily fastboot boot twrp.img then restore from there or from twrp>adb. But that's not what the question is asking.
........... Thank you everyone ...........
Click to expand...
Click to collapse
Here is a thread for converting TWRP/CWM backups into a flashable zip. I know you aren't looking for how to create a flashable zip but the guide instructs how to extract the system.ext4.win and system.ext4.tar to get the system.img from the backup, this is the part that you need.
https://forum.xda-developers.com/showthread.php?t=2746044
Sent from my SM-S767VL using Tapatalk
first, system.img usually can be downloaded somewhere, no need to restore twrp backup for system. don't you think you will find a download? second, if you restore system you may required to restore vendor and boot too. boot.emmc.win can be flashed from fastboot directly, but for vendor you need to convert. the same way. third, system.img can have different formats. you need to know which file system type, partition size, and if it is sparsed image or not. file system type is EXT4 in your case because twrp backup is named system.ext4.win
for "converting" the system.ext4.win* file(s) into system.img you do it in two steps. first you need to create a empty ext4 image file. after the empty disk image is mounted somewhere, you simply unpack the backup files into the mounted disk. so it's not really converting, more like copying.
You need a linux machine for this
so let's begin with partition size
on a working device you can simply check from system or recovery. find the symlink, resolve the symlink for system, get #blocks (=size) for respective block partition, for example mmcblk0p99
for some reason xda blocks code for ls -l (lower case -L there is no space between)
Code:
find /dev/block -name by-name
ls - l /dev/block/platform/bootdevice/by-name
cat /proc/partitions
Note: the above commands need to be run on target android device only. use adb shell or terminal emulator. all other commands below need to be run on host linux pc
if gathering partition size on the device itself is not an option for you, if you have a mediatek chipset you can simply look into scatter file. OTA zip files most likely contain scatter file. if you don't have a scatter file for your ROM version, you can create your own scatter file with WwR MTK
use hex2dec calculator for partition_size: 0x9C800000 = 2625634304 bytes = 2564096 KiB (#blocks)
if you don't have mediatek device i am running out of ideas. you can boot into twrp from fastboot and check, or find a ROM and check the file size hopefully it is not a sparsed image.
Once you know the partition size, now proceed to create a empty file (avoid to do this on fat32 host if size is bigger > 4 GiB)
and format the file to ext4 (or f2fs if needed)
Code:
dd if=/dev/zero of=system.img bs=1 count=0 seek=2625634304
mke2fs -t ext4 system.img
if all went well you can create a mount point on host and mount the empty disk image. the following commands need to be run with root permissions. you can do it from sudo or as root
Code:
mkdir system
sudo -i
cd /home/$SUDO_USER
mount -t ext4 -o loop,rw,noexec,noatime system.img system
you can now unpack the tar files into system. make sure the folder structure remains intact, if the archive contains the folder /system you should unpack to ~ (this will create all files in ~/system) otherwise you need to unpack to ~/system (or cd into ~/system)
for cwm all files need to be concatenated. for twrp do not concatenate each file is a standalone tar archive. if you have android > kitkat 4.4.2+ make sure you use the proper flags for selinux context
Code:
tar --selinux --xattrs --numeric-owner -vxpf system.ext4.win000
tar --selinux --xattrs --numeric-owner -vxpf system.ext4.win001
or
Code:
cat system.ext4.tar000 system.ext4.tar001 | tar --selinux --xattrs --numeric-owner -vxp
the unpacking may produce errors malformed header or something, make sure all files extracted anyway. i have read somewhere better use star instead of tar which can handle twrp files in the right way, unfortunately haven't tested yet
to avoid any problems with permissions you should check/set for system again
Code:
chown -h 1000:1000 system
chmod 0755 system
chcon -h --reference system/bin system
after unpacking just unmount the disk image
Code:
umount system
rmdir system
exit
If you want to create a sparse image you can use the img2simg tool
Code:
sudo apt-get install android-tools-fsutils
img2simg system.img system.smg
This method is just written on the fly especially for your request, everything untested. I really don't know if this file is flashable from fastboot, do it at your own risk!
aIecxs said:
first, system.img usually can be downloaded somewhere, no need to restore twrp backup for system. don't you think you will find a download? second, if you restore system you may required to restore vendor and boot too. boot.emmc.win can be flashed from fastboot directly, but for vendor you need to convert. the same way. third, system.img can have different formats. you need to know which file system type, partition size, and if it is sparsed image or not. file system type is EXT4 in your case because twrp backup is named system.ext4.win
for "converting" the system.ext4.win* file(s) into system.img you do it in two steps. first you need to create a empty ext4 image file. after the empty disk image is mounted somewhere, you simply unpack the backup files into the mounted disk. so it's not really converting, more like copying.
You need a linux machine for this
so let's begin with partition size
on a working device you can simply check from system or recovery. find the symlink, resolve the symlink for system, get #blocks (=size) for respective block partition, for example mmcblk0p99
for some reason xda blocks code for ls -l (lower case -L there is no space between)
Code:
find /dev/block -name by-name
ls - l /dev/block/platform/bootdevice/by-name
cat /proc/partitions
Note: the above commands need to be run on target android device only. use adb shell or terminal emulator. all other commands below need to be run on host linux pc
if gathering partition size on the device itself is not an option for you, if you have a mediatek chipset you can simply look into scatter file. OTA zip files most likely contain scatter file. if you don't have a scatter file for your ROM version, you can create your own scatter file with WwR MTK
use hex2dec calculator for partition_size: 0x9C800000 = 2625634304 bytes = 2564096 KiB (#blocks)
if you don't have mediatek device i am running out of ideas. you can boot into twrp from fastboot and check, or find a ROM and check the file size hopefully it is not a sparsed image.
Once you know the partition size, now proceed to create a empty file (avoid to do this on fat32 host if size is bigger > 4 GiB)
and format the file to ext4 (or f2fs if needed)
Code:
dd if=/dev/zero of=system.img bs=1 count=0 seek=2625634304
mke2fs -t ext4 system.img
if all went well you can create a mount point on host and mount the empty disk image. the following commands need to be run with root permissions. you can do it from sudo or as root
Code:
mkdir system
sudo -i
cd /home/$SUDO_USER
mount -t ext4 -o loop,rw,noexec,noatime system.img system
you can now unpack the tar files into system. make sure the folder structure remains intact, if the archive contains the folder /system you should unpack to ~ (this will create all files in ~/system) otherwise you need to unpack to ~/system (or cd into ~/system)
for cwm all files need to be concatenated. for twrp do not concatenate each file is a standalone tar archive. if you have android > kitkat 4.4.2+ make sure you use the proper flags for selinux context
Code:
tar --selinux --xattrs --numeric-owner -vxpf system.ext4.win000
tar --selinux --xattrs --numeric-owner -vxpf system.ext4.win001
or
Code:
cat system.ext4.tar000 system.ext4.tar001 | tar --selinux --xattrs --numeric-owner -vxp
the unpacking may produce errors malformed header or something, make sure all files extracted anyway. i have read somewhere better use star instead of tar which can handle twrp files in the right way, unfortunately haven't tested yet
to avoid any problems with permissions you should check/set for system again
Code:
chown -h 1000:1000 system
chmod 0755 system
chcon -h --reference system/bin system
after unpacking just unmount the disk image
Code:
umount system
rmdir system
exit
If you want to create a sparse image you can use the img2simg tool
Code:
sudo apt-get install android-tools-fsutils
img2simg system.img system.smg
This method is just written on the fly especially for your request, everything untested. I really don't know if this file is flashable from fastboot, do it at your own risk!
Click to expand...
Click to collapse
Cygwin works as well, it doesn't necessarily "have" to be Linux.
There is a post for using Cygwin as well in the thread that I linked.
More than one way to "skin this cat", so to speak. I'm sure they'll figure it out with the information they've been provided.
Sent from my SM-S767VL using Tapatalk
i don't think so, twrp archive doesn't contain a system.img it only contains folder /system. therefore you can't extract system.img but only the files inside, which have to be extracted in the right way including metadata. the cygwin untar.exe won't handle secontext flag. besides this it is generally bad idea to extract linux files to windows file system. ntfs is case insensitive and not all ascii chars allowed in file names, you will lose all file permissions owner/group and selinux context (except you untar it directly to ext4 image like i said). This might not be important for flashable zip because everything is lost inside a zip anyway (that's why META-INF is needed) but for creating a working ext4 image you must set everything to drw(x)r-(x)r-(x) system system ubject_r:system_file:s0 (i can be wrong always double check for your ROM) things become more complicated when we talking about data.ext4.win or vendor.ext4.win
even if you compile star or gnu tar and all other binaries for windows like mke2fs chcon or so, you won't be able to mount the ext4 disk image r/w in the right way on windows..
anyway thanks for suggesting cygwin, might be a simple alternative for windows freaks. i personally prefer booting live distro from usb stick
aIecxs said:
i don't think so, twrp archive doesn't contain a system.img it only contains folder /system. therefore you can't extract system.img but only the files inside, which have to be extracted in the right way including metadata. the cygwin untar.exe won't handle secontext flag. besides this it is generally bad idea to extract linux files to windows file system. ntfs is case insensitive and not all ascii chars allowed in file names, you will lose all file permissions owner/group and selinux context (except you untar it directly to ext4 image like i said). This might not be important for flashable zip because everything is lost inside a zip anyway (that's why META-INF is needed) but for creating a working ext4 image you must set everything to drw(x)r-(x)r-(x) system system ubject_r:system_file:s0 (i can be wrong always double check for your ROM) things become more complicated when we talking about data.ext4.win or vendor.ext4.win
even if you compile star or gnu tar and all other binaries for windows like mke2fs chcon or so, you won't be able to mount the ext4 disk image r/w in the right way on windows..
anyway thanks for suggesting cygwin, might be a simple alternative for windows freaks. i personally prefer booting live distro from usb stick
Click to expand...
Click to collapse
Yeah, that is true, it should only be the system folder.
Since they must use TWRP/CWM to create the backups, maybe it would have been better to suggest that they should instead, boot into TWRP then connect to adb to use adb shell commands or to use the terminal emulator that is built into TWRP to run a system dump or dd commands to dd a copy of the system.img over to PC.
Or maybe there is a way to mount/run the extracted system folder in terminal then using terminal to dump/dd a .img from that. I don't even know if that is possible(never heard of it, but it's a thought) but it seems to me that if the system.img is what is written to the system partition when flashed and this is what creates the system folder, there "should" be a way to pack the contents of the system folder back into what was originally contained in the system.img. It might miss a few things though, like the kernel for one, the kernel is sometimes part of the system.img but I don't know if that necessarily means that the kernel will be in the system partition/folder when the system.img is flashed. Thus, making it impossible to reverse engineer back into a proper system.img using only the contents of the system folder obtained from a nandroid backup.
A system dump, dd the .img or extract the system.img from the stock firmware file are the way to go, preferably, extracting from the stock firmware file, because that is easier and less risky than using shell, terminal and Linux for the uninitiated.
Sent from my SM-S767VL using Tapatalk
---------- Post added at 03:52 PM ---------- Previous post was at 03:47 PM ----------
aIecxs said:
i don't think so, twrp archive doesn't contain a system.img it only contains folder /system. therefore you can't extract system.img but only the files inside, which have to be extracted in the right way including metadata. the cygwin untar.exe won't handle secontext flag. besides this it is generally bad idea to extract linux files to windows file system. ntfs is case insensitive and not all ascii chars allowed in file names, you will lose all file permissions owner/group and selinux context (except you untar it directly to ext4 image like i said). This might not be important for flashable zip because everything is lost inside a zip anyway (that's why META-INF is needed) but for creating a working ext4 image you must set everything to drw(x)r-(x)r-(x) system system ubject_r:system_file:s0 (i can be wrong always double check for your ROM) things become more complicated when we talking about data.ext4.win or vendor.ext4.win
even if you compile star or gnu tar and all other binaries for windows like mke2fs chcon or so, you won't be able to mount the ext4 disk image r/w in the right way on windows..
anyway thanks for suggesting cygwin, might be a simple alternative for windows freaks. i personally prefer booting live distro from usb stick
Click to expand...
Click to collapse
I use VM, Live USB and dual boot, depending on which system I'm on(I have more than one rig) and depending on what I'm doing. In some cases, using Windows running Linux in VM is handy because some things are easier in Windows and some are easier in Linux, VM allows switching back and forth between Windows and Linux "on the fly" instead of having to move back and forth between two different systems. Another advantage to VM, your actual system is effectively immune to viruses when browsing the web inside the VM, only the OS installed in the VM is vulnerable, if infected, just wipe that OS and reinstall in the VM and you're clean again, your actual system that the VM is running on, never gets effected.
Sent from my SM-S767VL using Tapatalk
yeah i wonder how did create twrp backup without actually having twrp. busybox tar isn't able to do it, at least full tar binary is required. would be better to create backup in desired format from the very beginning. easiest way is adb pull /dev/block/bootdevice/by-name/system system.img (with proper path of course)
aIecxs said:
yeah i wonder how did create twrp backup without actually having twrp. busybox tar isn't able to do it, at least full tar binary is required. would be better to create backup in desired format from the very beginning. easiest way is adb pull /dev/block/bootdevice/by-name/system system.img (with proper path of course)
Click to expand...
Click to collapse
They booted a live temporary session of TWRP without actually flashing it to the recovery partition. I've done the same on an Intel tablet and a couple of RCA tablets. Booting it directly instead of flashing it onto the device doesn't trigger the locked bootloader. The locked bootloader won't allow booting unverified software that has been installed in the device's hardware itself, but it does not block booting unverified software from an external source.
Sent from my SM-S767VL using Tapatalk
After reading other source, someone said the ext4.win are just tar. One only needs to rename them to ext4.win.tar and you uncompress to img.
I guess the truth is more complicated than that because img (from stock, ready to be ODINed/Bootloader Fastboot) are raw images, including zeros. That's the difference.
In the end, if I had to do it again, I would have to dd the whole /mmcblkxxx(system) to a microSD. Yes 16-20Gb takes a much longer time than 2-3Gb (system.ext4.win) but that what <fastboot flash system system.img> requires (raw data and zeros).
sintoo said:
After reading other source, someone said the ext4.win are just tar. One only needs to rename them to ext4.win.tar and you uncompress to img.
Click to expand...
Click to collapse
Thats exactly how it works see post #3
if you add entry with file system type "emmc" in /etc/recovery.fstab TWRP produces flashable disk image system_image.emmc.win* instead of tar archive (which you can probably concatenate into system.img)
Code:
/system_image emmc /dev/block/platform/mtk-msdc.0/by-name/system flags=display="System Image";backup=1;flashimg=1

[ZIP - Dual Installer] Dynamic Installer Stable 4.7-b3 [ Android 10+ or earlier ]

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
SUPPORT: TELEGRAM CHANNEL - TELEGRAM GROUP - SUPPORT ME
ABOUT THIS:​With this you can make Automatic Installers (.ZIP flash files) for All Android devices without limitations (Supports an installation from Recovery or can be used to create a Magisk module)
By default the installer mounts the partitions as RW (Read/Write) and creates its own environment (Busybox + Bash) to work even if your installation environment is not the most suitable
Although the name "Dynamic Installer" can be confusing, the installer is not exclusive for devices with Dynamic Partitions, it supports devices with old and new partitions.
​Compatibility:
ARM/ARM64​
General Features:
Spoiler
Fully shell script based (Open source)​
It can mount main partitions as RW (/system_root, /system, /system_ext, /vendor, /product, /odm)​
Supports /apex mounting (dalvikvm support included)​
Supports old and new partitions​
Support for a Dual installation (Recovery or Magisk)​
It has many useful actions that make it easy to mount partitions, edit/patch files or install ROMs​
It has many other special features for patching smali JARs/APKs, XML editing, running JARs directly and more.​
It has 4 types of execution (ZIP for Recovery or Magisk, Just load from Recovery Terminal or Termux)​
It runs with BASH instead of ASH, DASH​
Support for addons and more​
Default Variables:
Spoiler
​
Bash:
$TMP: The value of this variable contains the temp directory (A directory that only exists during execution, you can use it to store temporary contents)
$BOOTMODE: This value will be "true" only if the device is already booted (or "false")
$chipname: The value of this variable can be "snapdragon/exynos/mediatek/kirin/unisoc" depending on the chipset of the device
$installzip: The value of this variable contains the path of your ZIP (that the user is installing)
$is64bit: The value of this variable will be "true" only if the device is 64-bit (or "false")
$API: The value of this variable contains the API number (of the Android version) of the device
$slot: Contains the Active Slot (_a or _b) if the device has A/B partitions (It can be refreshed with "getarch" )
$dynamic_partitions: The value of this variable will be "true" if the device has a Dynamic Partitions (or "false")
$virtual_partitions: The value of this variable will be "true" if the device has a Virtual Dynamic Partitions (or "false")
${n}: Allows creating new lines within a string ( Example: paragraph=" First line ${n} Second line ${n} Third line " )
$encrypted: It will be "true" only if the device has encrypted Internal Memory (or "false")
$di_version: The complete current version of Dynamic Installer
$main_version: The main version of the Dynamic Installer (Only include whole numbers or decimals, without the -b -b2 -b3 ... variant extensions)
Updater-Script configs
Spoiler
PATH: META-INF/com/google/android/updater-script
Here you will find some lines that start with "setdefault" (These conditions affect even if you make a Magisk module)
setdefault devices (code name/Model of supported devices or off)
If you want the installer to only run on specific devices you can replace "off" with the code name or Model of the supported devices (Use ":" to separate them)
Bash:
#By default
setdefault devices off
#For example to only supports Galaxy A51
#Check using one code name
setdefault devices "a51"
#Check using two code names
setdefault devices "a51:a51nsxx"
#Check Galaxy A51 but with Models
setdefault devices "SM-A515F:SM-A515FN"
#For example to only supports Pixel 4 XL and Pixel 2
setdefault devices "Pixel 2:Pixel 4 XL"
#Or a Mix
#For example to only supports Pixel 4 XL/Pixel 2 and Galaxy A51
setdefault devices "a51:a51nsxx:Pixel 2:Pixel 4 XL"
setdefault apex_mount ( on or off)
You can change the "off" to "on" to allow mounting of /apex, (this could cause a very slow mounting with mount_all action), activate it only if necessary (When you want to use actions like apktool / sign / run_jar that require dalvikvm from Recovery)
Bash:
#By default
setdefault apex_mount off
#To allow /apex mount using /system/apex and /system_ext/apex
setdefault apex_mount on
setdefault import_addons (on or off)
If you activate it all files with extension .sh within META-INF/addons will be imported before execution, this way you can load several plugins for your main script
NOTE: The import will respect an alphabetical (a.sh, b.sh, c.sh, ...) or numerical (1.sh, 2.sh, 3.sh, ...) order
Bash:
#By default
setdefault import_addons off
#To import all META-INF/addons/*.sh
setdefault import_addons on
setdefault magisk_support ( on / off / force)
To enable, disable or force the Magisk space:
on = Automatically switch between updater-script (Device not booted) or customize.sh (Device already booted). Dual installation, two possible execution scripts.
off = Never use the Magisk space, so the updater-script will always be used in any case of installation (Device already booted or not booted)
force = Always use the Magisk space, so the customize.sh will always be used for any installation case (Device already booted or not booted)
NOTE: When magisk_support is set to "off", it is understood that any references to magisk modules, such as $MODPATH, will not be available even if the ZIP is installed from the Magisk App.
Bash:
#By default
setdefault magisk_support on
#To use updater-script instead of customize.sh
#(Device already Booted)
setdefault magisk_support off
#To use customize.sh instead of updater-script
#(Device NOT Booted - Recovery)
setdefault magisk_support force
setdefault extraction_speed (default or custom value)
Allows you to change the extraction speed (MB/s) only when using these actions: update/update_zip/write_raw_image
Bash:
#By default
setdefault extraction_speed default
#To use 5MB / s in the supported actions
#Use "M" for Megabytes
setdefault extraction_speed 5M
setdefault ensure_root (on or off)
If set to "off", mount_all will allow Read-Only systems (Even if you can't make edits internally, you can still mount read-only, otherwise, with "on", the installation would be aborted)
Bash:
#By default
setdefault ensure_root on
#To allow RO systems
setdefault ensure_root off
setdefault permissions (0:0:0755:0644 or custom value)
Allows you to change the default permissions for folders/files used by ALL Dynamic Installer functions (It means that any function that interacts with files or folders will use these permissions in the result)
Format = User ID : Group ID : Folder permissions : File permissions
Bash:
#By default
setdefault permissions "0:0:0755:0644"
#To use 0755 in Folders and 0777 in Files
setdefault permissions "0 : 0 : 0755 : 0777"
Pre-introduction to Addons
Spoiler
The contents inside META-INF/addons are extracted automatically in the installation, to refer to the path use $addons variable
Plugins here
Bash:
::If you have META-INF/addons/myfile.txt
#To print this file
#You don't need to extract it
fprint "$addons/myfile.txt"
Pre-introduction to Actions
Spoiler
Some of these actions support specific extensions as follows:
_addon: If you add "_addon" to the end of each supported action it will take the files directly from "META-INF/addons" folder inside the zip​
Bash:
#META-INF/addons/Example.txt
update_file_addon "Example.txt" /system/build.prop
_zip: If you add "_zip" at the end of each supported action it will take the files directly from the ZIP, you can include paths with folders​
Bash:
#To use "folder/Example.txt" file inside the ZIP
update_file_zip "folder/Example.txt" /system/build.prop
If this extension isnt included in the action, it will work as an external command to the zip​
Bash:
update_file "/sdcard/Example.txt" /system/build.prop
​How does it work?
Spoiler
update-binary It is the script that creates the proper environment and executes the entire ZIP
zbin contains all the necessary plugins
updater-script It is the script that is executed only if the ZIP is installed from Recovery (or when the device is not booted in general)
customize.sh It is the script that is executed only if the ZIP is installed from the Magisk App (or when the device is already booted in general)
Test MODE
Spoiler
The "Test Mode" allows you to test most actions of the Dynamic Installer using the Termux App for Android or some Custom Recovery Terminal (with this you can practice)
To use it, extract this folder:
META-INF/zbin
Also this file:
META-INF/addons/extra.zip
To your internal memory: /sdcard
Execution in Termux (ROOT):
Bash:
#First method
su
cd /sdcard/zbin
. ./setup
#Second method
su
. /sdcard/zbin/setup /sdcard/zbin
Execution in Custom Recovery Terminal:
Bash:
#First method
cd /sdcard/zbin
. ./setup
#Second method
. /sdcard/zbin/setup /sdcard/zbin
Now you can test some actions:
Bash:
update_file_string "ro.product.system.model= TEST" /sdcard/build.prop
apktool --help
Magisk SPACE
Spoiler
NOTE: You can use all the additional functions of the Dynamic Installer during the installation by Magisk
SPACE: META-INF/com/google/android/magisk
In this space you can configure the script and the information of your Magisk module, but the format of the script is totally free, do not rely too much on the existing formats for magisk modules
The magisk modules use a "$MODPATH" variable which is where you must direct all the files to be applied
For example to just extract contents of your ZIP in "$MODPATH/system" (This will apply the changes to /system after reboot)
Bash:
package_extract_dir "FolderInsideZIP" "$MODPATH/system"
REPLACE NATIVE FUNCTIONS
Spoiler
By default all the Native functions of the Dynamic Installer and some Native Variables are in Read/Only to prevent them from being altered by imported shell scripts, however there is a way to allow their substitution from your script: off_readonly
NOTE: off_readonly is interpreted during the installation of the ZIP, so it doesn't work from Test Mode
Bash:
#off_readonly "function name" "function name" "..."
off_readonly ui_print update_file
#Now you can use your custom functions
ui_print() {
echo My custom ui_print function
}
update_file() {
echo My custom update_file function
}
#For some Native Variables like $TMP
off_readonly TMP TMPDIR
#New values
TMP="My custom value"
TMPDIR="My custom value"
TMP2
Spoiler
This variable ($TMP2) is generated by using start_tmp function and ends with end_tmp, the value contains a new temporary path that disappears after installation
Multiple spaces can be generated and finished the same number of times in different periods
Bash:
start_tmp
Space1="$TMP2"
start_tmp
Space2="$TMP2"
start_tmp
Space3="$TMP2"
#U need to finish ALL dynamic spaces
#end_tmp will be remove the created temp directory based on the order of creation
end_tmp
end_tmp
end_tmp
BUGS:
The functions to decompile/compile APKs use an experimental apktool build that CANNOT process images, so dont try to process a full complex APKs! Only smali editions
CREDITS TO:​
Me @BlassGO ( Creator of Dynamic Installer)
@osm0sis ( Traditional installer functionalities in shell code)
@topjohnwu ( Some very cool functions in shell code)
@munjeni for superrepack and superunpack (Best tools to manipulate SUPER images)
@lebigmac cuz I used his project systemrw as a base to made my super_rw function for Dynamic Installer
MORE EXPLANATIONS
AND DOWNLOADS
IN THE NEXT POSTS​
ALL ACTIONS​-----------------------------------
ABORT / END:
Spoiler
abort "Text" "Text" "..."
Print an optional message and then terminate the whole installation as failed
Bash:
abort "There was a problem, stopping installation!"
end "Text" "Text" "..."
Print an optional message and then terminate the whole installation but without failure alert
Bash:
end "Nothing to do..."
-----------------------------------
VARIABLES / SUB-PROCESSES:
How to play with variables and sub-processes
Spoiler
MyVar="Text"
Assign a textual value to a variable (MyVar)
NOTE: There is a distinction between uppercase and lowercase for the name of the variables ("a" and "A" can be used as two different variables)
WARNING: The name of the variable must always start with alphabetic characters or the "_" character (A or __A is valid), it cannot start with numbers ( 90 or 90__MyVar it's not valid), fulfilling this start condition, the rest of the name can have both numeric characters, alphabetic characters or "_" character ( MyVar__90 is valid), the number of times you want
Bash:
a="Ole"
A="Just test"
A10="a b c d e"
__A="1 2 3 4 5"
__B__="W e l c o m e !"
_ABC_1_2_3="-------------------------"
$MyVar / ${MyVar} / $(sub-process)
The "$" symbol is used to invoke variables or create sub-processes
By default, values for both Variables and Actions are taken as literal text
Bash:
MyVar="W e l c o m e !"
#It will literally print "MyVar"
ui_print "MyVar"
But with the symbol "$" it is possible to make that text be interpreted, instead of being taken as something literal
Bash:
__B__="W e l c o m e !"
MyVar="$__B__"
#It will be print "W e l c o m e !"
ui_print "$MyVar"
For variables, sometimes it is necessary to limit the text that should be interpreted, for this use curly brackets ${MyVar}
Bash:
MyVar="W e l c o m e "
ui_print "${MyVar}Blass!"
Finally, some available Actions can return text, being possible to include this text as a value for a Variable or another Action. For this the symbol "$" is used, followed by a grouping with parentheses $(action)
Bash:
#The "string" action will return "welcome" in uppercase "WELCOME" and this will be the printed text
#Result: WELCOME Blass!
ui_print "$(string upper "welcome") Blass!"
#Same for Variables
Result="$(string upper "welcome") Blass!"
ui_print "$Result"
-----------------------------------
LOGIC OF EXPRESSIONS:
As in many programming languages, the use of logical connectors is supported
Spoiler
Action/Expression && Action/Expression && Action/Expression ...
"&&" allows to join several expressions/actions, it is interpreted as "and", the whole line will end without error, if and only if, all expressions/actions end without any error
NOTE: If the previous action/expression ends in error, the next expression/action will not even be executed
Bash:
exist "/system/build.prop" && exist "/system/ole" && exist "/system/a"
Action/Expression || Action/Expression || Action/Expression ...
"||" allows to join several possible expressions/actions, it is interpreted as "or", the whole line will end without error, if any of the actions/expressions end without error (It is not necessary for all of them to do, but at least one must be satisfactory)
NOTE: If the previous action/expression completes without error, the next expression/action will not even be executed
Bash:
exist "/system/build.prop" || exist "/system/ole" || exist "/system/a"
(Action/Expression && Action/Expression) || (Action/Expression && Action/Expression) ...
"()" parentheses allow multiple Actions/Expressions to be grouped together, making them form a new Expression
NOTE: The grouped actions/expressions will be executed in a separate space, that is, they will not be able to alter values in your main script
Bash:
(exist "/system/build.prop" && exist "/system/ole") || (exist "/system/huh" && exist "/system/a")
not Action/Expression
"not" allows to negate any expression/action, making its operation inverse, that is, if the expression/action ends with an error, it will be interpreted inversely as successful, and if it ends without error, it will be interpreted inversely as failed.
You can use either "not" or "!", they are the same
NOTE: "not" only affects each individual action/expression, new actions/expressions joined with "&&" or "||" will not be affected by the negation
WARNING: When negating a grouping "()" it is important to understand that also the connectors "&&" and "||" are inverted, that is, "&&" in negation becomes "||" and vice versa
Bash:
not exist "/system/build.prop" && not exist "/system/ole" && not exist "/system/a"
#Using grouping it is possible to avoid repetitive use of "not"
#Note the change of "&&" to "||" to preserve the logic of the previous example
not (exist "/system/build.prop" || exist "/system/ole" || exist "/system/a")
-----------------------------------
MOUNT:
Spoiler
mount_all
It will mount the main partitions automatically (/system_root, /system, /system_ext, /vendor, /product, /odm , /apex only if setdefault apex_mount enabled)
try_mount "part" "part" "part" "..."
Mount specific partitions (By default in Read/Write if possible or Read/Only)
NOTE: For /system_root, /system_ext, /system, /vendor, /product, /odm or /apex use mount_all
-read-write (-rw) = To only mount partitions in Read/Write
-read-only (-ro) = To only mount partitions in Read/Only
-remount (-re) = Unmount partitions before mounting
-express (-e) = This does a superficial find of the partition, avoiding a long waiting time in case that partition does not exist
-name (-n) = Specify a name to find the partition to mount instead of the automatic name (For A/B devices, if the slot is not specified, the active slot will be used by default)
-file (-f) = Mount a file (only .IMG RAW supported) / Or specify a partition (block) to mount
Bash:
#Read/Write if possible or RO
try_mount /cache /optics /prism /odm /vendor
#Only Read/Write
try_mount -rw /optics /prism
#Only Read/Only
try_mount -ro /optics /prism
#Unmount before mount
try_mount -remount /optics /prism
#Specifying custom name to find the Partition Block to Mount
try_mount -name "system" /test
#For A/B? Its the same
#Supports A/B by default with common names
#Use Active Slot by default
try_mount -name "vendor" /test
#Or optionally specify a slot
try_mount -name "vendor_b" /test
#Don't look for the partition block for long time
try_mount -express /system
#Specifying a FILE to mount instead of partition
try_mount -file "/sdcard/system.img" /test
#Specifying a block to mount
try_mount -file "/dev/block/dm-0" /system_root
#Mix
try_mount -remount -rw /optics /prism
try_mount -express -name "vendor" /mnt/vendor
try_mount -ro -file "/sdcard/vendor.img" /mnt/vendor
#Mount subpartition of SUPER image (.img RAW)
try_mount -file "/sdcard/super.img" -name "system" /mnt/system_inside_SUPER
#Mount subpartition of SUPER image (.img RAW)
#A/B super.img need the slot to mount
try_mount -file "/sdcard/super.img" -name "system_a" /mnt/system_inside_SUPER
apex_mount ".apex/.capex File or Folder"
To mount Android Pony Express (APEX) files or folders in /apex space
NOTE: Supports .apex and New Android 12 .capex File formats
Bash:
#Mount APEX File
#/system/apex/com.android.runtime.apex
apex_mount "/system/apex/com.android.runtime.apex"
#Mount APEX Folder
#/system/apex/com.android.runtime
apex_mount "/system/apex/com.android.runtime"
umount_all
Unmount ALL mounted partitions with mount_all / auto_mount_partitions, ALL mounted partitions with try_mount and ALL mounted partitions with apex_mount
find_block "Block name"
In case you need to get the exact block of a partition (Supports A/B by default)
NOTE: By default if a partition block isnt found, it will stop after 5 seconds to avoid an infinite loop
-express (-e) = This does a superficial find of the partition, avoiding a long waiting time in case that partition does not exist
-time (-t) = Does a full find but only for a limited time
Bash:
#For example to get real system block
#In this example it will return "/dev/block/dm-0"
find_block "system"
#For A/B? Its the same
#Supports A/B by default with common names
find_block "system"
#Fast find
find_block -e system
#Find with limited time
find_block -t 5 system
is_same_mount "FOLDER" "FOLDER"
Check if two folders are linked to the same partition (For example /system and /system_ext use the same partition in most devices)
NOTE: Both folders must be mounted
Bash:
if is_same_mount "/system" "/system_ext"; then
ui_print "/system_ext is inside the system partition"
else
ui_print "/system_ext must have a separate partition"
fi
-----------------------------------
EXTRACT:
Spoiler
package_extract_dir "Folder inside ZIP" "Destination Folder"
You can extract contents of a whole folder within the ZIP to an external path
NOTE: You can define a third argument with the path of an external ZIP, this ZIP will be used instead of the current installation ZIP
Bash:
package_extract_dir "Folder" /system
#Extracting from an external ZIP
package_extract_dir "Folder" /system "/sdcard/External.zip"
package_extract_file "Fully File path Inside ZIP" "Fully Dest path outside ZIP"
You can extract a single file from the ZIP to an external path (You can rename the resulting file) or you can get it directly as Text if u want
NOTE: You can define a third argument with the path of an external ZIP, this ZIP will be used instead of the current installation ZIP
Bash:
#Extract to an external path
package_extract_file "Folder/file.txt" /system/test.txt
#Just get the File content directly as Text
#If you dont add a destination path
content=$(package_extract_file "Folder/file.txt")
#Extracting from an external ZIP
package_extract_file "Folder/file.txt" /system/test.txt "/sdcard/External.zip"
-----------------------------------
WIPES:
Spoiler
wipe "Common Partition name"
To wipe any section like system, vendor, product, odm, data, dalvik, cache
data = Wipe /data but IGNORE /data/media (Internal storage)
userdata = Fully /data wipe
Bash:
#To wipe /system
wipe system
#To wipe /data but WITHOUT Internal Storage
wipe data
#To wipe ALL /data
wipe userdata
#To wipe dalvik-cache
wipe dalvik
#To wipe cache
wipe cache
#Mix
#To wipe /data /system /vendor /product /cache
wipe data cache system vendor product
-----------------------------------
USER SELECTION:
Spoiler
Simple selection (Yes or No)
Bash:
if $yes; then
#Action if the user presses the volume up button
package_extract_dir system /system
else
#Action if the user presses the volume down button
package_extract_dir vendor /vendor
fi
If the user presses the volume up button, it will be interpreted as YES
If the user presses the volume down button, it will be interpreted as N0
multi_option "Variable" <Number of options> <loop>
loop = With a specified number of options, the word "loop" will do an infinite loop constantly resetting the number of options until one is selected (instead of ending in error if all options are discarded)
NOTE: If a number of options is not specified, an infinite loop is created until some N option number is selected (this number will be returned)
Bash:
ui_print " 1. First option"
ui_print " 2. Second option"
ui_print " 3. Third option"
ui_print " 4. Fourth option"
multi_option "my_menu" 4
#Or If you want to create an options loop:
#multi_option "my_menu" 4 loop
if undefined my_menu; then
abort " No valid selection was obtained "
fi
if [[ $my_menu == 1 ]]; then
#Actions for the option 1
ui_print "Welcome to option 1"
elif [[ $my_menu == 2 ]]; then
#Actions for the option 2
ui_print "Welcome to option 2"
elif [[ $my_menu == 3 ]]; then
#Actions for the option 3
ui_print "Welcome to option 3"
elif [[ $my_menu == 4 ]]; then
#Actions for the option 4
ui_print "Welcome to option 4"
fi
Like $yes, the volume buttons are used (Down to discard an option / Up to select that option)
-----------------------------------
SOME EXTRA EDIFY REFERENCES:
To make the environment a bit easier for users who have used traditional installation scripts (Edify Scripts), these are some additional simulated Edify actions.
Spoiler
file_getprop "file with props" "file with props" "..." "prop to extract"
Extract one prop (a = b) from multiple external files (The value will only be returned once)
Bash:
file_getprop /system/build.prop "ro.build.display.id"
file_getprop /system/build.prop /vendor/build.prop /system_ext/build.prop "ro.build.display.id"
myid=$(file_getprop /system/build.prop "ro.build.display.id")
ifelse "Test this action" "Else run this action"
Supports: _addon and _zip extension
Execute an action and if it fails, execute action two (It is necessary to use a single quotes when you want to include double quotes in the action)
Bash:
#Notice that single quotes are used
ifelse "is_mounted /system" 'ui_print "/system inst mounted"'
#Btw the best practice is using this syntax
is_mounted /system || ui_print "/system inst mounted"
#Or for multiple actions
if is_mounted /system; then
ui_print "/system already mounted"
ui_print "Done"
else
ui_print "/system inst mounted"
ui_print "ERROR"
fi
greater_than_int / less_than_int "Number" "Number"
Allows you to check if a number is greater or less than another (Supports decimals)
Bash:
if greater_than_int "2.2" "1.5"; then
ui_print "Is greater"
else
ui_print "Is less or equal"
fi
if less_than_int "1.5" "2"; then
ui_print "Is less"
else
ui_print "Is greater or equal"
fi
concat "string" "string" "..."
Allows concatenation of multiple strings
Bash:
var="just test"
result=$(concat "h u h" "$var" " a ")
stdout [Any action]
Allows to execute an action and send all its results (Including errors - Stderr) to Stdout
NOTE: This does not ensure a screen print, for it use stdprint
Bash:
# echo2 prints text as ERROR (Stderr)
# But stdout converts it to main print text
stdout echo2 uwu
stderr [Any action]
The inverse of the stdout function, executes an action and prints everything as Error (Stdout to Stderr)
Bash:
#The impression will only be visible in the general log
stderr echo uwu
stdprint [Any action]
Execute the action and print its main results on the screen (Print Stdout in Recovery)
Bash:
#The print will be visible on the installation screen
stdprint echo uwu
#This allows to visualize the process of an action even in the Recovery
stdprint apktool --help
read_file "file" "file" "..."
Get the contents of one or more files
Bash:
read_file "$TMP/file.txt"
#Or with the native form
cat "$TMP/file.txt"
run_program "program" arg1 agr2 "..."
You can execute any supported file as a sh or binary, the file automatically receives the execution permissions and also you can send the arguments you want to that file
Bash:
run_program "$TMP/busybox" --help
symlink "FILE" "symlink" "symlink" "..."
You can create multiple symbolic links from a single file
Bash:
#Creating symlinks to busybox
symlink "$TMP/busybox" "$TMP/chmod" "$TMP/sed" "$TMP/tar"
convert_edify "Edify Script" "Result"
Allows you to try to convert Edify scripts to the script format supported by the Dynamic Installer (Experimental, it is recommended to manually review the result and not use it as something definitive)
Bash:
#Normal use
convert_edify "/sdcard/edify-script" "/sdcard/result"
#If no destination is specified, the script will be overwritten.
convert_edify "/sdcard/edify-script"
-----------------------------------
GET VALUES:
Spoiler
import_config "file with props"
Supports: _addon and _zip extension
Convert prop lines (a = b) to variables ($a)
NOTE: There are exceptions, if the name of the prop has some strange special character it will not become a variable (The name of a variable does not support those characters)
example.prop
Code:
name=Some name
current_version=v1.1.0
i_d_k=S o m e t h i n g
import_config
Bash:
import_config "$TMP/example.prop"
ui_print "$name"
ui_print "$current_version"
ui_print "$i_d_k"
get_file_prop "file" "file" "..." "prop to extract"
Extract one prop (a = b) from multiple external files (The value will only be returned once)
Bash:
get_file_prop /system/build.prop "ro.build.display.id"
get_file_prop /system/build.prop /vendor/build.prop /system_ext/build.prop "ro.build.display.id"
myid=$(get_file_prop /system/build.prop "ro.build.display.id")
getdefault "file" "default to extract"
Extract "setdefault" values from external files (Multi-line content not supported)
something.txt
Code:
setdefault ole "a b c"
setdefault okay "d e f"
setdefault test "s o m e t h i n g"
getdefault
Bash:
getdefault "$TMP/something.txt" okay
getdefault "$TMP/something.txt" test
my_var=$(getdefault "$TMP/something.txt" okay)
get_array "String Pattern" "Fully ARRAY"
To get fully value in a array using some pattern
Bash:
#First defined array
test=("First array" "Other array" "A B")
#Get fully value in the array
#It will returns "Other array"
get_array "Other" "${test[@]}"
content=$(get_array "Other" "${test[@]}")
get_size_ext4 "Partition or .img"
To get the current size in Bytes of any partition or compatible file (RAW .img)
Bash:
#Get size of system block
get_size_ext4 "$(find_block system)"
#Get size of some .img in /sdcard
get_size_ext4 "/sdcard/vendor.img"
size=$(get_size_ext4 "$(find_block system)")
fullpath "File/Folder/Symlink"
To get the fully path of any file/folder or symlink, btw it returns the literal symlinks paths instead of its sources
Bash:
fullpath "folder/file"
complete_path=$(fullpath "folder/file")
find_content "Pattern" "Pattern" "..." "ZIP FILE"
Returns the paths of all the contents of the ZIP that match the established patterns
-dirs (-d) = Find only folders in the ZIP (By default only Files)
-regex (-r) = Enable Regular Expression support for patterns
-maxdepth (-max) = A number that limits the range of the resulting paths, considering the root of the ZIP as the first level (1) (That is, if "-maxdepth 2", then only contents that are in a maximum range from the root (1) to a single folder (2) of the ZIP will be returned, if the path extends to two subfolders (-maxdepth 3) or more they will not be returned for example)
Bash:
#By default, any File path that has the pattern internally is found
find_content ".mp4" ".mp3" /sdcard/ole.zip
#Find only Folders
find_content -d "huh" /sdcard/ole.zip
#Using Regular Expressions
find_content -regex "(.mp4|.mp3)$" /sdcard/ole.zip
#You can even include multiple Regex
find_content -regex "(.mp4|.mp3)$" "^ole.*(.jpg|.png)$" /sdcard/ole.zip
#Limiting the results to only files that are in the root of the ZIP
find_content -max 1 ".mp4" ".mp3" /sdcard/ole.zip
#Limiting results to only folders that are at most 2 levels
find_content -max 2 -d "huh" "ole" /sdcard/ole.zip
#To get the paths of all the folders in the ZIP that are at most 3 levels
#Regex has infinite possibilities
find_content -d -max 3 -regex ".*" /sdcard/ole.zip
-----------------------------------
SET PERMISSIONS:
Spoiler
set_perm "UID" "GID" "MODE" "FILE/FOLDER" "FILE/FOLDER" "..."
Allows you to define the UID (User ID), the GID (Group ID) and the MODE (Permissions) for multiple single files/folders (it is NOT recursive)
Bash:
set_perm 0 0 0755 /system/build.prop
#Multiple files/folder
set_perm 0 0 0755 /system/build.prop /system/test.txt /data/folder
set_perm_recursive "UID" "GID" "FOLDERs MODE" "FILEs MODE" "FOLDER" "FOLDER" "..."
Allows you to define the UID (User ID), the GID (Group ID) and the MODE (Permissions) for ALL files and folders within a multiple directories (Recursive), the MODE is one specific for files and another for folders
Bash:
set_perm_recursive 0 0 0644 0755 /system
#Multiple DIRECTORIES
set_perm_recursive 0 0 0644 0755 /system /vendor /product
saveperm "FILE/FOLDER" "FILE/FOLDER" "..."
To save the UID (User ID), the GID (Group ID) and the MODE (Permissions) of all files/folders in a path (Recursively) or on single files
NOTE: When any folder is specified it will automatically expand to all its contents
Bash:
#Single file
saveperm /system/build.prop
#Recursively (All contents of this folders)
saveperm /system/app /system/bin /vendor
copy_perm_list "Destination File"
You can export the list of permissions generated by "saveperm" (this list is a substitute for "saveperm", in other words you can reuse this list in new projects without the need to use "saveperm" again)
Bash:
#Export the current permission list
copy_perm_list /sdcard/permissions.txt
restoreperm "FILE/FOLDER" "FILE/FOLDER" "..."
To restore the UID (User ID), the GID (Group ID) and the MODE (Permissions) previously saved with "saveperm" of all files/folders in a path (Recursively) or on single files
-file (-f) = You can load a previously saved list (with this you can avoid using "saveperm")
NOTE: When any folder is specified it will automatically expand to all its contents, additionally if the save was recursive you can restore the permission of a single file within that directory
Bash:
#Single file
restoreperm /system/build.prop
#Recursively (All contents of this folders)
restoreperm /system/app /system/bin /vendor
#Use a previous list
restoreperm -file "$TMP/permissions.txt" /system/app /system/bin /vendor
eval_perm / eval_user / eval_group / eval_all_perm "FILE/FOLDER"
They are functions that allow evaluating the most common UID (User ID), the GID (Group ID) and the MODE (Permissions) within a directory or a single file.
Bash:
#Get only the Mode (Permissions)
eval_perm /system/build.prop
eval_perm /vendor
#Get only the User ID
eval_user /system/build.prop
eval_user /vendor
#Get only the Group ID
eval_group /system/build.prop
eval_group /vendor
#Get only the Group ID
eval_group /system/build.prop
eval_group /vendor
#Get the User ID / Group ID / Mode
eval_all_perm /system/build.prop
eval_all_perm /vendor
get_all_perm "FILE/FOLDER"
Unlike eval_all_perm, it returns the literal User ID / Group ID / Mode of a folder, instead of evaluating common results within it.
Bash:
#Get the User ID / Group ID / Mode
get_all_perm /system/build.prop
get_all_perm /vendor
-----------------------------------
GET/SET CONTEXTS:
Contexts in Android (Linux) are properties of all files or folders that determine the type of file or folder and allow the system to know how to treat or catalog that file/folder
NOTE: As Magisk modules work as a layer on top of the system, when you include files within your module they will be installed without any defined context and without a context you could have unwanted results.
Spoiler
eval_context "FOLDER or File"
It will find and print the most used context for files and folders (It eval the common results) in a directory or it can just return the context of a single FILE.
Bash:
#It will return u:object_r:system_file:s0
eval_context /system
#It will return u:object_r:vendor_overlay_file:s0
eval_context /vendor/overlay
#It will return u:object_r:sec_efs_file:s0
eval_context /efs
#Get context of a single file
#It will return u:object_r:system_file:s0
eval_context /system/build.prop
get_context "FOLDER or File"
Unlike eval_context, it returns the literal context of a folder, instead of evaluating common results within it.
Bash:
#It will return u:object_r:system_file:s0
get_context /system/app
get_context /system/build.prop
set_context "PATH or FILE" "PATH or FILE"
To use the contexts of one path in another, the best contexts are logically evaluated for ALL folders and files, although you can also assign the context of a single file to another (Perfect for Magisk modules)
Bash:
#It will apply all the contexts of /system in "$MODPATH/system"
set_context "/system" "$MODPATH/system"
#It will apply all the contexts of /vendor in "$MODPATH/system/vendor"
set_context "/vendor" "$MODPATH/system/vendor"
#It will apply all the contexts of /vendor/etc in "$MODPATH/system/vendor/etc"
set_context "/vendor/etc" "$MODPATH/system/vendor/etc"
#It will apply the context of /system/build.prop in /data/test/test.prop
set_context "/system/build.prop" "/data/test/test.prop"
savecontext "FILE/FOLDER" "FILE/FOLDER" "..."
To save the contexts of all files/folders in a path (Recursively) or on single files
NOTE: When any folder is specified it will automatically expand to all its contents
Bash:
#Single file
savecontext /system/build.prop
#Recursively (All contents of this folders)
savecontext /system/app /system/bin /vendor
copy_context_list "Destination File"
You can export the list of contexts generated by "savecontext" (this list is a substitute for "savecontext", in other words you can reuse this list in new projects without the need to use "savecontext" again)
Bash:
#Export the current contexts list
copy_context_list /sdcard/contexts.txt
restorecontext "FILE/FOLDER" "FILE/FOLDER" "..."
To restore the contexts previously saved with "savecontext" of all files/folders in a path (Recursively) or on single files
-file (-f) = You can load a previously saved list (with this you can avoid using "savecontext")
NOTE: When any folder is specified it will automatically expand to all its contents, additionally if the save was recursive you can restore the context of a single file within that directory
Bash:
#Single file
restorecontext /system/build.prop
#Recursively (All contents of this folders)
restorecontext /system/app /system/bin /vendor
#Use a previous list
restorecontext -file "$TMP/contexts.txt" /system/app /system/bin /vendor
ch_con_recursive "Files Context" "Folders Context" "FOLDER" "FOLDER" "..."
To manually set the context to ALL files/folders of multiple directories
The context format can be complete or partial
Complete = u:'object_r:system_file:s0
Partial = system_file
-file (-f) = Only apply contexts in Files
-dir (-d) = Only apply contexs in Folders
Bash:
#With Complete contexts
#Files/Folders
ch_con_recursive "u:object_r:system_file:s0" "u:object_r:system_file:s0" /data/test
#With Partial contexts
#Files/Folders
ch_con_recursive "system_file" "system_file" /data/test
#Apply context to only Files in /data/test
ch_con_recursive -f "system_file" /data/test
#Apply context to only Folders in /data/test
ch_con_recursive -d "system_file" /data/test
#Apply Contexts in Mutiple directories
ch_con_recursive "system_file" "vendor_file" /data/test /data/test2 /data/test3
#Only Files (Mutiple directories)
ch_con_recursive -f "vendor_file" /data/test "$MODPATH/system/vendor"
ch_con "Context" "FILE/FOLDER" "FILE/FOLDER" "..."
To manually set the context to mutiple single files/folders (Support Complete or Partial context format like ch_con_recursive)
Bash:
#Complete context
ch_con "u:object_r:system_file:s0" /data/test/huh.txt
ch_con "u:object_r:vendor_file:s0" /data/test/huh.txt
#Partial Context
ch_con system_file /data/test
ch_con vendor_file /data/test/huh.txt
#Mutiple single files/folders
ch_con system_file /data/test /data/a.prop /data/test/huh.txt
-----------------------------------
EDITING FILES:
Spoiler
savestate "variable" "file"
Makes a record of the current state of the file and is saved in the variable, any minor editing will change the value
Bash:
#Current state of build.prop will be saved in "$test" variable
savestate test /system/build.prop
#After some modifications
update_file_string "ro.product.system.model=Just Test" /system/build.prop
#The state of the build.prop will be change
savestate test2 /system/build.prop
"$test" ISNT EQUAL TO "$test2"
#You can compare it
if [[ "$test" == "$test2" ]]; then
ui_print " build.prop was not edited"
else
ui_print " build.prop changed"
fi
patch_fstab "Pattern to find Line to Patch" "Pattern to find property" "New property" "FILE"
Allows you to replace properties of fstab files (For example: /vendor/etc/fstab.qcom)
Bash:
#It will replace fileencryption=ice to encryptable in userdata line
patch_fstab userdata "fileencryption" "encryptable" "/vendor/etc/fstab.qcom"
update_file "FILE with New props" "DEST FILE"
Supports: _addon and _zip extension
Updates lines of .prop files without changing the original structure, btw this only works for updating already existing lines, if any line doesnt exist it wont do anything
Bash:
update_file "NewPropLines.txt" "/system/build.prop"
force_update_file "FILE with New props" "DEST FILE"
Supports: _addon and _zip extension
Similar to update_file but forces the existence of the new lines, if the lines already exists in the Dest File it remove them and then it will add the new prop lines
Bash:
force_update_file "NewPropLines.txt" "/system/build.prop"
update_file_string "line" "line" "..." "file"
Same as update_file but doesnt require extra files, you can include the new lines to update directly as strings
Bash:
update_file_string 'ro.product.system.model=NEW MODEL' /system/build.prop
update_file_string 'ro.product.system.model=NEW MODEL' 'ro.product.system.name=NEW NAME' 'ro.build.display.id=NEW ID' /system/build.prop
force_update_file_string "line" "line" "..." "file"
Same as force_update_file but doesnt require extra files, you can include the new lines to update directly as strings
Bash:
force_update_file_string 'ro.product.system.model=NEW MODEL' /system/build.prop
force_update_file_string 'ro.product.system.model=NEW MODEL' 'ro.product.system.name=NEW NAME' 'ro.build.display.id=NEW ID' /system/build.prop
xml_kit -open "Start XML section" "End XML Section" -open "Start XML Section" "..." -in "Some pattern" -change-value / -change-tag / -change-content / -add / -add-inside / -after-line / -before-line / -remove "XML FILE"
You can edit XML files by scrolling through sections (You can edit very specific sections)
The results will be analyzed automatically, if you receive any warning the original XML will not be altered, check your code, you are probably setting something wrong
NOTE: If an action is not specified, it will just return the result of all the opened sections (If there are multiple results it is necessary to include -in flag or it will give an error)
-open = Open a section of the XML, specifying the beginning pattern and the end pattern, in addition, you can open more sections within a previously opened section (Until you reach the desired section)
-in = To avoid editing unwanted sections use -in to find the section you want using a specified pattern inside that section (Its use is highly recommended to avoid errors)
-change-value = To change a XML attribute value ( a="value" )
-change-tag = To change a XML value that is inside two tags ( <a> value </a> )
-change-content = To replace any text with another in the opened XML section
-add = To add text after the opened XML section
-add-inside = To add text inside the opened XML section
-after-line = To add text after some line inside the opened XML section
-before-line = To add text before some line inside the opened XML section
-remove = Just remove opened XML section
-print = Print the result instead of editing the XML file
-only-result = Just keep the result of all opened XML sections instead of merging it with the original XML
-no-auto-spaces = Don't use autospacing based on current opened XML section
XML EXAMPLE: /sdcard/Test.xml
XML:
<manifest version="2.0" type="device" target-level="3">
<hal format="hidl">
<name>Example_1</name>
<version>3.0</version>
<interface>
<name>Internal One</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>Example_2</name>
<version>6.0</version>
<interface>
<name>Internal Two</name>
<instance>default</instance>
</interface>
</hal>
</manifest>
xml_kit ACTIONS
Bash:
#Open first XML section
xml_kit -open '<manifest' '</manifest>' /sdcard/Test.xml
#Open a section within an already opened section
xml_kit -open '<manifest' '</manifest>' -open '<hal format="hidl">' '</hal>' /sdcard/Test.xml
#The opening of sections is Unlimited
xml_kit -open '<manifest' '</manifest>' -open '<hal format="hidl">' '</hal>' -open '<interface>' '</interface>' /sdcard/Test.xml
#Only edit the section that has this pattern
xml_kit -open '<manifest' '</manifest>' -open '<hal format="hidl">' '</hal>' -in Example_2 /sdcard/Test.xml
#Change some XML attribute
#Change format="hidl" to format="Just test"
xml_kit -open '<manifest' '</manifest>' -open '<hal format="hidl">' '</hal>' -in Example_2 -change-value format "Just Test" /sdcard/Test.xml
#Change some value inside TAGs
#For example: <version>3.0</version>
#Change 3.0 to "Just Test"
xml_kit -open '<manifest' '</manifest>' -open '<hal format="hidl">' '</hal>' -in Example_1 -change-tag version "Just Test" /sdcard/Test.xml
#Add Text after the Opened XML section
xml_kit -open '<manifest' '</manifest>' -open '<hal format="hidl">' '</hal>' -open '<interface>' '</interface>' -in "Internal Two" -add "Just Test" /sdcard/Test.xml
#Add Text after some line
xml_kit -open '<manifest' '</manifest>' -open '<hal format="hidl">' '</hal>' -in Example_1 -after-line Internal "Just Test" /sdcard/Test.xml
#Add Text before some line
xml_kit -open '<manifest' '</manifest>' -open '<hal format="hidl">' '</hal>' -in Example_2 -before-line Internal "Just Test" /sdcard/Test.xml
#Just Remove opened section
xml_kit -open '<manifest' '</manifest>' -open '<hal format="hidl">' '</hal>' -in Example_1 -remove /sdcard/Test.xml
add_lines "file" "file" "file" "DEST FILE"
Supports: _addon and _zip extension
Add lines from multiple files to an existing or new file
Supports -after-line and -before-line like add_lines_string
Bash:
#Add the content of a single file to the Destination file
add_lines "Add.txt" /system/build.prop
#Add all contents of multiple files to the Destination file
add_lines "Add.txt" "Add2.txt" "Add3.txt" /system/build.prop
#Add contents BUT after some line
add_lines -after-line "Some line" "Add.txt" /system/build.prop
#Add contents BUT before some line
add_lines -before-line "Some line" "Add.txt" /system/build.prop
#Mix
add_lines -after-line "Some line" "Add.txt" -after-line "Some line 2" "Add2.txt" -before-line "Some Line 3" "Add3.txt" "Extra.txt" "Extra2.txt" /system/build.prop
add_lines_string "line" "line" "..." "DEST FILE"
Same as add_lines but doesnt require extra files, you can include the new lines to add directly as strings (Support empy lines)
-after-line (-al) = Add content after a specific line (Unlimited)
-before-line (-bl) = Add content before a specific line (Unlimited)
Bash:
#Normal usage
add_lines_string "New line" "New line 2" /system/build.prop
#Add empy lines
add_lines_string " " /system/build.prop
add_lines_string " " " " /system/build.prop
#Add lines after some line
add_lines_string -after-line "Some line" "add this after" -after-line "Some line 2" "add this after" /system/build.prop
#Add lines before some line
add_lines_string -before-line "Some line" "add this before" -before-line "Some line 2" "add this before" /system/build.prop
#Mix
add_lines_string "New line" " " "New line 2" " " /system/build.prop
add_lines_string " " "New line" -after-line "Some line" "add this after" -after-line "Some line 2" "add this after" " " "Finish line" /system/build.prop
replace "Old Text" "New Text" "File or Directory"
Allows you to replace only specific text or all lines that contains it (-all-line) within a file or directory (-recursive)
-recursive(-r) = Finds the specified text in the whole directory and replaces it
-all-line(-a) = Instead of just replacing the text, replace the entire line that contains it (You can replace the line with a paragraph but not vice versa)
Bash:
#In a file
replace "HUH" "OLE" /system/build.prop
#In a whole directory (Recursive)
replace -r "HUH" "OLE" /system
replace_name "Pattern Name" "New Pattern Name" "File or Directory"
It allows you to rename a file/folder or a whole directory (-recursive), so it is possible to change several pieces of names or full names of multiple files/folders easily.
-recursive (-r) = Find all files/folders matching the name pattern in the whole directory and rename them
-files (-f) = Only rename files
-dirs (-d) = Only rename folders
-regex = Enable the use of Regular Expressions for the name pattern
NOTE: By default if only files or only folders are not specified, the names of both files and folders will be replaced
Bash:
#Change part of a file name
#Change the extension ".jpg" to ".png"
replace_name ".jpg" ".png" /system/test.jpg
#Same for folders
replace_name "old" "new" /system/folder_old
#Remove the ".bak" extension
replace_name ".bak" "" /system/test.prop.bak
#Recursive
#Change the extension ".jpg" to ".png" in an entire directory
replace_name -r ".jpg" ".png" /system
#Remove the ".bak" extension in an entire directory
replace_name -r ".bak" "" /system
#Btw you can specify that it Only applies to Files
replace_name -f -r ".bak" "" /system
#Or Only Folders
replace_name -d -r "_ext" "_new" /system
#Using Regex the possibilities are endless
#Replace ".bak" only if it is at the end of the entire file names
replace_name -regex -r ".bak$" "" /system
remove "Text to remove" "File or Directory"
Allows you to remove only specific text or all lines that contains it (-all-line) within a file or directory (-recursive)
-recursive(-r) = Finds the specified text in the whole directory and removes it
-all-line(-a) = Instead of just removing the text, remove the entire line that contains it
Bash:
#In a file
remove "HUH" /system/build.prop
#In a whole directory (Recursive)
remove -r "HUH" /system
#Remove all empty lines
remove -a "" /system/build.prop
remove -r -a "" /system
-----------------------------------
EXECUTION:
Spoiler
run "variable" "file" arguments
Supports: _addon and _zip extension
Try to run a file (like a sh, binary ..) and save the result in the variable (The file automatically receive execution permissions)
Bash:
run log1 "$TMP/busybox" chmod --help
run_wait "time in seconds" action with any arguments
Limits the execution time of any process, including Dynamic Installer functions, doesnt affect the execution speed, it only activates if the action takes too long (Experimental)
Bash:
run_wait 5 run log1 "$TMP/busybox" echo HUH
run_jar "DEXED jar file" arguments
Supports: _addon and _zip extension
Allows to run .JAR files using the native Android dalvik machine (If dalvik isnt available, a warning will be given), the .JARs must be converted to .dex to work (Btw not all .jars works)
Bash:
run_jar "$TMP/apktool.jar" --help
run_jar_class "DEXED jar file" "class to load" arguments
Supports: _addon and _zip extension
It works like run_jar but you can specify which class of the jar should be executed
Bash:
run_jar_class "$TMP/apktool.jar" "brut.apktool.Main" --help
-----------------------------------
MANIPULATION OF STRINGS:
Spoiler
split_string "pattern separator" "line"
Separate text based on a delimiter
Bash:
split_string ':' "A B: C D E: FG"
#Result:
#A B
#C D E
#FG
split_string "word" "A Bword C D E word FG"
#Result:
#A B
#C D E
#FG
split_cut "separator pattern" "number" "line"
Separates the text like split_string but only returns the content up to the number of the indicated result
Bash:
split_cut ':' 2 "A B: C D E: FG"
#Result:
#A B
#C D E
split_cut "word" 1 "A Bword C D E word FG"
#Result:
#A B
split_extract "separator pattern" "number" "line"
Separates the text like split_string but only returns a single value that is in the number of the indicated result
Bash:
split_extract ':' 2 "A B: C D E: FG"
#Result:
#C D E
split_extract "word" 3 "A Bword C D E word FG"
#Result:
#FG
repeat "number" "String"
Repeat text by a specific number
Bash:
repeat 5 OLE
#Result: OLEOLEOLEOLEOLE
string <replace/replace_line/remove/inside/extract/complete_extract/-after-line/-before-line/escape/upper/lower/count> "string to process"
A multi-utility to easily manipulate strings
replace (UnLimited) = Replace substring-1 with substring-2
replace_line (UnLimited) = Replace the full lines that contain the substring (You can replace the line containing the text with a paragraph but not vice versa)
remove (UnLimited) = Remove some substring
inside = Extract the substring that is inside two delimiters (It only works if the string to be processed does NOT have more than one line)
extract = Extract all the content that is within two lines with the established pattern (Effectively only works if the string has multiple lines)
complete_extract = Same as extract, but includes the lines that delimit the content
force = Always return a result (by default nothing was returned if the original text was equal to the result)
-recursive (-r) = It allows to apply changes/process ALL results (not just the first one) with "remove/replace/extract/complete_extract"
-pattern (-p) = It allows to return only results with some internal string (Just with extract/complete_extract)
-after-line (UnLimited) = Add text after some line with the established pattern
-before-line (UnLimited) = Add text before some line with the established pattern
-get-after = Get all text after some pattern (Only single line)
-get-before = Get all text before some pattern (Only single line)
-file (-f) = It allows to directly load a file instead of using string
escape = Escape " ] [ \ / $ * . ^" characters that cause conflicts with some Linux utilities like sed (Being escaped they will be taken as literal characters)
upper = Convert all text to Uppercase
lower = Convert all text to Lowercase
count = It only returns the number of characters in the string
Examples:
Bash:
#Just replace the first result
string replace "A" "B" "Hi, A will be replaced with B"
#Recursive (Replace ALL)
string -r replace "A" "B" "Hi, AAAA will be replaced with B"
#Recursive (Remove ALL)
string -r remove "A" "This AAAAAA will be removed"
string inside "A" "B" "Hi A this content will be return B sayonara"
string upper "this content will be return as uppercase"
string lower "THIS CONTENT WILL BE RETURN AS LOWERCASE"
Unlimited Examples:
Bash:
#Just remove the first results
string remove "A" remove "B" remove "C" "ABDC"
#Recursive (Remove ALL)
string -r remove "A" remove "B" remove "C" "AAAAAABBBBBDDDDDCCCC"
#Recursive (Replace ALL)
string -r replace "A" "C" replace "B" "D" replace "C" "Hi" "C, AACCBBDDCC"
Extra Examples:
Bash:
example="
Hi,
Hello world
A
B
C
Okay, sayonara
Hello world 2
D
E
F
sayonara again
"
#It will returns the first result
string extract "world" "sayonara" "$example"
#Extract but verify if it have some substring
#The first result is only returned if it have "B" substring
string -p "B" extract "world" "sayonara" "$example"
#Recursive, Extract ALL pattern paragraphs inside "world" and "sayonara"
string -r extract "world" "sayonara" "$example"
#Using recursive mode it will analyze all results and using pattern will only return the content that contains "E"
string -r -p "E" extract "world" "sayonara" "$example"
#Add some string after some line
string -after-line "world" "ADD this after" "$example"
#Multi actions
string remove "A" remove "B" replace "C" "Ole" "$example"
string -after-line "world" "ADD this after" -after-line "B" "ADD this after" "$example"
#Just count characters in result
string count remove "A" remove "B" replace "C" "Ole" "$example"
-----------------------------------
CONVERSION:
Spoiler
convert "NUMBER with UNIT" "NEW UNIT"
Convert any type of units, mainly for storage units such as b, B, KB, MB, GB, TB, there is no combination limits (It returns completely decimal or integer numbers). Btw It is necessary to clarify that it supports integers and decimals in ANY conversion.
-decimals (-d) = Number of decimals allowed (if they exist)
-show (-s) = Show the sequence of conversion with its respective units (The conversion is dynamic, it uses a sequence of units until reaching the final unit)
NOTE: It is very important to respect the lowercase or uppercase of the units ("b" is not the same as "B"ytes)
Bash:
convert 100MB KB
convert 10TB MB
convert 1b TB
convert 1TB B
convert 1.56GB B
convert 1.3333333333B KB
#Save the result in a variable
result=$(convert 1005MB B)
To avoid placing the unit in each number to be converted, there are two variables convert_from and convert_to that can be defined before use.
Bash:
#Convert from this unit
convert_from=GB
#Convert to this unit
convert_to=KB
result=$(convert 15)
#It is also possible to mix the default variables with new units
convert_from=b
convert_to=MB
#Convert 10 GB to the default MB
result=$(convert 10GB)
-----------------------------------
CHECKING:
Spoiler
exist <file/folder/symlink/block/any> "file" "file" "file" "..."
It can check if one or more files/folders/symlinks/blocks or any type of file exists
Example:
Bash:
#By default if u dont include any flag it will check any type of folders/files/symlinks/blocks/..
if exist "Myfile.bin"; then
ui_print " Okey passed"
else
ui_print " FATAL ERROR"
fi
#For only Folders
if exist folder "FOLDER"; then
ui_print " Okey passed"
else
ui_print " FATAL ERROR"
fi
#For only Files
if exist file "myfile.txt"; then
ui_print " Okey passed"
else
ui_print " FATAL ERROR"
fi
#For only Symlinks
if exist symlink "/system/vendor"; then
ui_print " It exists and its a symbolic link"
else
ui_print " FATAL ERROR"
fi
#For only Blocks
if exist block "/dev/block/dm-0"; then
ui_print " It exists and its a block (Partition)"
else
ui_print " FATAL ERROR"
fi
#Multi-check
if exist "Myfile.bin" "OTHER.bin" "OTHER.zip" "FOLDER"; then
ui_print " Okey passed"
else
ui_print " FATAL ERROR"
fi
if exist symlink "/system/bin/sed" "/system/vendor"; then
ui_print " They exist and are symlinks"
else
ui_print " FATAL ERROR"
fi
is_valid "file" "file" "file" "..."
It can check if one or more files exist and are not empty
contains "Text" "Text" "..." "FILE"
It can check the existence of any text in a File
check_content "file" "file" "..." "ZIP File"
Check if one or more files exist within a ZIP file
Example:
Bash:
if check_content "file.txt" "Main.zip"; then
ui_print " Passed "
else
ui_print " ERROR "
fi
#Multi-check
if check_content "file.txt" "file2.txt" "folder/huh.bin" "MAIN.zip"; then
ui_print " Passed "
else
ui_print " ERROR "
fi
can_run "Binary file"
Check if a binary can run on the device
is_number "possible number"
Check if the string is a number (Supports decimal numbers)
is_hex "possible Hexadecimal string"
Check if the string is Hexadecimal
is_abc "possible alphabetical string"
Check if the string is alphabetical (A - Z), supports spaces and new empty lines but it will only be True if all visible characters are only alphabetic
is_text "possible string"
Check ANY visible character, if there are only empty spaces or new lines it will return False.
is_zip/is_tar/is_gzip/is_bzip/is_xz "File"
Check some file types using Hex Magic values, so the file extension doesnt matter
is_less/is_greater/is_equal/is_greater_equal/is_less_equal "String/Number" "String2/Number2"
Check if a number (Supports decimals) is greater/less/equal or equal less/equal greater than another, just is_equal function support text comparison
is64bit "FILE (binary)"
Check if a binary supports 64bits arch
contains_array "String" "Fully ARRAY"
To check if a array already have some value
Bash:
#First define array
test=("a" "o l e" "huh")
#Check if some value exist
#It ends with error
contains_array "test" "${test[@]}"
#It ends without error
contains_array "o l e" "${test[@]}"
magic_file -type "FILE TYPE" "FILE"
You can check file types using their Magic hex values, in this way it doesnt matter if the file doesnt have an extension, the check will still work (Similar to the Linux "file" tool but fully customizable)
By default, it has file types already preloaded in "META-INF/zbin/configs/file_types.config"
Already preloaded files types:
- zip, gzip, bzip, xz, tar, Z, rar, 7z, lz4​- png, jpg, webp, ico, bmp, gif, gks, rgb, pm​- mp3, ogg, wav​- mp4, avi​- msdos (Windows Executable files)​- unix (Unix Executable files)​- dex (Android Dalvik Executable .dex)​- cpio (Android Ramdisk format)​- ramdisk (Its equal to cpio)​- sparse (Android Sparse IMGs)​
Bash:
magic_file -type jpg "/sdcard/Test.jpg"
magic_file -t mp4 "/sdcard/test.mp4"
magic_file -t zip "/sdcard/test.zip"
magic_file -t xz "/sdcard/test.xz"
magic_file -t dex "/sdcard/classes.dex"
-offset (-o) = Number to skip bytes (Optional)
-bytes (-b) = Bytes per line to get (Optional, by default: 100)
-line (-l) = After splitting hexadecimal code by -bytes, this number represents how many hex lines to take (Optional, by default: 1)
-type (-t) = To use any of the file types already preloaded (No additional configuration required)
-show (-s) = Prints all the Hex code that is being parsed (Only useful if more than 1 hex line is specified)
-show-line (-sl) = Prints only the Hex line that matches the Magic Hex Code (If it doesnt exist, it will only return "NULL")
Bash:
#Practical example
#With Preloaded Files Types
if magic_file -t jpg "$TMP/possible_jpg_image"; then
ui_print "Detected JPG IMAGE!"
else
abort "THIS IS NOT A JPG IMAGE!"
fi
if magic_file -t tar "$TMP/possible_tar_file"; then
ui_print "Detected TAR COMPRESSED FILE!"
else
abort "THIS IS NOT A TAR FILE!"
fi
#With Manual Mode (Using directly the Magic Hex Value)
if magic_file ffd8ffe0 "$TMP/possible_jpg_image"; then
ui_print "Detected JPG IMAGE!"
else
abort "THIS IS NOT A JPG IMAGE!"
fi
if magic_file -offset 257 7573746172 "$TMP/possible_tar_file"; then
ui_print "Detected TAR COMPRESSED FILE!"
else
abort "THIS IS NOT A TAR FILE!"
fi
testrw "Folder" "Folder" "..."
Test if one or more folders has write permissions
Bash:
if testrw "/system"; then
ui_print "You can write in /system!"
else
ui_print "Read-Only /system"
fi
if ! testrw "/system" "/vendor" "/odm"; then
abort "One of the required partitions is Read-Only"
fi
testvarname "Text"
Verify if the text is valid to be used as a variable name
-----------------------------------
APK/JAR TOOLS:
Spoiler
apktool arguments
Its the standard version of the apktool so that you can configure special options of the apktool
sign arguments
Its the standard version of the zipsigner so that you can configure special options of the zipsigner
apk_package "APK file"
Get the package of any apk
Bash:
apk_package "/system/app/Example.apk"
#Save it in a variable
app_package=$(apk_package "/system/app/Example.apk")
apk_main "APK file"
Get the main launchable activity (if it exists) of any apk
Bash:
apk_main "/system/app/Example.apk"
#Save it in a variable
app_activity=$(apk_main "/system/app/Example.apk")
apk_icon "APK file"
Get the icon path inside "res" of any apk
Bash:
apk_icon "/system/app/Example.apk"
#Save it in a variable
app_icon=$(apk_icon "/system/app/Example.apk")
apk_launch "APK file or its Package" <Activity to launch>
Launch the main launchable activity (or a specific activity) of some PRE-installed APP on the device (when its already booted)
NOTE: The PRE-installed application refers that the APP must already be installed on the device prior to its launch.
Bash:
#Try to find the main lauchable activity and launchs it
apk_launch "/system/app/Example.apk"
#Launch "com.app.main" activity of "/system/app/Example.apk"
apk_launch "/system/app/Example.apk" "com.app.main"
#Launch "com.android.systemui.DessertCase" of SystemUI.apk (Using the package directly)
apk_launch "com.android.systemui" "com.android.systemui.DessertCase"
decode_xml "XML File"
To decode AndroidManifest.xml (Does not support all XML)
Bash:
decode_xml "$TMP/AndroidManifest.xml"
encode_xml "XML File"
To encode AndroidManifest.xml or other predecoded APK XMLs (Supports any other xml)
Bash:
encode_xml "$TMP/AndroidManifest.xml"
find_apk "APK package" "APK Package" "..." "PATH to find"
Allows to find multiple APKs using its package in a specific path (it will return the exact path of those apks)
By default splits and overlays are ignored
Bash:
find_apk "com.android.systemui" "com.android.settings" "com.sec.android.app.launcher" /system
#Or recursive find (It will result in all apks with a similar pattern in the package):
find_apk -r "com.google" /system
-include-overlays (-io) = Include overlays (.APK)
-include-splits (-is) = Include splits (.APK)
patch_apk "FOLDER to inject" ".APK file" zipalign/sign
Supports: _addon and _zip extension
Its a portable version of vrtheme, it allows you to inject the contents of a folder into an .APK, additionally you can specify if you want to sign (Just works if dalvikvm available) or zipalign the apk
Bash:
patch_apk "FOLDER" SystemUI.apk sign
patch_apk "FOLDER" SystemUI.apk zipalign
make_overlay "Priority" "Destination Package" "FOLDER to build as res" "Result"
Supports: _addon and _zip extension
You can compile overlays (Layers that can alter values of other .APKs) only for Android 9+, but you CANNOT include images due to the limitations with the experimental apktool build for Dynamic Installer (See bugs section)
Priority = Priority level, if there are several overlays that alter the same value, the one with the highest priority number will be used
Package = Package of the app to which the overlay is directed
FOLDER = Folder in which the "res" to be used is located
Result = Resulting overlay path (Output)
Bash:
make_overlay 1 com.android.systemui "FOLDER" "/system/vendor/overlay/test.apk"
-----------------------------------
APK/JAR ADVANCED TOOL KITS:
Spoiler
dynamic_apktool -decompile(-d) "FILE" -framework(-f) "FILE" -add(-a) "FILE/FOLDER" -command(-c) "EXTRA APKTOOL OPTIONS to decompile" -output(-o) "DEST"
dynamic_apktool -preserve-signature(-ps) -recompile(-r) "FILE" -framework(-f) "FILE" -add(-a) "FILE/FOLDER" -command(-c) "EXTRA APKTOOL OPTIONS to recompile" -output(-o) "DEST" -sign(-s) -zipalign(-z)
-decompile = APK or .JAR to decompile
-add = FOLDERs or FILEs to add in the result
-framework = framework-res.apk to use
-output = Full path to results
-recompile = FOLDER to recompile
-sign = Sign the result (recompile)
-zipalign = Zipalign the result (recompile)
-command = Allows to add extra apktool.jar options
-preserve-signature = Try to keep the original META-INF and AndroidManifest.xml (recompile)
-no-api = Disable automatic specification of the device API
-no-extras = Disable original resource checking/adding (decompile)
-use-baksmali = Set an external baksmali.jar (DEXED) instead of the native apktool one (decompile)
-use-smali = Set an external smali.jar (DEXED) instead of the native apktool one (recompile)
Bash:
dynamic_apktool -decompile "Test.apk" -o "/sdcard/Test" -add "/sdcard/folder"
dynamic_apktool -no-extras -use-baksmali "$TMP/custom.jar" -decompile "Test.apk" -o "/sdcard/Test" -add "/sdcard/folder"
dynamic_apktool -recompile "/sdcard/Test" -add "/sdcard/testfolder" -add "/sdcard/Test/original/META-INF" -a "/sdcard/test.txt" -zipalign -sign
smali_kit -dir(-d) "FOLDER" -file(-f) "FILE" -method(-m) "METHOD to find" -replace(-r) "Full NEW METHOD" -replace-in-method(-rim) "OLD STRING" "NEW STRING" -delete-in-method(-dim) "STRING to remove" -remake(-re) "NEW INTERNAL CONTENT" -after-line(-al) "LINE" "STRING to add after" -before-line(-bl) "LINE" "STRING to add before" -name(-n) "PATTERN NAME of .smali FILEs" -static-name(-sn) "EXACTLY name of .smali" -limit(-l) "LIMIT NUMBER OF RESULTS" -check(-c) -delete-method(-dm) -print-path(-pp)
-dir = PATH to find .smali methods
-file = File to find .smali methods
-method = Pattern .method name to find
-print-path = Just print the paths of all .smali files with that .method
-replace = Replace ALL found .method
-replace-in-method = Replace STRING of .method found with STRING2 (STRING to STRING2)
-delete-in-method = Delete STRING of .method found
-delete-method = Remove whole .method found
-remake = Replace only the internal content of the .method found
-after-line = Add a STRING after the specified line inside the found .method
-before-line = Add a STRING before the specified line inside the found .method
-name = Pattern that .smali files must have
-static-name = Exactly name that ONE .smali must have
-limit = The amount of results can be processed
-check = Report modified files or if there were no changes
Bash:
REPLACE="
.method public static isTima()Z
.locals 1
const/4 v0, 0x1
return v0
.end method
"
TEST="
.locals 1
const/4 v0, 0x4
return v0
"
smali_kit -check -method "isTima" -d "FOLDER" -replace "$REPLACE"
smali_kit -method "isTima" -dir "FOLDER" -replace-in-method "const/4 v0, 0x1" "const/4 v0, 0x0"
smali_kit -method "isTima" -d "FOLDER" -remake "$TEST"
smali_kit -method "isTima" -f "file.smali" -replace "$REPLACE"
-----------------------------------
EXTRA TOOLS:
Spoiler
adb arguments
Its the standard version of the ADB so that you can configure special options
-----------------------------------
LOGGING:
Spoiler
startlog "PATH/file"
Create a file that will be used to save the contents with "savelog"
savelog "Text" "Text" "..."
Send text to file created with "startlog"
endlog
To stop "savelog" that started with "startlog" (When logging is finished, any text attempted to be sent with "savelog\echolog\printlog" will be ignored)
echolog "Text" "Text" "..."
The text is printed both in the general log (Text as Error - Stderr), and in the file created by "startlog"
printlog "Text" "Text" "..."
The text is printed both on the screen (ui_print), and in the file created by "startlog"
-----------------------------------
DYNAMIC VARIABLES:
Spoiler
setdefault "variable" "string"
Its equivalent to defining a normal variable (myvar = b) but it allows dynamic variable names
Bash:
var_name="test"
#Since the content of var_name is "test", the name of the new variable is "test"
setdefault $var_name "just test"
ui_print "$test"
checkvar "variable" "variable" "..."
Check multiple variables and return the value of those that are defined
Bash:
var_contents=$(checkvar var1 var2 var3)
#Very useful to obtain the content of variables with dynamic names
number=4
setdefault var$number "o l e"
var_content=$(checkvar var$number)
filtervar "variable" "variable" "..." "pattern"
Check multiple variables and look for a matching pattern in the value of these variables (the complete value of those variables is returned)
Bash:
matched_content=$(filtervar var1 var2 var3 "find this")
defined "variable" "variable" "..."
Check if multiple variables are defined
Bash:
if defined var1; then
ui_print "Success"
fi
#Multi check
if defined var1 var2 var3; then
ui_print "Success"
fi
#Dynamic var names
number=4
setdefault var$number "o l e"
if defined var$number; then
ui_print "Success"
fi
undefined "variable" "variable" "..."
Check if multiple variables are not defined
Bash:
if undefined var1; then
ui_print "Empty var1"
fi
#Multi check
if undefined var1 var2 var3; then
ui_print "Empty var1, var2 and var3"
fi
#Dynamic var names
number=4
setdefault var$number "o l e"
if undefined var$number; then
ui_print "Empty var$number"
fi
-----------------------------------
CREATE FILES/FOLDERS:
Spoiler
create_dir "NEW folder" "NEW folder" "..."
You can create new folders (if needed) and also check the Read/Write permissions in them
create_file "NEW file" "NEW file" "..."
You can create new files (or overwrite already existing files) - The necessary folders are created automatically
make_zip -script "Text" -type <recovery/magisk> -output "Result ZIP"
You can create new ZIPs using your current version of the Dynamic Installer as a base
-script (-s) = The Script for the New ZIP (In text format - string)
-type (-t) = The type can be "recovery" or "magisk" and it helps to build the ZIP
-head (-h) = The setdefaults header (In text format - String) to use in the updater-script when using -type "magisk"
-include (-i) = Include files or folders in the root of the ZIP
-magisk-include (-mi) = Include files or folders in Magisk space
-preserve-addons (-pa) = Keep the META-INF/addons contents of the current ZIP
-preserve-magisk (-pm) = Keep the META-INF/com/google/android/magisk contents of the current ZIP
-output (-o) = Path for the resulting ZIP
Bash:
script='
#-----------Dynamic Installer Configs-----------#
#The #MAGISK tag is required, dont remove it
#MAGISK
setdefault magisk_support on
setdefault import_addons off
setdefault apex_mount off
setdefault extraction_speed default
setdefault permissions "0:0:0755:0644"
setdefault devices off
#-----------------------------------------------#
#Your script starts here:
mount_all
delete /system/just_test
umount_all
'
make_zip -script "$script" -type recovery -include "FOLDER" -include "FILE" -output "/sdcard/Test.zip"
-----------------------------------
INSTALL FILES:
Spoiler
update ".img/.img.xz/.img.gz/.bin/..." "partition" <exit number>
Supports: _addon and _zip extension
Try install img or bin files (system.img super.img boot.img optics.img prism.img param.bin ...)
-xz = To install a .xz compressed File
-gz = To install a .gz compressed File
-sparse = To install Sparse IMGs instead of RAW IMGs (Only for 64bit devices)
exit number = If "1" is used, it will be evaluated if the installation of the file was successful, otherwise everything will be aborted
Bash:
#Update system
update /sdcard/system.img $(find_block system)
#Using _zip extension
#Update using file inside ZIP
update_zip system.img $(find_block system)
#Update using .xz compressed file
update_zip -xz vendor.img.xz $(find_block vendor)
#Update using .gz compressed file
update_zip -gz boot.img.gz $(find_block boot)
#Update using an IMG Sparse
update_zip -sparse system.img $(find_block system)
#Update using an IMG Sparse additionally compressed as .xz
update_zip -sparse -xz system.img.xz $(find_block system)
#Update but ABORT the ZIP installation in case of error
update_zip -xz super.img.xz "$(find_block super)" 1
flash "variable" "zip file" <print>
Supports: _addon and _zip extension
Try to install a new ZIP file within the current installation and the result is saved in the variable, also you can include a third optional argument "print" to allow the new ZIP to print text on Recovery.
Bash:
#External ZIP
flash log1 "/sdcard/custom.zip"
#Internal ZIP
flash_zip log_name "folder/test.zip"
#Allow text printing in recovery
flash_zip log_name "folder/test.zip" print
#...
dynamic_install "path" "path"
Similar to package_extract_dir but only works with existing paths outside the ZIP
Bash:
dynamic_install "/vendor" "$MODPATH/system/vendor"
dynamic_install_apk "path outside zip" "path outside zip"
Find all existing APKs in the first folder in the second folder (Not by name, by package), in case the second folder already contains one of the APKs, it will be replaced keeping the original path and name. if it does not exist, the directory will be created according to the first folder
You can also redirect the destination path (Compare 2 directories with .APKs, perfect for Magisk modules)
NOTE: By default overlays are ignored but APK Splits are included with the main app
-no-replace(-nr) = Avoid replacing existing APKs
-no-add(-na) = Avoid adding new APKs
-include(-i) = Add extra folders/files references to add in the destination of the APKs - UnLimited
-remove-oat = Remove all oat folders of old apks (in the destination)
Bash:
#Simple usage
dynamic_install_apk "FOLDER" "/system"
#Include extra files/Folders
#The "oat" and "lib" folders will be included in the destination of all APKs
dynamic_install_apk -include "oat" -include "lib" "FOLDER" "/system"
#Redirect results
dynamic_install_apk "FOLDER" "/system" -output "/sdcard/results"
apk_install ".APK or .APKM" ".APK or .APKM" "..."
Install multiple .APK or .APKM (ApkMirror) files, .APKM files are a ZIP with the main .APK and Splits required for each device, these Splits will be filtered and included in the installation automatically based on device specifications, however , you are free to include additional Splits
To include Splits in the .APK installation:
Bash:
#Install single .APK with multiple external Splits
apk_install "$TMP/Main.apk:$TMP/Split.apk:$TMP/Split2.apk"
#Multi .APK installation with multiple external Splits
apk_install "/sdcard/Main.apk:$TMP/Split.apk:$TMP/Split2.apk" "/sdcard/Main2.apk:$TMP/Split3.apk:$TMP/Split4.apk"
To include additional Splits in the .APKM installation:
NOTE: For .APKM you can just include the name of the Split and it will try to extract from the .APKM instead of taking it from an external path
Bash:
#Install single .APKM with multiple additional external Splits
apk_install "$TMP/Main.apkm:$TMP/Split.apk:$TMP/Split2.apk"
#Multi .APKM installation with multiple additional external Splits
apk_install "/sdcard/Main.apkm:$TMP/Split.apk:$TMP/Split2.apk" "/sdcard/Main2.apkm:$TMP/Split3.apk:$TMP/Split4.apk"
#Include additional Splits that exist within the .APKM
apk_install "$TMP/Main.apkm:split_config.ru.apk:split_voip.apk"
apk_install_recursive "FOLDER" "FOLDER" "..."
Install all .APK/.APKM that are inside a folder, also allows creating subfolders to group specific .APK/.APKM with additional splits
/sdcard/myapps
Bash:
/sdcard/myapps/Normal.apk
/sdcard/myapps/Normal2.apkm
/sdcard/myapps/subfolder/Main.apk
/sdcard/myapps/subfolder/split.apk
/sdcard/myapps/subfolder/split2.apk
When performing the recursive installation in this example, only "Main.apk" will be installed together with the .APKs that accompany it (Splits), because it is the only one that is grouped in a subfolder
Bash:
apk_install_recursive "/sdcard/myapps"
unify_path "First PATH" "Second PATH"
To compare one folder with another, this includes a comparison of files that already exist in both folders, if they are not the same, they are replaced or added to the second folder
Bash:
#Compare folder TEST with TEST2
#Fix ALL differences in TEST2
unify_path "/sdcard/TEST" "/sdcard/TEST2"
-----------------------------------
HEXADECIMAL PATCH:
Spoiler
hex_patch "Hex code to find" "New Hex code" "file"
Allows to substitute Hex fragments within files (perfect for patching)
Bash:
hex_patch "74696d65" "00696d65" /system/bin/testfile
hex_search <include> "Hex code to find" "file"
Allows to search Hexadecimal lines within files (The resulting line is returned)
Additional digits can be included before or after the found hex:
Bash:
hex_search -include "after:10 before:5" "74696d65" /system/bin/testfile
##If the Hex code is found, it will return the result together with 10 previous digits and 5 extra digits at the end of the string
hex_check "Hex code to find" "file"
Checks for the existence of a Hexadecimal fragment within a file
Bash:
hex_check "74696d65" /system/bin/testfile
-----------------------------------
DYNAMIC PARTITIONS (SUPER):
Spoiler
checksuper "SUPER Partition or RAW .img"
To check if a image/partition is a SUPER image in record time
Bash:
#Check SUPER partition
checksuper $(find_block super)
#Check SUPER image
checksuper "/sdcard/super.img"
get_offset "Subpartition Name" "SUPER Partition or RAW .img"
To get the offset of any subpartition inside a SUPER partition/image in record time
Bash:
get_offset system $(find_block super)
#For A/B
get_offset system$slot $(find_block super)
get_group "Subpartition Name" "SUPER Partition or RAW .img"
To get the group of any subpartition inside a SUPER partition/image in record time
get_total_size "SUPER Partition or RAW .img"
To get the total size of all subpartitions inside a SUPER partition/image
Bash:
get_total_size $(find_block super)
get_all_subparts "SUPER Partition or RAW .img"
To get the name of all subpartitions of an img/partition (SUPER)
Bash:
get_all_subparts $(find_block super)
start_loop "Subpartition Name" "SUPER Partition or RAW .img"
To make new mount point of any subpartition inside a SUPER partition/image (Designed for new Virtual Dynamic Partitions)
The new mount point (Loop device) is assigned in $LOOP variable
Bash:
#Make new point with system inside SUPER .img
start_loop system /sdcard/super.img
system_point="$LOOP"
#Make new point with vendor inside SUPER partition
start_loop vendor $(find_block super)
vendor_point="$LOOP"
#Make new point for A/B devices
start_loop system_a $(find_block super)
system_point="$LOOP"
end_loop
To end previously made mount point with "start_loop" based on the order of creation (It works like "end_tmp")
Bash:
#First make multiple Mount Points
start_loop system_a /sdcard/super.img
system="$LOOP"
start_loop vendor_a /sdcard/super.img
vendor="$LOOP"
start_loop product_a /sdcard/super.img
product="$LOOP"
#Now to finish NEW POINTS
end_loop
end_loop
end_loop
unlock_all <Partition/IMG>
To try convert all internal subpartitions of SUPER to Read/Write on-fly
NOTE: It is not necessary to specify the partition/IMG (Super of the device is used by default), but you can do it if you need it
unlock "Subpartition Name" <Partition/IMG>
To convert specific subpartition of SUPER to Read/Write (Like unlock_all doesnt work in some cases)
NOTE: It is not necessary to specify the partition/IMG (Super of the device is used by default), but you can do it if you need it
Bash:
#For A/B u need to use $slot
#Try enable RW in system (Active slot)
unlock system$slot
#Specific slot
unlock system_a
#Try enable RW in vendor (Active slot)
unlock vendor$slot
#Try enable RW in vendor from external SUPER.img
unlock vendor_a /sdcard/super.img
-----------------------------------
PROTECT YOUR CODE:
Spoiler
obfuscate "Text"
Allows you to encode the shell script code (or Dynamic Installer scripts), keeping it working but making it difficult for common users to read (you can mix obfuscated code with readable code)
-base64 (-b64) = This option ensures the preservation of all the original code, encoding the code in base64 before being obfuscated, this implies a greater weight (Only use if the default obfuscation gives bad results)
NOTE: For its use, it is recommended to load the Dynamic Installer in Termux, through the "Test Mode" mentioned in the first thread
WARNING: Never obfuscate the default "setdefault"s in the DI updater-script (they need to be readable for the installation process)
EXTRA WARNING: The "off_readonly" lines cannot be obfuscated either, as they are read and interpreted during installation
Example:1 (Note the use of single quotes):
Bash:
#Obfuscate commands directly (Default mode)
obfuscate ' ui_print "All this will be obfuscated"
ui_print "Mounting partitions..."
mount_all ' > /sdcard/obfuscated.sh
#With Base64 Mode
obfuscate -b64 ' ui_print "All this will be obfuscated"
ui_print "Unmounting partitions..."
umount_all ' > /sdcard/obfuscated.sh
Example:2 (Obfuscate files):
Bash:
obfuscate "$(cat /sdcard/original.sh)" > /sdcard/obfuscated.sh
#You can also use this syntax:
cat /sdcard/original.sh | obfuscate > /sdcard/obfuscated.sh
#With Base64 Mode
cat /sdcard/original.sh | obfuscate -b64 > /sdcard/obfuscated.sh
Example:3 (Mix obfuscated code with readable code):
Bash:
obfuscate ' ole="Hi, this action will be obfuscated" ' > /sdcard/obfuscated.sh
Obfuscated code:
Bash:
cjifh="=";gegb=" ";bjbij=",";iagg=\";bhbcb="a";ichh="b";dafa="c";chaa="d";hb="e";cjdeb="f";gfah="H";bjac="i";caddf="l";bgfgf="n";bhcj="o";daafj="s";cdefi="t";cdaib="u";caedc="w";bgacd="v";${hb}${bgacd}${bhbcb}${caddf}${gegb}"${gegb}${gegb}${gegb}${bhcj}${caddf}${hb}${cjifh}${iagg}${gfah}${bjac}${bjbij}${gegb}${cdefi}h${bjac}${daafj}${gegb}${bhbcb}${dafa}${cdefi}${bjac}${bhcj}${bgfgf}${gegb}${caedc}${bjac}${caddf}${caddf}${gegb}${ichh}${hb}${gegb}${bhcj}${ichh}${cjdeb}${cdaib}${daafj}${dafa}${bhbcb}${cdefi}${hb}${chaa}${iagg}${gegb}${gegb}"
This would print "Hi, this action will be obfuscated"
Bash:
cjifh="=";gegb=" ";bjbij=",";iagg=\";bhbcb="a";ichh="b";dafa="c";chaa="d";hb="e";cjdeb="f";gfah="H";bjac="i";caddf="l";bgfgf="n";bhcj="o";daafj="s";cdefi="t";cdaib="u";caedc="w";bgacd="v";${hb}${bgacd}${bhbcb}${caddf}${gegb}"${gegb}${gegb}${gegb}${bhcj}${caddf}${hb}${cjifh}${iagg}${gfah}${bjac}${bjbij}${gegb}${cdefi}h${bjac}${daafj}${gegb}${bhbcb}${dafa}${cdefi}${bjac}${bhcj}${bgfgf}${gegb}${caedc}${bjac}${caddf}${caddf}${gegb}${ichh}${hb}${gegb}${bhcj}${ichh}${cjdeb}${cdaib}${daafj}${dafa}${bhbcb}${cdefi}${hb}${chaa}${iagg}${gegb}${gegb}"
ui_print "$ole"
-----------------------------------
OTHER STUFF:
Spoiler
fprint "file"
Supports: _addon and _zip extension
Print the content of a file in the recovery or magisk
import_bin "File"
Supports: _addon and _zip extension
Allows you to import new files to the Dynamic Installer work environment (Perfect for adding extra binaries, they can be used directly in your scripts after an import)
getsize "file"
Return the size of any file (In Bytes)
getblocks
Convert all existing partitions to variables ($system, $vendor, $boot, $vbmeta)
getbins
Returns all available binaries (commands) and also generates a $bins variable that contains all
copy "original" "dest"
Copy any file or folder (Dest folders auto-created)
move "original" "dest"
Move any file or folder (Dest folders auto-created)
echo2 "Text"
Print text as Error - Stderr (For example, the text doesnt appear on the Magisk installation screen but yeah in the LOG)
calc <Operations>
To make basic operations like addition, subtraction, division, exponents (The result will not always be an integer or decimal, results with scientific notation are accepted)
Bash:
result=$(calc "5 + 5")
result=$(calc "20^45 * ( 30 / 5 )")
int <Number or Operations>
To convert any number to an integer or ensure an operational result as an integer
Bash:
#Will return "5" without rounding
result=$(int "5.5")
#Will return "62" without rounding
result=$(int "(5^3)/2")
float <Number or Operations>
To convert any number to an floating-point number, or ensure an operational result as an floating-point number
Bash:
#Will return "5.500000000" with 9 decimals by default
result=$(float "5.5")
#Will return "62.500000000" with 9 decimals by default
result=$(float "(5^3)/2")
#How to increase decimal parts?
setdefault float_length 10
#Will return "5.5000000000" with 10 decimals
result=$(float "5.5")
#How to decrease decimal parts?
setdefault float_length 2
#Will return "5.50" with 2 decimals
result=$(float "5.5")
round <Number or Operations>
To round any number to only integers or to ensure an operational result as an rounded integer
Bash:
#Will return "6" with rounding
result=$(round "5.5")
#Will return "63" with rounding
result=$(round "(5^3)/2")
change_bin "Binary name" "Binary name" "..."
By default the Dynamic Installer uses the native Busybox binaries (with the exception of a few like "xxd" and "xz"), however, these binaries are trimmed versions, where any external version generally provides more options. The change_bin function can find for and change any binary currently in use to any other available external version.
-while (-w) = Allows detailing that the binary must support a specific option (Although there are external versions available, if they do not support the established option, they will not be considered)
NOTE: The changes are random, that is, if three binaries with the same name are found, a random change will be made, and it can be any of these three, the only condition is that it is different from the one currently used (For each use of "change_bin" you will get a different result, with chances of going back to the original binary)
EXTRA NOTE: If the full path of an existing file is specified and it is different from the current binary, change_bin will make the change with that file ignoring any of the other options (it will take the file name as reference)
Bash:
#Try using some other version of "chmod"
change_bin "chmod"
#Change the "unzip" binary only to another version that supports the "-p" option
change_bin "unzip" -while "-p"
#Muti change
change_bin "chmod" "unzip" "find"
#Restore to Original Busybox binaries
#$l is the path where all the native DI binaries are
change_bin "$l/chmod"
SCRIPT EXAMPLES:​
ROM Installation
NOTE: The use of RAW IMGs is recommended (more direct and faster installation) but it is also possible to use Sparse IMGs (Only for 64bit devices)
META-INF/com/google/android/updater-script
Spoiler
Bash:
#-----------Dynamic Installer Configs-----------#
#The #MAGISK tag is required, dont remove it
#MAGISK
setdefault magisk_support on
setdefault ensure_root on
setdefault import_addons off
setdefault apex_mount off
setdefault extraction_speed default
setdefault permissions "0:0:0755:0644"
setdefault devices off
#-----------------------------------------------#
#Your script starts here:
ui_print "--------------------------------"
ui_print " ElementaryOS "
ui_print " OneUI 3.1 "
ui_print "--------------------------------"
ui_print " by BlassGO "
ui_print "--------------------------------"
ui_print " "
ui_print "-------------------"
ui_print " UNMOUNT "
ui_print "-------------------"
ui_print " "
umount_all
ui_print "-------------------"
ui_print " INSTALLING PARAM "
ui_print "-------------------"
ui_print " "
update_zip param.bin "$(find_block up_param)"
ui_print "-------------------"
ui_print " INSTALLING KERNEL "
ui_print "-------------------"
ui_print " "
update_zip boot.img "$(find_block boot)"
ui_print "-------------------"
ui_print " INSTALLING OMC "
ui_print "-------------------"
ui_print " "
update_zip optics.img "$(find_block optics)"
#Using a Sparse IMG
update_zip -sparse prism.img "$(find_block prism)"
#Installing RAW SUPER (system, vendor, product, odm)
ui_print "-------------------"
ui_print " INSTALLING SUPER "
ui_print "-------------------"
ui_print " "
#Extra compressed as XZ
update_zip -xz super.img.xz "$(find_block super)"
ui_print "-------------------"
ui_print " DONE "
ui_print "-------------------"
ui_print " "
Only Extraction
META-INF/com/google/android/updater-script
Spoiler
Bash:
#-----------Dynamic Installer Configs-----------#
#The #MAGISK tag is required, dont remove it
#MAGISK
setdefault magisk_support on
setdefault ensure_root on
setdefault import_addons off
setdefault apex_mount off
setdefault extraction_speed default
setdefault permissions "0:0:0755:0644"
setdefault devices off
#-----------------------------------------------#
#Your script starts here:
ui_print " "
ui_print " -- Mounting partitions..."
mount_all
ui_print " -- Extracting mods..."
package_extract_dir system /system
package_extract_dir vendor /vendor
package_extract_dir system_ext /system_ext
ui_print " -- Unmounting ALL"
umount_all
ui_print " "
ui_print " -- Done"
ui_print " "
Magisk Module
NOTE: You can add folders directly in META-INF/com/google/android/magisk and they will be added automatically in your module
META-INF/com/google/android/magisk/customize.sh
Spoiler
Bash:
#Magisk modules use $MODPATH as main path
#Your script starts here:
ui_print "-------------------------------------------------- "
ui_print " MODS for Android "
ui_print "-------------------------------------------------- "
ui_print " by @BlassGO | Version: 1.0 "
ui_print "-------------------------------------------------- "
ui_print " "
ui_print " -- Installing MODS in /system"
package_extract_dir system "$MODPATH/system"
ui_print " -- Installing MODS in /vendor"
package_extract_dir vendor "$MODPATH/system/vendor"
ui_print " -- Installing MODS in /product"
package_extract_dir product "$MODPATH/system/product"
ui_print " -- Fixing Contexts"
set_context /system "$MODPATH/system"
ui_print " "
ui_print " -- Done"
ui_print " "
Magisk Module (APKTOOL)
NOTE: The dynamic_apktool only decodes ALL classes.dex, no content of "res" is directly editable (Check the BUGS of the Dynamic Installer)
META-INF/com/google/android/magisk/customize.sh
Spoiler
Bash:
#Magisk modules use $MODPATH as main path
#Your script starts here:
enable='
.locals 1
const/4 v0, 0x1
return v0
'
ui_print " -- Finding SystemUI.apk"
APK=$(find_apk com.android.systemui /system)
ui_print " -- Checking results"
if undefined APK; then
abort " CANT FIND: SystemUI.apk"
fi
ui_print " -- Decompiling SystemUI.apk"
dynamic_apktool -decompile "$APK" -output "$TMP/decompiled"
ui_print " -- Patching SystemUI.apk"
smali_kit -check -method "isUnlockingWithBiometricAllowed" -remake "$enable" -dir "$TMP/decompiled"
ui_print " -- Recompiling SystemUI.apk"
dynamic_apktool -preserve-signature -recompile "$TMP/decompiled" -output "$MODPATH$APK"
ui_print " -- Checking results"
if ! is_valid "$MODPATH$APK"; then
abort "Some error in the APK recompilation"
fi
ui_print " -- Fixing Context "
set_context "$APK" "$MODPATH$APK"
ui_print " "
ui_print " -- Done "
ui_print " "
CHANGELOG:​
Spoiler: Old changelogs
[CHANGELOG 1.1]
-- dynamic_install_apk now support redirection of output, APK splits, APK lib folder and -no-replace -no-add flags
[CHANGELOG 1.2]
-- Improvements and new functions for smali_kit (Change in syntax of -replace-in-method)
[CHANGELOG 1.3]
-- Small improvements to Mounting partitions
-- smali_kit now ignores abstract methods
-- dynamic_apktool now supports extra commands for apktool
-- Now u can use apk_pkg as an equivalent of apk_package
[CHANGELOG 1.4]
-- The Dynamic Installer was restructured for greater optimization and organization
-- A new setdefault "fast_mode" has been added that allows a much faster execution (When activated you will not have the variables of the partitions $system/$vendor/$boot/... and the variables $bins/$all_partitions)
-- A new "replace" function was added, check the Actions section / Editing Files
-- filetype function was removed
[CHANGELOG 1.4-b]
-- Fixed a fatal bug inside auto_mount_partitions Ooof
[CHANGELOG 1.5]
-- Maintenance, fixed and optimized functions
-- update_file_string and add_lines_string now support any type of strings
-- If you use " " an empty space with add_lines_string a new empty line will be added to the file
-- add_lines_string now supports -after-line and -before-line infinitely, you can add text before or after a specific line
-- ui_print now supports more situations, you can print several lines (ui_print "line1" " " "line3") or a whole paragraph(ui_print "$paragraph") even from Recovery
-- New function: force_update_file_string
[CHANGELOG 2.0]
New functions:
string >> Advanced and easy string manipulation
run_wait >> Limit the execution time of any process (Includes Dynamic Installer functions)
is_valid >> Check if files exists and non-empy
is_number >> Check if is a number
check_content >> Check if a file exists inside a .ZIP
getsize >> Return the size of any file
can_run >> Check if a binary can run on the device
exist >> Check if files or folders exists
repeat >> Repeat text by a specific number
copy >> Force copy files and folders
move >> Force move files and folders
echo2 >> Print text as error (For example, the text doesnt appear on the Magisk screen but yeah in the LOG)
is_zip/is_tar/is_gzip/is_bzip/is_xz >> Check type of some files
Improved:
hex_search/hex_check/hex_patch >> Important fixes and new functions, full support for hexadecimal manipulation
dynamic_apktool >> Some fixes and now supports -preserve-signature for APKs and JARs
update_file/update_file_string/force_update_file/force_update_file_string >> Important fixes and now supports more XML cases and delimiters (-delim flag)
savestate >> Fixed some errors
replace >> Fixed some errors
Extra Fixes:
-- Fixed infinite loop when using try_mount with uncommon partitions
New variables:
$TMP2 >> Multiple Dynamic Temp Spaces (start_tmp/end_tmp)
New setdefaults:
setdefault apex_mount >> Now you can control if you want to mount APEX or not (If you use it in "off" the mounting will be much faster)
[CHANGELOG 2.1]
-- Slight errors fixed
-- Now most of the Dynamic Installer actions support false/positive results (You can use an "if" condition with these actions)
-- New function: make_overlay was added
[CHANGELOG 2.2]
-- A fatal error was fixed in try_mount
-- Improved functions for updating .props and .xml (update_file_string/update_file/...)
-- Removed setdefault results (Deprecated)
[CHANGELOG 2.3]
-- Fixed defined/undefined/checkvar
/filtervar functions with some variables
-- replace function now supports any pattern to find and replace with -recursive flag (Not just whole words)
-- add_lines now support -after-line and -before-line (Unlimited) and multiple files to add (Unlimited)
-- umount_all has been improved to avoid "Cannot mount /partition" errors on some devices after installation
[CHANGELOG 2.6]
- Maintenance (Some fixes and improvements)
- Removed setdefault fast_mode (Deprecated)
- New "Test Mode", now u can test some Dynamic Installer functions in Termux on Android
- Improved all update_file functions (update_file_string/force_update_file/..)
[CHANGELOG 2.7]
- /system_root as RW (Read/Write), you will be able to make changes inside, previously it was mounted in Read/Only and only specific sections like /system in RW
- smali_kit now supports a search mode for .smali files that have a .method (-print-path)
- smali_kit now can remove whole .methods (-delete-method)
- Fixed "Test Mode" (Execution problems)
[CHANGELOG 2.7-b3]
- Small but important fixes
- Replaced "flash" function with "force_flash" (So now just exist "flash" to install extra ZIPs)
- The correct assignment of permissions was ensured with functions that gave them automatically (package_extract_dir, package_extract_file, dynamic_install_apk, .....)
[CHANGELOG 3.0]
News:
Finally support dalvikvm from Recovery Android 11+ (Beta - You can use apktool and other Smali tools) - setdefault apex_mount is needed
Many functions were improved to work in more situations
Fixes:
Fixed issues adding paragraphs or spaces directly with some flags like -after-line -before-line (add_lines_string/smali_kit/...)
Fixed package_extract_dir with file names with spaces
Fixed error loading .sh that have names with spaces when activating setdefault run_addons
Improved:
find_apk now supports infinite packages to find (find_apk "package1" "package2" "..." "PATH")
dynamic_install_apk now supports "-include" flag to include extra files/folders with the apks and "-remove-oat" to remove all oat folders in the destination
string function now supports -after-line and -before-line
getbins and getblocks functions reformed (were previously deprecated)
setdefault devices format improved
New functions:
is_greater/is_equal/is_less (Comparison)
make_zip (To make functional ZIPs using ur current Dynamic Installer as base)
New variables:
$chipname that will allow to identify snapdragon/exynos/mediatek/kirin chipsets
[CHANGELOG 3.1]
Improved chipset detection for $chipname variable
copy and move functions now can create the destination folders
defined and undefined functions now supports infinite variables to check
New function set_context to use the contexts of one path in another, the best contexts are logically evaluated for ALL folders and files, although you can also assign the context of a single file to another (Perfect for Magisk modules)
New function eval_context to get the most common context in a path (It eval the common results) or just get the context of a single file
Now by default find_apk ignores splits and overlays unless you enable it manually with "-include-splits" or "-include-overlays"
try_mount can now mount the partitions specifically in Read/Write or Read/Only (By default both are used) with "-read-write" and "-read-only" flags, it also includes "-remount" to unmount the partitions before mounting
update_file/update_file_string/force_update_file/.... now supports "-no-spaces" flag to prevent auto-detection of spaces in new lines
[CHANGELOG 3.2]
Some fixes
New function patch_fstab to patch fstab properties easily
New function contains to check the existence of infinite strings in a file
Now string function will only process the first result with the "remove/replace/extract/complete_extract" flags but it can also process all results (-recursive) even in text extraction, also "extract/complete_extract" support returning only paragraphs that have a pattern substring(-pattern), and supports -file flag to directly load a file
New Recovery Mode (Similar to Test Mode) to use the Dynamic Installer actions from the Recovery terminal
The Test Mode was improved
[CHANGELOG 3.3]
News:
Some fixes
Fixed common A/B partitions mount
Fixed exist function with dummy find
Fixed find_apk (It was broken)
Fixed string (lower and upper)
Experimental Support for Virtual Dynamic Partitions
Now you can mount .img (RAW) directly, this allows you to make edits without having to redo the .img
Support for direct partition mounting/editing when the device is already booted with auto_mount_partitions and try_mount (Experimental)
Improved:
find_block now supports a very fast find without the need for a long wait (-express), also supports the find to be stopped at a specific time (-time)
try_mount now supports specifying the block to find/mount (-name), also support specify a file to mount (-file) instead of a partition, also supports "-express" like find_block and extra improvements
Improved unmount
Improved umount_all
Improved is_greater/is_less (Now supports decimal numbers)
Improved is_mounted (Now it can check a folder in the current directory without needed of fully path)
update_file/update_file_string/force_update_file/force_update_file_string now support -pattern flag using -delim to apply changes only to a segment that has the specific pattern (It analyze all segments within the specified delim)
New setdefault:
New setdefault magisk_support to disable magisk space and just use updater-script (Device booted)
New setdefault extraction_speed to change the speed (MB/s) for update/update_zip/write_raw_image functions
New functions:
New function is64bit to check if a binary supports 64bits arch
New function echolog to print as error(echo2) and "savelog" in the same time
New function printlog to ui_print and "savelog" in the same time
New function endlog to stop "savelog" that started with "startlog"
New function contains_array to check if a array already have some value
New function get_array to get fully value in a array using some pattern
New function get_size_ext4 to get the current size of any partition or compatible file (ext4/.img)
New function calc to make basic operations like addition, subtraction, division, exponents (also supports parentheses and multiplication but you must use quotes to escape that symbols '()' '*' )
New function unify_path to compare one folder with another, this includes a comparison of files that already exist in both paths, if they are not the same, they are replaced or added to the second path
New functions for Dynamic Partitions:
New function checksuper to check if a image/partition is a SUPER image in record time
New function get_offset to get the offset of any subpartition inside a SUPER partition/image in record time
New function get_group to get the group of any subpartition inside a SUPER partition/image in record time
New function get_total_size to get the total size of all subpartitions inside a SUPER partition/image
New function start_loop to make new mount point of any subpartition inside a SUPER partition/image (Designed for new Virtual Dynamic Partitions)
New function end_loop to end previously made mount point with "start_loop" based on the order of creation (It works like "end_tmp")
New function super_rw to enable Read/Write on SUPER partitions/images (Designed for Virtual Dynamic Partitions), this method extracts and converts all internal subpartitions of SUPER (It takes a little time) for this reason you have to add "super_rw" in the updater-script manually
New function unlock_all to try convert all internal subpartitions of SUPER to Read/Write on-fly (It doesnt require a very long waiting time like super_rw but it may not work in some cases)
New function unlock to convert specific subpartition of SUPER to Read/Write (Like unlock_all doesnt work in some cases)
[CHANGELOG 3.4]
Some fixes
Improved umount_all
Improved dynamic_apktool (Now it will not decompile "res" from the .APK by default)
setdefault devices now support Model names (Example: SM-A515F)
New function wipe to wipe any section like system, vendor, product, odm, data, dalvik, cache
Read-Only was activated in all native functions of the Dynamic Installer to avoid substitution problems when importing a new shell script (.sh) that contains functions with the same names of the native functions (Now native functions cannot be altered during installation)
[CHANGELOG 3.5]
Now only abort can end the installation with error, previously if the last action used ended in error the whole installation did too
When "$TMP" is auto-wiped, files with .log extension will not be deleted to avoid significant loss of information (You will not lose any LOG after installation)
New feature off_readonly to notify the Dynamic Installer that you want to modify some functions of its code in your script, with this the specified functions can be replaced during the installation (By default all functions are in Read/Only)
Improved package_extract_dir and package_extract_file (Now if a destination path is not provided the files will be returned directly as Text, useful to process files without extracting them)
Now update/update_zip/.. supports two new formats .xz and .gz, you can install the files you want using this type of compression, the files will be installed directly (they are not extracted) so using them does not increase the time of installation, it only reduces the size of your ZIP
[CHANGELOG 3.6]
Some fixes
Updated Magisk Module installer
Fixed "ERROR: Failed to setup busybox" on some devices
Now important variables protected with Read/Only (Btw u can use off_readonly)
Improved /apex mount
Fixed possible slot detection bugs for A/B devices
Fixed savestate
Improved update/update_zip (By default it will try to set the dest block as Read/Write if possible, else end with error)
New experimental variable $encrypted to check if the the device has encrypted internal memory
Added more detailed warnings in case of error
New function ch_con to manually set the context in mutiple single files/folders
New function ch_con_recursive to manually set the context to ALL files/folders of some directory (Btw u can set the context for only files or folders if u want)
[CHANGELOG 3.7]
Some fixes
General improvements
Improved general Mounting
Added /system_ext mounting with auto_mount_partitions
Improved is_greater/is_less
Added support to Android 12 (This includes /apex mounting, so you can run dexed JAR files like Apktool from Recovery if you enable setdefault apex_mount)
[CHANGELOG 4.0]
Some improvements
Improved general setup
Added more verifiers to ensure installation
Improved string function
Improved try_mount function
New function apex_mount to mount any .apex file or folder in /apex space
New function decode_xml to decode AndroidManifest.xml (Experimental)
New function encode_xml to encode AndroidManifest.xml and extra predecoded APK xml (Experimental)
New xml_kit function to manipulate XML code quickly and easily, I designed the tool based on XML logic (breaking the XML structure is very unlikely), xml_kit allows u to moving through the XML structure by sections (Very specific pieces can be edited)
Now string supports -get-before and -get-after to extract all text after/before some pattern
[CHANGELOG 4.1]
Some fixes
Some setup improvements
Fixed can_run (Broken with some commands)
Ensured plugins extraction
Some restructuring and better organization for general installation
Improved Test Mode setup
Some plugins were separated in META-INF/addons/extra.zip that are not always needed (Now you can remove them)
[CHANGELOG 4.2]
Some fixes
A problem was fixed in the extraction of some actions
Fixed extraction problems in some ROMs
Improved mounting detection for no block sections like /system_ext
An error with the text processing base of the Dynamic Installer (string function) was fixed that caused an incorrect interpretation in the verification with -after-line -before-line and extract flags with rare strings
[CHANGELOG 4.3]
Some important fixes
To unify syntax with the common edify actions:
Now u can also use get_file_prop as file_getprop
Added ifelse action (ifelse "action" "else action")
Added read_file (read_file "file" "file" "..")
Added run_program (run_program "program" arg1 arg2 ...)
Now package_extract_dir action supports the extraction of empy folders (Now also u can specify another zip to extract instead of the current installing ZIP)
Now package_extract_file action supports the extraction from another zip instead of the current installing ZIP
Now dynamic_install action supports empy folders
Now set_perm action supports multiple files in a single command line (also now supports symlinks)
Now set_perm_recursive action supports multiple directories in a single command line (also now supports symlinks and its much faster)
New fullpath action (To get the fully path of any file/folder or symlink, btw it returns the literal symlink path instead of its source)
Improved symlink action (Now interprets paths much better, also supports creating infinite symlinks in a single command line)
Improved ch_con / ch_con_recursive (General operation)
Fixed flags of add_lines_zip/add_lines_addon actions (Previously special flags were not supported as with add_lines)
Detection of native variables such as $is64bit, $arch, $arch32, $dynamic_partitions, ... has been improved through a temporary mount attempt to obtain values directly from the current system and vendor (Since some custom Recoverys run on 64bits when the system is 32bits and cause incorrect real time information)
[CHANGELOG 4.3-b]
Improved is_tar action (Tar checking is much faster even on large files)
Now is_number support decimal numbers
New function is_hex to check Hexadecimal strings
New function is_abc to check alphabetic strings
New magic_file action to check file types using their Magic Hex values(You can check a file type even if it doesnt have an extension), additionally, u can include an -offset number to skip bytes and also the -bytes per line to get, and with this also the number of hex -line to use (to find the Magic value in a specific range number of hex lines from 1), btw, it includes several types of files already preloaded, using the -type indicator, these dont require additional configuration
[CHANGELOG 4.4]
Improved and fixed general mounting
Now you can use "mount_all" as "auto_mount_partitions" function
Added /odm mounting in mount_all / auto_mount_partitions function
Added extra reports of general mounts
super_rw function was discontinued (not effective)
Fixed a relevant bug in many functions that support multiple options (if a special flag was used without all the required arguments it would enter an infinite loop)
Fixed a relevant bug in the string function that did not allow adding 2 lines with -after-line -before-line (Only 1 lines or 3 lines+ huh)
Fixed fruitloop on some devices when using functions that work with superrepack from extra.zip (It was encapsulated for safe use)
Improved and fixed xml_kit / replace / ch_con / ch_con_recursive and other functions
A minimum free space check is now performed for root "/" only with mount_all / auto_mount_partitions (Some stock firmwares does not even have 1 Byte free and some actions / editions cannot be performed)
Now the string function supports replacing with multiple lines all the lines that contain a pattern (replace_line flag)
Now the get_file_prop / file_getprop functions supports multiple files to find a specific prop
Now the replace function supports replacing with multiple lines all the lines that contain a pattern (-all-line flag)
Now is_abc function accepts spaces and new lines (But it will only be True if all visible characters are only alphabetic)
Now string function can be forced to always return a result with the "force" flag (previously nothing was returned if the original text was equal to the result)
New functions saveperm / restoreperm to save and restore permissions (UID/GID/MODE) of all files/folders in a path (Recursively) or on single files
New functions savecontext / restorecontext to save and restore contexts of all files/folders in a path (Recursively) or on single files
New function eval_perm to get the most used Permission/Mode of a path or a single file
New function eval_user to get the most used User ID of a path or a single file
New function eval_group to get the most used Group ID of a path or a single file
New function eval_all_perm to get the most used User ID/Group ID/Mode of a path or a single file
New function get_all_perm to get the User ID/Group ID/Mode of a folder or a single file
New function get_context to get the context of a single folders/files
New function is_text to check ANY visible character, if there are only empty spaces or new lines it will return False.
Added cpio / ramdisk format in magic_file function ( with -type flag)
New setdefault permissions to change the default permissions for folders/files used by ALL Dynamic Installer functions
New function is_same_mount to check if two folders are linked to the same partition (For example /system and /system_ext use the same partition in most devices)
New Edify simulated functions greater_than_int/less_than_int/concat/stdout
New number comparison functions is_greater_equal / is_less_equal
New function convert to convert any type of units, mainly for storage units such as b, B, KB, MB, GB, TB, there is no combination limits (It returns completely decimal or integer numbers)
[CHANGELOG 4.4-b]
Fixed some warnings
Added Unisoc chipset detection for the native variable $chipname
smali_kit improved, fixed and slightly restructured
smali_kit now supports string function fixes / improvements with -after-line -before-line flags
Nothing more
[CHANGELOG 4.4-b3]
General improvements
Some mount / unmount improvements
Improved /apex configs for Android 12
Fixed make_overlay (Due to changes with the dynamic_apktool it did not work correctly)
Now the setdefault permissions supports User ID and Group ID (UID/GID)
Optimized device verification with setdefault devices
Replaced native busybox reboot action with /system/bin/reboot (best)
Find within folders symlinks is now supported by default in set_context / dynamic_install / dynamic_install_apk / find_apk / saveperm / savecontext / restoreperm / restorecontext functions (This allows deeper finds)
Now ui_print will better evaluate prints for unconventional installations (adb)
New variables $di_version and $main_version (Information of the current version of the Dynamic Installer)
New function convert_edify to try to convert Edify scripts to Dynamic Installer scripts (Experimental)
[CHANGELOG 4.5]
General improvements / maintenance
Added Installer Configs in the log
Thanks to a new dynamic temporary space ($TMP), additional ZIPs can now be flashed without risk of affecting the current installation
flash/flash_addon/flash_zip functions has been improved to take advantage of the new $TMP, also now supports a third optional argument "print" to allow the new ZIPs to print text on Recovery
add_lines / add_lines_string /add_lines_addon / add_lines_zip functions now supports creating new files (previously they only supported editing existing files)
magic_file now supports "sparse" type to detect Android Sparse IMGs
[CHANGELOG 4.5-b]
Device verification has been optimized (setdefault devices - Avoided repeating the verification for device information already checked)
package_extract_dir fixed, due to a logical error when there were two or more folders in the same ZIP path that started with a common pattern (system system1 system2), when extracting the base pattern (In this example "system"), all these folders were extracted instead of just one
[CHANGELOG 4.5-b2]
General maintenance
Fixed a serious issue that would freeze/reboot some devices when the DI was installed by Magisk (Thx to @quadraticfunction for the tests)
Fixed checksuper function (Due to a logic error, the device could be bricked after use)
Added more checks (Like Read/Write permissions) in most functions for more understandable logs
Replaced "setdefault run_addons" with "setdefault import_addons" (Now allows importing all $addons plugins with .sh extension before main script execution)
New functions create_dir / create_file (Ensure new files or folders easily)
New function testrw (To test if one or more folders has write permissions)
New function testvarname (Allows to verify if the text is valid to be used as a variable name)
[CHANGELOG 4.5-b3]
Fixed find_apk function (Skipping overlays and splits did not work when using -recursive find)
Fixed replace function (After text replacement, if the result had not even 1 visible character, the whole operation failed)
New remove function to remove text in a file or -recursive in a directory
New multi_option function to get a user selection from a list of many options
New apk_main function to get the activity that can be launched in an APK (if it exists)
New apk_icon function to get the internal path of the icon of an APK
New apk_launch function to launch the main launchable activity (or a specific activity) of some pre-installed APP on the device (when its booted)
[CHANGELOG 4.6]
General improvements and maintenance
New obfuscate function that allows you to encode the shell script code (or Dynamic Installer scripts), keeping it working but making it difficult for common users to read (you can mix obfuscated code with readable code)
New apk_install function to install .apk or .apkm files (ApkMirror), the inclusion of splits together with main .apk/.apkm is supported (It is necessary that the device is already booted)
New apk_install_recursive function, installs all .apk/.apkm that are inside a folder, also supports creating subfolders to group .apk/.apkm with additional splits
New function stderr (Run and print any action as error)
New function stdprint (Run and print any action on the screen - ui_print)
New set_metadata_recursive function (Simulated Edify function)
[CHANGELOG 4.6-b]
General improvements and fixes
Many functions were optimized at the code level
It is now possible to use "not" to negate an expression (Equivalent to using "!"), for example:
Bash:
if not exist "/system/ole"; then
ui_print "ERROR"
fi
Improved reports (logs) of package_extract_file / package_extract_dir, now you can easily identify extraction problems
Importing addons with "setdefault import_addons" will now be alphabetical (to control load order)
Added simg2img to extra.zip for 64bit devices only
New functions int, float, round to obtain integer, decimal or rounded numbers (Math operations are supported directly)
New function get_all_subparts to get the name of all subpartitions of an img/partition (SUPER)
New end function to stop the script (similar to abort), but without ending the installation on error
The repeat function now supports paragraphs (Multi line)
The contains function now supports finding paragraphs (multi line)
The multi_option function now supports an optional third argument "loop" to keep an infinite loop of options on a constant restart (Until a valid option is selected)
The exist function now supports specific recognition for blocks and symlinks (exist symlink "TEST", exist block "/dev/block/dm-0")
The unlock_all/unlock functions now support specifying an IMG/Partition
You can now also use the -file option on try_mount to specify a block to mount (Previously focused only on specifying files)
update/update_zip/update_addon functions now support Sparse IMGs experimentally (need to import simg2img)
[CHANGELOG 4.6-b2]
Fixed a serious problem with the new "not" logical function (it didn't work at all due to an implementation problem)
The "installzip" native variable was unlocked (Previously in Read-Only by default), because it conflicted with the functionality of using external ZIPs with package_extract_file / package_extract_dir
New function find_content to get the paths of all the contents of the ZIP that match the established patterns
[CHANGELOG 4.7]
Updated apktool to v2.7.0 (with baksmali/smali 2.5.2)
Fixed de/compilation problems of the framework.jar (a12+)
Automatic import of all APEX binaries (This ensures access to actions completely isolated from /system)
Importing APEX binaries fixes dalvikvm issues on some devices (Required for running JARs)
patch_fstab fixed (Now only active lines will be patched)
dynamic_apktool function can now check and add missing original resources in the final APK/JAR
dynamic_apktool function now includes a specification of the device API (This prevents bugs in newer apktool versions)
New replace_name function to flexibly rename multiple files/folders (or just one)
[CHANGELOG 4.7-b]
Fixed a bug in the dynamic_apktool function (Checking/adding original resources even extended to "res", causing slower decompile and recompile errors)
dynamic_apktool now has the -no-extras option to disable original resource checking/adding (Although it is recommended to keep it)
dynamic_apktool now has the -no-api option to disable automatic specification of the device API (Although it is recommended to keep it)
dynamic_apktool now has the -use-baksmali option to set an external baksmali.jar (DEXED) instead of the native apktool one
[CHANGELOG 4.7-b2]
The structure and operation of the update-binary have been improved (This script is the initial launcher of the ZIP, its improvement ensures the execution of the ZIP in more hostile environments or with compatibility problems and a more accurate logging in case of critical problems)
Fixed a small warning in the make_zip function
Fixed long timeouts when unmounting partitions mounted on non-common paths
Mount functions in general now have better logging warnings
By default the "unzip" binary will try to change to some external version, this to try to avoid extraction problems when the size of the ZIP exceeds Busybox's "unzip" support (However, not all versions of unzip support extracting files larger than 4GB)
testrw function can now identify a Read/Only mounted folder (Without the need to create a file, empty file creation for write verification will now only be used for folders not previously mounted)
try_mount function now ensures mounts specified as Read/Write only, i.e. even if the mount is "successful", if it really is not writeable to it, it will be treated as failed
dynamic_apktool now supports -use-smali to specify an external smali.jar(DEXED) instead of the one already included in apktool
savelog, echolog and printlog functions now support multiple lines (each argument is one line to print/write)
New change_bin function to try to use another available binary, remembering that Busybox binaries are used by default, with this it is possible to try to change them for available external versions
New "setdefault ensure_root", if set to "off", mount_all will allow Read-Only systems (Even if you can't make edits internally, you can still mount read-only, previously if the device had any restrictions like EROFS, the complete installation was aborted warning of a read-only system)
"setdefault magisk_support" now supports the "force" option, to always use Magisk space (customize.sh), even from a Recovery install
[CHANGELOG 4.7-b3]
Fixed a fatal bug that kept all functions using superrepack in an infinite loop. Oops!
No more
DOWNLOADS:​
STABLE V4.7-b3:
MEDIAFIRE
can this method be used to patch systemui.apk to possibly replace resources.arsc or change specific colors under values\res\colors.xml
josephpatrick said:
can this method be used to patch systemui.apk to possibly replace resources.arsc or change specific colors under values\res\colors.xml
Click to expand...
Click to collapse
For compatibility reasons you can only directly make smali edits (classes.dex), check the BUGs section with the apktool, although you could do is an overlays (As its a simple apk it can be decompiled and compiled)
But if you just want to replace the resources.arsc without previously decompiling it you can use the patch_apk function
BlassGO said:
For compatibility reasons you can only directly make smali edits (classes.dex), check the BUGs section with the apktool, although you could do is an overlays (As its a simple apk it can be decompiled and compiled)
But if you just want to replace the resources.arsc without previously decompiling it you can use the patch_apk function
Click to expand...
Click to collapse
this looks so confusing, but can this be used to make a recovery partition to install twrp to a A/B dynamic partition device that only has boot partition?
blaze2051 said:
this looks so confusing, but can this be used to make a recovery partition to install twrp to a A/B dynamic partition device that only has boot partition?
Click to expand...
Click to collapse
The Dynamic Installer focuses on general installations for mods, roms or patchs, but it has an open space for plugins, you can contact me from the support group that is at the beginning of the thread to develop/test a plugin that allows that installation
Btw the previous message was probably confusing cuz it also supports code patching in APKs, its a very multi-use installer.
Beautifully done. This is so useful for many things. Good work on this.
Thank you for this amazing installer
There are tons of things on xda now that I have absolutely no clue as to what the use would be. This is one of them if you can install a recovery than you install the recovery with adb or Odin or whatever. If you need to install magisk module you install it in manager. Apk install normally. I don't understand what this gave us that wasn't able to do before?
Same with sim number setter xposed module it doesn't do anything. It changes some arbitrary number that has no bearing on anything It's completely pointless.
Techguy777 said:
There are tons of things on xda now that I have absolutely no clue as to what the use would be. This is one of them if you can install a recovery than you install the recovery with adb or Odin or whatever. If you need to install magisk module you install it in manager. Apk install normally. I don't understand what this gave us that wasn't able to do before?
Same with sim number setter xposed module it doesn't do anything. It changes some arbitrary number that has no bearing on anything It's completely pointless.
Click to expand...
Click to collapse
That is a superficial view, the installation of ROMs / MODs and others only put it on a par with traditional installers (Edify Scripts), the objective of Dynamic Installer is to shorten / facilitate actions for complex projects and in fact, there are projects to patch the Secure Folder / Samsung Theme Store, create bootanimations using any video, all directly from Magisk using this installer, and more, in short, it is a very well equipped, free and easy to write work environment, which even expands to the Magisk Modules space ( Also I think there is a confusion, it is not intended to replace the Magisk Manager, it is a ZIP, it works like any magisk module for the user)
BlassGO said:
That is a superficial view, the installation of ROMs / MODs and others only put it on a par with traditional installers (Edify Scripts), the objective of Dynamic Installer is to shorten / facilitate actions for complex projects and in fact, there are projects to patch the Secure Folder / Samsung Theme Store, create bootanimations using any video, all directly from Magisk using this installer, and more, in short, it is a very well equipped, free and easy to write work environment, which even expands to the Magisk Modules space ( Also I think there is a confusion, it is not intended to replace the Magisk Manager, it is a ZIP, it works like any magisk module for the user)
Click to expand...
Click to collapse
Now when you there are projects to patch secure folder are any of the projects successful and is it for Android 12 aka one ui 4.1? That would be a good use. The boot animation with any video would be cool to but the secure folder is more practical or useful. Where can I find this project at?
BlassGO said:
That is a superficial view, the installation of ROMs / MODs and others only put it on a par with traditional installers (Edify Scripts), the objective of Dynamic Installer is to shorten / facilitate actions for complex projects and in fact, there are projects to patch the Secure Folder / Samsung Theme Store, create bootanimations using any video, all directly from Magisk using this installer, and more, in short, it is a very well equipped, free and easy to write work environment, which even expands to the Magisk Modules space ( Also I think there is a confusion, it is not intended to replace the Magisk Manager, it is a ZIP, it works like any magisk module for the user)
Click to expand...
Click to collapse
So there's really no secure folder patch available it's just talked about or working on it? That's what I mean if there is something of use that only this can do it makes it great but if there's nothing I fail to see the point.
Techguy777 said:
Now when you there are projects to patch secure folder are any of the projects successful and is it for Android 12 aka one ui 4.1? That would be a good use. The boot animation with any video would be cool to but the secure folder is more practical or useful. Where can I find this project at?
Click to expand...
Click to collapse
@skyflyteam
In the support tg channel you will find some projects, one of them for the SecureFolder OneUI 4.1
It didn't work over the magisk install command...
Der_Googler said:
It didn't work over the magisk install command...
Click to expand...
Click to collapse
Could u give more info about the problem?
BlassGO said:
Could u give more info about the problem?
Click to expand...
Click to collapse
it says failed to unpack zip
Der_Googler said:
it says failed to unpack zip
Click to expand...
Click to collapse
In that case it isnt a problem of the installer, check the compression, the most common error is to compress the unziped folder that contains everything, instead of each specific element like META-INF, META-INF must always be in the root of the ZIP, to check it you can open your current ZIP and verify that the first thing you see is the META-INF

Categories

Resources