• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

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

Search This thread

BlassGO

Senior Member
Jan 19, 2021
117
204
20210222_103348.jpg

SUPPORT: TELEGRAM CHANNEL - TELEGRAM GROUP

ABOUT THIS:

Advanced installer with many additional utilities for Recovery or Magisk


GENERAL FEATURES:

~ Fully shell script based (Open source)
~ Support for a Dual installation (Recovery or Magisk)
~ Many utilities to facilitate the creation of complex installers
~ Optimized auto-mount main partitions (system, vendor, product, APEX) for most Android devices
~ Supports all existing actions of common installers (package_extract_dir, set_metadata, is_substring, assert, ....)
~ It runs by default in BASH + Busybox (NOT DASH), it has no limitations to work with shell code
~ Support for addons and more



DEFAULT VARIABLES
$TMP: The value of this variable contains the temp directory (A directory that only exists during execution)

$installzip: The value of this variable contains the path of the ZIP that the user is installing


$bins: That contains all supported commands (It can be refreshed with "getbins") - Not available if setdefault fast_mode enabled

$is64bit: The value of this variable will be "true" only if the device is 64-bit (It can be refreshed with "getarch" )

$API: The value of this variable contains the android version of the device (It can be refreshed with "getarch" )

$all_partitions: The value of this variable contains the name of all partitions on the device - Not available if setdefault fast_mode enabled

$dynamic_partitions: The value of this variable will be "true" if the device has a SUPER partition (Dynamic Partitions)

${n}: Allows creating new lines within a string ( Example: paragraph=" First line ${n} Second line ${n} Third line " )



PRE-INTRODUCTION TO ACTIONS

Some of these actions support specific extensions as follows:
  • _addon >> Specify that it should work from META-INF/addon folder
  • _zip >> This specifies that it should work from the zip in general
  • If this extension isnt included in the action, it will work as an external command to the zip

Examples:
update_file_addon new.prop /system/build.prop
( new.prop will be taken from META-INF/addons)

