From 4bdc2ab93ab280ed6c8f07567cab9d5512f9e261 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 26 Feb 2026 20:53:16 +0100 Subject: [PATCH] base-files: add options to disable default button handling 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 --- package/base-files/Makefile | 10 +++++++ package/base-files/image-config.in | 44 ++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index f0ebb52fe9..2f84179cb3 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -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) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 0f71384190..24149345b9 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -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