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_BASH
      is defined as
      1
      , the scripts must use the
      /system/bin/sh
      shebang instead of
      /sbin/sh
  • On
    fox_9.0
    and other older deprecated manifests
    • The scripts in question must be placed in
      /sbin
      instead of
      /system/bin

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_MODULES
      is defined with a list of modules to load
  • runatboot.sh
    [pre-gui]
    [fox_9.0+]
    • Path:
      /system/bin/runatboot.sh
    • When: Early in both
      fastbootd
      and
      recovery
      mode initialization
  • postfastboot.sh
    [pre-gui]
    [fox_12.1+]
    • Path:
      /system/bin/postfastboot.sh
    • When: Late in
      fastbootd
      mode initialization, after all system setup
  • postrecoveryboot.sh
    [pre-gui]
    [fox_9.0+]
    • Path:
      /system/bin/postrecoveryboot.sh
    • When: Late in
      recovery
      mode initialization, after all system setup

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
  • post_rom_flash.sh
    [blocking]
    [fox_9.0+]
    • Path:
      /system/bin/post_rom_flash.sh
    • When: After ROM zip installation, before cleanup
  • 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
  • formatdata.sh
    [blocking]
    [fox_12.1+]
    • Path:
      /system/bin/formatdata.sh
    • When: Before
      /data
      partition format initiated by the "Format Data" operation begins
  • 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

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
  • rebootsystem.sh
    [blocking]
    [fox_9.0+]
    • Path:
      /system/bin/rebootsystem.sh
    • When: User selects "Reboot System"
  • rebootrecovery.sh
    [blocking]
    [fox_9.0+]
    • Path:
      /system/bin/rebootrecovery.sh
    • When: User selects "Reboot Recovery" (if available)
    • Run requirement:
      TW_NO_REBOOT_RECOVERY
      is not defined, or
      false
  • rebootbootloader.sh
    [blocking]
    [fox_9.0+]
    • Path:
      /system/bin/rebootbootloader.sh
    • When: User selects "Reboot Bootloader" (if available)
    • Run requirement:
      TW_NO_REBOOT_BOOTLOADER
      is not defined, or
      false
  • rebootdownload.sh
    [blocking]
    [fox_9.0+]
    • Path:
      /system/bin/rebootdownload.sh
    • When: User selects "Reboot Download" (if available).
    • Run requirement:
      TW_HAS_DOWNLOAD_MODE
      is defined as
      true
  • rebootedl.sh
    [blocking]
    [fox_9.0+]
    • Path:
      /system/bin/rebootedl.sh
    • When: User selects "Reboot EDL" (if available).
    • Run requirement:
      TW_HAS_EDL_MODE
      is defined as
      true
  • poweroff.sh
    [blocking]
    [fox_9.0+]
    • Path:
      /system/bin/poweroff.sh
    • When: User selects "Power Off"