Source: u-boot-menu
Version: 4.0.4
Severity: wishlist
Tags: patch
X-Debbugs-Cc: arnaud.ferra...@gmail.com

Dear Maintainer,

Currently u-boot-menu makes use of a single configuration file
one has to edit in order to change the default options. It could
be useful to use config fragments containing only one (or more)
variables, so that different packages could change different
config options (for example, one fragment could modify the
default cmdline, while another one could change the DTB folder).

The attached patch implements such a feature by sourcing any
*.conf file present under the /etc/u-boot-menu.d folder.

Please note this has been previously submitted as a merge request
on salsa[1], which I'm doubling with a BTS entry in case you
prefer handling such requests that way.

[1] https://salsa.debian.org/debian/u-boot-menu/-/merge_requests/5

Thanks,
Arnaud


-- System Information:
Debian Release: bookworm/sid
  APT prefers testing
  APT policy: (900, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.17.0-1-rt-amd64 (SMP w/64 CPU threads; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
>From 093b48b42afe03e1e0013d66ef2752ed9460bca8 Mon Sep 17 00:00:00 2001
From: Arnaud Ferraris <arnaud.ferra...@gmail.com>
Date: Tue, 14 Sep 2021 20:36:04 +0200
Subject: [PATCH] u-boot-update: allow using config fragments

In order to allow other packages and/or derivative distros to configure
specific aspects of `u-boot-menu` it can be useful to allow using config
fragments. This patch therefore implements loading config files from
`/etc/u-boot-menu.d`, overriding the values loaded from the default
configuration file.
---
 u-boot-update   | 9 +++++++++
 u-boot-update.8 | 5 ++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/u-boot-update b/u-boot-update
index da92918..d4af7c3 100755
--- a/u-boot-update
+++ b/u-boot-update
@@ -49,6 +49,15 @@ then
        . /etc/default/u-boot
 fi
 
+# Reading config file fragments if they exist
+for file in /etc/u-boot-menu.d/*.conf
+do
+       if [ -e "${file}" ]
+       then
+               . "${file}"
+       fi
+done
+
 # Reading the os-release file
 if [ -e /etc/os-release ]
 then
diff --git a/u-boot-update.8 b/u-boot-update.8
index 38f533b..becd57a 100644
--- a/u-boot-update.8
+++ b/u-boot-update.8
@@ -9,7 +9,9 @@ u\-boot\-update \- program to generate u\-boot menu files
 .SH DESCRIPTION
 u\-boot\-update is a tool used to generate the menu files
 used by the U\-BOOT bootloader.
-Options can be configured in /etc/default/u\-boot.
+Options can be configured in /etc/default/u\-boot or by
+adding configuration fragment files to /etc/u\-boot\-menu.d/
+(those take precedence over /etc/default/u\-boot).
 
 .PP
 
@@ -107,6 +109,7 @@ Default is 'device-tree.dtb'.
 
 .SH FILES
 /etc/default/u-boot
+/etc/u-boot-menu.d/
 
 .SH HOMEPAGE
 More information about U\-BOOT
-- 
2.35.1

Reply via email to