mod-util
mod-util copied to clipboard
Usefull stuff for magisk stuff
Terminal Emulator Magisk Module Template
This template is for Making a script with visual elements which can be executed in a Terminal app in Android, as a Magisk Module.
This provides you with useful functions that might help you easily accomplish stuff for the functions that you're making in you script.
Magisk Modules that uses this template (you can refer to how things are used by these modules)
Stuff included
- Root checking (if the script is running as root)
- Debugging functions (to help you fix errors and bugs in your script)
- Determine if the device has A/B partitioning scheme
- Sets Busybox applets (Magisk, osm0sis') for you to not anymore call
busyboxto use them - Imports Magisk's
util_functions.shso that you can use the stuff in it - Gets the Device Info (Brand, Model, etc) for you to use if needed
- Provides basic ANSI color codes for you to use
- Useful functions and variables
How to include in a Magisk Module (If you're not using SKIPUNZIP)
- Place
script(rename to anything you want) in /system/bin or xbin or anywhere you want - Add
mod-util.shin root folder of the Magisk module - Set the
IDof the script to theidfrom your module.prop
Functions in mod-util.sh
| Function | How to use | Example | Output |
|---|---|---|---|
title_div |
title_div [-c] [character no] <message> |
title_div Example |
Outputs a bar with a message: Example ========== |
set_file_prop |
set_file_prop <property> <value> <file.prop> |
set_file_prop ro.example true /cache/example.prop |
none |
ProgressBar |
ProgressBar <progress> <total threshold> |
ProgressBar 4 10 |
Outputs a progress bar that's animated: Progress: [==== ] |
Spinner |
Spinner <message> |
Spinner Example |
Outputs spinner loading animation Example: [/] (this is spinning btw) |
e_spinner |
cmd & e_spinner <message> |
cmd & e_spinner Example |
Outputs spinner loading animation until the process of cmd is finished Example: [/] (this is spinning btw) |
test_connection |
test_connection |
test_connection |
Tells you if internet's ok or not |
upload_logs |
upload_logs |
upload_logs |
Generates termbin.com link of the logs uploaded |
mod_head |
mod_head |
mod_head |
Outputs heading you can use in your script based on your module's name id version versionCode author, and also the Busybox used |
prandom |
prandom [-c] [chances] [target] <message> |
prandom -c 10 7 "Hello" |
Prints message at random times (default chances=2; target=2) |
pcenter |
pcenter <message> |
pcenter "Hello" |
Prints message at center alignment in terminal (work in progress) |
Contact me in Telegram if needed