]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
base-files: add options to disable default button handling
authorDavid Bauer <mail@david-bauer.net>
Thu, 26 Feb 2026 19:53:16 +0000 (20:53 +0100)
committerDavid Bauer <mail@david-bauer.net>
Tue, 19 May 2026 22:02:31 +0000 (00:02 +0200)
In case OpenWrt is used to build a custom distribution, the default
button handling logic may be undesired.

Add config options to disable default standard button handling code
at build-time.

Signed-off-by: David Bauer <mail@david-bauer.net>
package/base-files/Makefile
package/base-files/image-config.in

index f0ebb52fe9cd6dca1129229bdf2098d97e8b5fb6..2f84179cb3049fb59b6f03975b7de8252cf92b9f 100644 (file)
@@ -264,6 +264,16 @@ else
        $(if $(CONFIG_IPK_FILES_CHECKSUMS),, \
                rm -f $(1)/sbin/pkg_check)
 endif
+$(if $(CONFIG_TARGET_BUTTON_CUSTOMIZATION_FAILSAFE_DISABLED), \
+       rm -f $(1)/etc/rc.button/failsafe)
+$(if $(CONFIG_TARGET_BUTTON_CUSTOMIZATION_POWER_DISABLED), \
+       rm -f $(1)/etc/rc.button/power)
+$(if $(CONFIG_TARGET_BUTTON_CUSTOMIZATION_REBOOT_DISABLED), \
+       rm -f $(1)/etc/rc.button/reboot)
+$(if $(CONFIG_TARGET_BUTTON_CUSTOMIZATION_RESET_DISABLED), \
+       rm -f $(1)/etc/rc.button/reset)
+$(if $(CONFIG_TARGET_BUTTON_CUSTOMIZATION_RF_KILL_DISABLED), \
+       rm -f $(1)/etc/rc.button/rfkill)
 endef
 
 ifneq ($(DUMP),1)
index 0f71384190334d8da81a2839186206c767420dc5..24149345b9394b28b1443c66ada8d86023c36af7 100644 (file)
@@ -287,6 +287,50 @@ if VERSIONOPT
                        file names
 endif
 
+menuconfig TARGET_BUTTON_CUSTOMIZATION
+       bool "Target button customization" if IMAGEOPT
+       default n
+       help
+               These options allow to customize the behaviour of the buttons defined in
+               the target's /etc/rc.button/* scripts.  This is useful for release builds
+               or custom OpenWrt redistributions where certain default button handling logic
+               may be undesired.
+
+       config TARGET_BUTTON_CUSTOMIZATION_FAILSAFE_DISABLED
+               bool
+               prompt "Disable failsafe button handling" if TARGET_BUTTON_CUSTOMIZATION
+               default n
+               help
+                       If set, the failsafe button handling logic in /etc/rc.button/failsafe is disabled.
+
+       config TARGET_BUTTON_CUSTOMIZATION_POWER_DISABLED
+               bool
+               prompt "Disable power button handling" if TARGET_BUTTON_CUSTOMIZATION
+               default n
+               help
+                       If set, the power button handling logic in /etc/rc.button/power is disabled.
+
+       config TARGET_BUTTON_CUSTOMIZATION_REBOOT_DISABLED
+               bool
+               prompt "Disable reboot button handling" if TARGET_BUTTON_CUSTOMIZATION
+               default n
+               help
+                       If set, the reboot button handling logic in /etc/rc.button/reboot is disabled.
+
+       config TARGET_BUTTON_CUSTOMIZATION_RESET_DISABLED
+               bool
+               prompt "Disable reset button handling" if TARGET_BUTTON_CUSTOMIZATION
+               default n
+               help
+                       If set, the reset button handling logic in /etc/rc.button/reset is disabled.
+
+       config TARGET_BUTTON_CUSTOMIZATION_RF_KILL_DISABLED
+               bool
+               prompt "Disable rfkill button handling" if TARGET_BUTTON_CUSTOMIZATION
+               default n
+               help
+                       If set, the rfkill button handling logic in /etc/rc.button/rfkill is disabled.
+
 
 menuconfig PER_FEED_REPO
        bool "Separate feed repositories" if IMAGEOPT