fprint_zip "main/huh.txt"
( It will try to take huh.txt from an existing folder inside the zip called "main"

flash "/sdcard/test.zip"
(It will try to install an external file to the current zip inside /sdcard)



HOW DOES IT WORK?
  • update-binary is the one that executes the entire zip and creates the necessary symlinks for operation
  • zbin contains all the necessary plugins and extra functionalities
  • updater-script is the workspace where each dev can configure the installer actions for Recovery
  • customize.sh is the workspace where each dev can configure the installer actions for Magisk

MAGISK SPACE

NOTE: You can use all the additional functions of the Dynamic Installer during the installation by Magisk

The space dedicated exclusively to working with Magisk is within META-INF/com/google/android/magisk

Use this space as if it were a common MAGISK module, you can add new folders that will be added to the module



TMP2

This variable ($TMP2) is generated by using start_tmp function and ends with end_tmp, the value contains a dynamic temporary space that prevents similar functions from interacting in the same space

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:

  • @osm0sis ( For his great work with dynamic partitions and recreation of traditional installer functionalities in shell code)
  • Me @BlassGO ( Creator of Dynamic Installer)



MORE EXPLANATIONS AND DOWNLOADS IN THE NEXT POSTS
 
Last edited:

BlassGO

Senior Member
Jan 19, 2021
117
204

ALL ACTIONS
MOUNT:
  • auto_mount_partitions
It will mount the main partitions automatically ( /system, /vendor, /product and APEX only if setdefault apex_mount enabled)

  • try_mount "part" "part" "part" "..."
Mount specific partitions
Bash:
try_mount /cache /optics /prism /odm /vendor
NOTE: For system, vendor, product, APEX use auto_mount_partitions


  • umount_all
Unmount all main partitions and all the ones you have mounted with try_mount


USER SELECTION:

Bash:
if $yes; then
   ui_print " You selected option 1"

else
   ui_print " You selected option 2 "

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




EDITING FILES:
  • 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

  • hex_patch "Hex code to find" "New Hex code" "file"
Allows to substitute Hex fragments within files (perfect for patching)

  • 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" "504b0304" "file.bin"
##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

  • update_file <delim> "file to update .XML or .prop" "file"
Supports: _addon and _zip extension

Updates lines of .prop or .xml files without changing the original structure (Only readable files)

It will try to get a pattern in all cases and use it to replace all pattern lines in the destination file (The format of the lines is autodetected)

-delim (-d) = To avoid substitution when there are many equal lines (.XML) you can set a range between two line patterns

Bash:
#Without DELIM
update_file "NewXmlLines.txt" "/system/etc/example.xml"

update_file "NewPropLines.txt" "/system/build.prop"

#With DELIM
update_file -delim 'ro.product.system.model' 'ro.build.id' "NewPropLines.txt" "/system/build.prop"

update_file -delim 'name="OMX.Exynos.mpeg4.dec" ' '</MediaCodec>' "NewXmlLines.txt" "/system/etc/example.xml"

  • force_update_file "file with new parameters" "file"
Supports: _addon and _zip extension

#Support -delim flag like update_file
Similar to update_file but forces the existence of the new lines, if they exist it replaces them and if they dont exist, it adds them (Compatible with .xml (decoded) and .prop)


  • update_file_string "line" "line" "..." "file"
#Support -delim flag like update_file
Same as update_file but doesnt require extra files, you can include the new lines to update directly as strings

Bash:
#Normal Xml Example
update_file_string '<ctl name="ABOX OEM AP Call type" value="NEW VALUE HUH" />' /system/etc/example.xml

#Normal .prop Example
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"
#Support -delim flag like update_file
Same as force_update_file but doesnt require extra files, you can include the new lines to update directly as strings


  • add_lines "file" "file" "file" "FILE to add lines"
Supports: _addon and _zip extension

Add new lines from multiple files to an existing file

Supports -after-line and -before-line like add_lines_string

Bash:
#Add all contents of this files to the Destination file
add_lines "File.txt" "File2.txt" "File3.txt" "DESTINATION.prop"

#Add contents BUT after some line
add_lines -after-line "Some line" "File.txt" "DESTINATION.prop"

#Add contents BUT before some line
add_lines -before-line "Some line" "File.txt" "DESTINATION.prop"

#Multiple actions
#Everything outside the after-line and before-line pattern will be added to the destination file.

add_lines -after-line "Some line" "File.txt" -after-line "Some line 2" "File2.txt" -before-line "Some Line 3" "File3.txt" "Extra.txt" "Extra2.txt" "DESTINATION.prop"

  • add_lines_string "line" "line" "..." "FILE to add lines"
Same as add_lines but doesnt require extra files, you can include the new lines to add directly as strings (Support empy lines)

Anything outside the -after-line and -before-line pattern will be added to the file

-after-line(-al) = Add content after a specific line (Unlimited)

Bash:
add_lines_string " first line" " " -after-line "something" "add this line after" -after-line "yeah" "add this line after" " " " final line" "FILE to edit"

-before-line(-bl) = Add content before a specific line (Unlimited)
Bash:
add_lines_string " first line" " " -before-line "something" "add this line before" -before-line "yeah" "add this line before" " " " final line" "FILE to edit"

  • replace "Old Text" "New Text" "File or Directory"
Allows you to replace only specific text or all lines (-all-line) with a similar pattern 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 (Doesnt work with paragraphs)



EXECUTION:
  • 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


  • 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

  • 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)


  • 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




MANIPULATION OF STRINGS:
  • split_string "pattern separator" "line"
Separate text based on a delimiter
  • 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
  • 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

  • repeat "number" "String"
Repeat text by a specific number

  • string <replace/replace_line/remove/inside/extract/complete_extract/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

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

escape = Fix characters that cause conflicts with Linux utilities like sed


upper = Convert all text to Uppercase

lower = Convert all text to Lowercase

count = It only returns the number of letters in the string

Examples:
Bash:
string replace "A" "B" "Hi, A will be replaced with B"

string 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:
string remove "A" remove "B" remove "C" "AAAAAABBBBBDDDDDCCCC"

string replace "A" "C" replace "B" "D" replace "C" "Hi" "C, AACCBBDDCC"

Extra Examples:
Bash:
example="
Hi,
Hello world
A
B
C
Okay, sayonara
"

string extract "world" "sayonara" "$example"

#Multi actions
string remove "A" "B" replace "C" "Ole" "$string"

#Or count results
string count remove "A" "B" replace "C" "Ole" "$string"


CHECKING:
  • exist <file/folder/any> "file" "file" "file" "..."
It can check if one or more files/folders/or any type exist

Example:

Bash:
#By default if u dont include any flag it will check any type of folders/files/symlinks/..

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

#Multi-check
if exist "Myfile.bin" "OTHER.bin" "OTHER.zip" "FOLDER"; then
   ui_print " Okey passed"
else
   ui_print " FATAL ERROR"
fi
  • is_valid "file" "file" "file" "..."
It can check if one or more files exist and are not empty
  • 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

  • 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



APK/JAR TOOLS:
  • 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

  • find_apk "APK package" "PATH to find"
Allows to find APK using its package in a specific path (it will return the exact path of that apk)
Bash:
find_apk "com.android.systemui" /system

#Or recursive find (It will result in all apks with a similar pattern in the package):

find_apk -r "com.google" /system

  • 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 run_jar 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+, additionally you CANNOT include images due to the limitations with the experimental apktool for Android (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:
  • 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

Bash:
dynamic_apktool -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)
-dir = PATH to find .smali methods

-file = File to find .smali methods

-method = Pattern .method name to find

-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

-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:
  • adb arguments
Its the standard version of the ADB so that you can configure special options


LOGGING:
  • startlog "PATH/file"
Create a file that will be used to save the contents with "savelog"

  • savelog "strings or $(commands)"
You can use strings directly together with commands, everything is interpreted and the result is sent to the LOG defined with startlog



VARIABLES:
  • checkvar "variable" "variable" "..."
Check infinite variables and return the value of those that are defined

  • filtervar "variable" "variable" "..." "pattern"
Check infinite variables and look for a matching pattern, the value of those variables is returned
  • if defined "variable"
Check that a variable is defined

  • if undefined "variable"
Check that a variable isnt defined



GET/ADD VALUES:
  • import_config "file with props"
Supports: _addon and _zip extension

Convert prop lines (a = b) to variables ($a)


  • setdefault "variable" "string or $(command)"
Its equivalent to defining a normal variable (a = b) but doesnt omit anything, useful to save the result of complex actions

  • get_file_prop "file" "prop to extract"
Extract props (a = b) from external files

  • getdefault "file" "default to extract"
Extract values with setdefault from external files



INSTALL FILES:
  • update "file .img / .bin /..." "partition"
Supports: _addon and _zip extension

Try different installation types for img or bin files (boot.img optics.img prism.img param.bin ...)


  • flash "zip file"
Supports: _addon and _zip extension

Try to install a new zip file within the current installation, if there is any error the whole installation ends ( If they are insignificant errors its recommended to use force_flash)


  • force_flash "variable" "zip file"
Supports: _addon and _zip extension

Similar to flash but ignore any errors, installation continues even if there were problems, the result is saved in the variable


  • dynamic_install "path" "path"
Similar to package_extract_dir but only works with existing paths outside the zip and performs an installation using the native linux "install"
  • dynamic_install_apk "path outside zip" "path outside zip"
Similar to dynamic_install but only uses .APKs, based on the APK package it does a search and if the apk doesnt exist in the destination directory add the folder and if they exist it replaces them keeping the original path and name

You can also redirect the destination path (Compare 2 directories with .APKs, perfect for Magisk modules)

-no-replace(-nr) = Avoid replacing existing APKs
-no-add(-na) = Avoid adding new APKs

Bash:
dynamic_install_apk "FOLDER" "/system" -output "/sdcard/results"

OTHER STUFF:
  • fprint "file"
Supports: _addon and _zip extension

Print the contents of a file in the recovery or magisk


  • import_bin "Binary file"
Supports: _addon and _zip extension

It allows adding new executables as default commands


  • getsize "file"
Return the size of any file

  • copy "original" "dest"
Force copy any file or folders

  • move "original" "dest"
Force move any file or folder

  • echo2 "Text"
Print text as error (For example, the text doesnt appear on the Magisk screen but yeah in the LOG)
 
Last edited:

BlassGO

Senior Member
Jan 19, 2021
117
204
Dynamic Installer Configs

The installer supports some additional settings
If this is included in the updater-script:

  • setdefault results ( on or off)
If it is activated, the results of some actions in the recovery will be shown, if it is deactivated, nothing preconfigured will be displayed

  • setdefault run_addons (on or off)
If it is activated, the addons with ending .sh will be auto-executed after the main script (updater-script)

  • setdefault devices (code name of supported devices or off)
If you want to do an installation only for some devices, you can include the code name of those devices here, otherwise simply leave it off
  • setdefault fast_mode (on or off)
Avoiding the loading of some heavy variables, greater speed is obtained during the installation, its recommended to always use it in "on" unless you require these variables ($system, $vendor, $optics, $boot/....all partitions in device and $all_partitions / $bins variables)

You can also get these variables manually with the getblocks and getbins functions


  • setdefault apex_mount ( on or off)
It allows to mount the .APEXs of /system/apex in /apex partition but produces a slow mount with auto_mount_partitions, its recommended to use it in "off" unless you need it



