git: cae98cf683dd - main - install: allow ENV in metatags

From: Simon J. Gerraty <sjg_at_FreeBSD.org>
Date: Mon, 21 Jul 2025 17:15:10 UTC
The branch main has been updated by sjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=cae98cf683ddd1421f4b66bb6aa7099ca6da94ef

commit cae98cf683ddd1421f4b66bb6aa7099ca6da94ef
Author:     Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2025-07-21 17:14:00 +0000
Commit:     Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2025-07-21 17:14:00 +0000

    install: allow ENV in metatags
    
    The metatags file informs install of kernel and modules to load,
    allow it to also case variables to be set in env.
    
    Reviewed by:    imp
    Sponsored by:   Juniper Networks, Inc
    Differential Revision:  https://reviews.freebsd.org/D51446
---
 stand/common/install.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/stand/common/install.c b/stand/common/install.c
index 249eca1648f3..d07c4c6fc620 100644
--- a/stand/common/install.c
+++ b/stand/common/install.c
@@ -137,7 +137,9 @@ read_metatags(int fd)
 		}
 		*p++ = '\0';
 
-		if (strcmp(tag, "KERNEL") == 0)
+		if (strncmp(tag, "ENV_", 4) == 0)
+			setenv(&tag[4], val, 1);
+		else if (strcmp(tag, "KERNEL") == 0)
 			error = setpath(&inst_kernel, val);
 		else if (strcmp(tag, "MODULES") == 0)
 			error = setmultipath(&inst_modules, val);