π Native Variables
DI provides these predefined variables for use in your scripts. They give you instant access to device and installer details.
Variable | DescripciΓ³n |
---|---|
$TMP | Temporary directory that exists only during execution. |
$addons | Temporary directory containing all the contents of META-INF/addons . |
$l | Temporary directory containing the main environment binaries. |
$BOOTMODE | true if the device is booted, false otherwise. |
$ARCH | Device architecture (arm64-v8a or armeabi-v7a ). |
$chipname | Chipset type (snapdragon , exynos , mediatek . kirin , unisoc ). |
$installzip | Path to the ZIP being installed. |
$is64bit | true if the device is 64-bit, false otherwise. |
$API | Android API version number (33 for Android 13). |
$slot | Active slot (_a or _b ) for A/B devices; refresh with getarch . |
$dynamic_partitions | true if the device uses dynamic partitions, false otherwise. |
$virtual_partitions | true if the device has virtual dynamic partitions, false otherwise. |
${n} | Inserts a newline in strings ("Line1${n}Line2" ). |
$encrypted | true if internal memory is encrypted, false otherwise. |
$di_version | Full version of Dynamic Installer (e.g., 4.8-bZ2 ). |
$main_version | Main version of DI (e.g., 4.8 , without variant tags). |
$CUSTOM_SETUP | 0 (normal install), 1 (Test Mode), 2 (external like KSU). |
tip
When the ZIP installation process begins, META-INF/addons
are automatically extracted. So it is possible to refer to them with the addons
variable.
fprint "$addons/myaddon.txt"
Example Usageβ
fprint "$addons/banner.txt" # From META-INF/addons/banner.txt
# Using variables about the device and environment
ui_print "-- Installing on $ARCH device with API: $API"
if $BOOTMODE; then
ui_print "-- Device is BOOTED"
else
ui_print "-- Running in Recovery or something else"
fi
if $is64bit; then
ui_print "-- 64-bit device"
else
ui_print "-- 32-bit device or something else"
fi
create_file "$TMP/file.txt" # Create a temporary file