How can I refer to an addon?

The contents inside META-INF/addons are extracted automatically in the installation, to refer to the path use $addons variable

META-INF/addons/myfile.txt

to use that file, it would be "$addons/myfile.txt"



How do dynamic variables work?
Just works if setdefault fast_mode disabled

In the case of partitions, they are defined according to the name of the partition, for example:

If ur boot partition is: /dev/block/platform/13520000.ufs/by-name/BOOT

It will be assigned as $BOOT variable


But if its: /dev/block/platform/13520000.ufs/by-name/boot

It will be assigned as $boot variable

This allows even new partitions to be assigned in a variable, the checkvar and filtervar utilities are focused on facilitating the use of these dynamic variables
 
Last edited:

BlassGO

Senior Member
Jan 19, 2021
117
204
CHANGELOG:
[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
 
Last edited:

BlassGO

Senior Member
Jan 19, 2021
117
204
can this method be used to patch systemui.apk to possibly replace resources.arsc or change specific colors under values\res\colors.xml
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
 
  • Like
Reactions: josephpatrick

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    20210222_103348.jpg

    SUPPORT: TELEGRAM CHANNEL - TELEGRAM GROUP

    ABOUT THIS:

    Advanced installer with many additional utilities for Recovery or Magisk


    GENERAL FEATURES:

    ~ Fully shell script based (Open source)
    ~ Support for a Dual installation (Recovery or Magisk)
    ~ Many utilities to facilitate the creation of complex installers
    ~ Optimized auto-mount main partitions (system, vendor, product, APEX) for most Android devices
    ~ Supports all existing actions of common installers (package_extract_dir, set_metadata, is_substring, assert, ....)
    ~ It runs by default in BASH + Busybox (NOT DASH), it has no limitations to work with shell code
    ~ Support for addons and more



    DEFAULT VARIABLES
    $TMP: The value of this variable contains the temp directory (A directory that only exists during execution)

    $installzip: The value of this variable contains the path of the ZIP that the user is installing


    $bins: That contains all supported commands (It can be refreshed with "getbins") - Not available if setdefault fast_mode enabled

    $is64bit: The value of this variable will be "true" only if the device is 64-bit (It can be refreshed with "getarch" )

    $API: The value of this variable contains the android version of the device (It can be refreshed with "getarch" )

    $all_partitions: The value of this variable contains the name of all partitions on the device - Not available if setdefault fast_mode enabled

    $dynamic_partitions: The value of this variable will be "true" if the device has a SUPER partition (Dynamic Partitions)

    ${n}: Allows creating new lines within a string ( Example: paragraph=" First line ${n} Second line ${n} Third line " )



    PRE-INTRODUCTION TO ACTIONS

    Some of these actions support specific extensions as follows:
    • _addon >> Specify that it should work from META-INF/addon folder
    • _zip >> This specifies that it should work from the zip in general
    • If this extension isnt included in the action, it will work as an external command to the zip

    Examples:
    update_file_addon new.prop /system/build.prop
    ( new.prop will be taken from META-INF/addons)

    fprint_zip "main/huh.txt"
    ( It will try to take huh.txt from an existing folder inside the zip called "main"

    flash "/sdcard/test.zip"
    (It will try to install an external file to the current zip inside /sdcard)



    HOW DOES IT WORK?
    • update-binary is the one that executes the entire zip and creates the necessary symlinks for operation
    • zbin contains all the necessary plugins and extra functionalities
    • updater-script is the workspace where each dev can configure the installer actions for Recovery
    • customize.sh is the workspace where each dev can configure the installer actions for Magisk

    MAGISK SPACE

    NOTE: You can use all the additional functions of the Dynamic Installer during the installation by Magisk

    The space dedicated exclusively to working with Magisk is within META-INF/com/google/android/magisk

    Use this space as if it were a common MAGISK module, you can add new folders that will be added to the module



    TMP2

    This variable ($TMP2) is generated by using start_tmp function and ends with end_tmp, the value contains a dynamic temporary space that prevents similar functions from interacting in the same space

    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:

    • @osm0sis ( For his great work with dynamic partitions and recreation of traditional installer functionalities in shell code)
    • Me @BlassGO ( Creator of Dynamic Installer)



    MORE EXPLANATIONS AND DOWNLOADS IN THE NEXT POSTS
    1
    can this method be used to patch systemui.apk to possibly replace resources.arsc or change specific colors under values\res\colors.xml
    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