Building OrangeFox - Hooks
Last updated: August 7, 2026
OrangeFox Recovery Hook Reference
Here is a list of hooks that the recovery may conditionally run if they exist in your recovery tree
Legend
- Hooks that have the [pre-gui]tag run before the interactive GUI is loaded to the user
- Hooks that have the [blocking]tag are synchronous, and will stall the operation until the scripts are finished executing. Make sure they don't run forever, and avoid unsafe loops.
- Hooks that have a run requirement won't be executed, unless the requirement is met (duh)
Environment
Some hooks are available only on certain manifest versions and above. For example, the
beforemodules.sh
hook does not exist on fox_11.0
and below as defined by the respective [fox_12.1+]
tag.- On fox_10.0+manifests
- If FOX_BUILD_BASHis defined as1, the scripts must use the/system/bin/shshebang instead of/sbin/sh
- If
- On fox_9.0and other older deprecated manifests
- The scripts in question must be placed in /sbininstead of/system/bin
- The scripts in question must be placed in
Recovery boot-related hooks
These hooks run during the recovery boot process
-
beforemodules.sh[pre-gui][fox_12.1+]
- Path: /system/bin/beforemodules.sh
- When: Before kernel module loading begins in KernelModuleLoader::Load_Vendor_Modules()
- Run requirement: TW_LOAD_VENDOR_MODULESis defined with a list of modules to load
- Path:
-
runatboot.sh[pre-gui][fox_9.0+]
- Path: /system/bin/runatboot.sh
- When: Early in both fastbootdandrecoverymode initialization
- Path:
-
postfastboot.sh[pre-gui][fox_12.1+]
- Path: /system/bin/postfastboot.sh
- When: Late in fastbootdmode initialization, after all system setup
- Path:
-
postrecoveryboot.sh[pre-gui][fox_9.0+]
- Path: /system/bin/postrecoveryboot.sh
- When: Late in recoverymode initialization, after all system setup
- Path:
Recovery operation initiated hooks
These hooks run when user performs an operation in recovery
-
pre_rom_flash.sh[blocking][fox_9.0+]
- Path: /system/bin/pre_rom_flash.sh
- When: Before ROM zip installation begins
- Path:
-
post_rom_flash.sh[blocking][fox_9.0+]
- Path: /system/bin/post_rom_flash.sh
- When: After ROM zip installation, before cleanup
- Path:
-
post_rom_flash_completion.sh[blocking][fox_12.1+]
- Path: /system/bin/post_rom_flash_completion.sh
- When: After ROM zip installation, and all post-install orangefox cleanup is complete
- Path:
-
formatdata.sh[blocking][fox_12.1+]
- Path: /system/bin/formatdata.sh
- When: Before /datapartition format initiated by the "Format Data" operation begins
- Path:
-
factoryreset.sh[blocking][fox_9.0+]
- Path: /system/bin/factoryreset.sh
- When: When the android userspace requests a factory reset initiated by the user, before the operation
- Path:
Recovery power-related hooks
These hooks run when the user clicks an option from the power menu
-
beforereboot.sh[blocking][fox_9.0+][universal]
- Path: /system/bin/beforereboot.sh
- When: Before every reboot operation, no matter the target
- Path:
-
rebootsystem.sh[blocking][fox_9.0+]
- Path: /system/bin/rebootsystem.sh
- When: User selects "Reboot System"
- Path:
-
rebootrecovery.sh[blocking][fox_9.0+]
- Path: /system/bin/rebootrecovery.sh
- When: User selects "Reboot Recovery" (if available)
- Run requirement: TW_NO_REBOOT_RECOVERYis not defined, orfalse
- Path:
-
rebootbootloader.sh[blocking][fox_9.0+]
- Path: /system/bin/rebootbootloader.sh
- When: User selects "Reboot Bootloader" (if available)
- Run requirement: TW_NO_REBOOT_BOOTLOADERis not defined, orfalse
- Path:
-
rebootdownload.sh[blocking][fox_9.0+]
- Path: /system/bin/rebootdownload.sh
- When: User selects "Reboot Download" (if available).
- Run requirement: TW_HAS_DOWNLOAD_MODEis defined astrue
- Path:
-
rebootedl.sh[blocking][fox_9.0+]
- Path: /system/bin/rebootedl.sh
- When: User selects "Reboot EDL" (if available).
- Run requirement: TW_HAS_EDL_MODEis defined astrue
- Path:
-
poweroff.sh[blocking][fox_9.0+]
- Path: /system/bin/poweroff.sh
- When: User selects "Power Off"
- Path: