Skip to main content

🌐 Native Variables

DI provides these predefined variables for use in your scripts. They give you instant access to device and installer details.

VariableDescripciΓ³n
$TMPTemporary directory that exists only during execution.
$addonsTemporary directory containing all the contents of META-INF/addons.
$lTemporary directory containing the main environment binaries.
$BOOTMODEtrue if the device is booted, false otherwise.
$ARCHDevice architecture (arm64-v8a or armeabi-v7a).
$chipnameChipset type (snapdragon, exynos, mediatek. kirin, unisoc).
$installzipPath to the ZIP being installed.
$is64bittrue if the device is 64-bit, false otherwise.
$APIAndroid API version number (33 for Android 13).
$slotActive slot (_a or _b) for A/B devices; refresh with getarch.
$dynamic_partitionstrue if the device uses dynamic partitions, false otherwise.
$virtual_partitionstrue if the device has virtual dynamic partitions, false otherwise.
${n}Inserts a newline in strings ("Line1${n}Line2").
$encryptedtrue if internal memory is encrypted, false otherwise.
$di_versionFull version of Dynamic Installer (e.g., 4.8-bZ2).
$main_versionMain version of DI (e.g., 4.8, without variant tags).
$CUSTOM_SETUP0 (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