git: 92e9301e56bd - main - release: install pkg to install media

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 25 Apr 2025 14:12:12 UTC
The branch main has been updated by emaste:

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

commit 92e9301e56bdd32dedd461c66745b5d453390cf2
Author:     Isaac Freund <ifreund@freebsdfoundation.org>
AuthorDate: 2025-04-23 07:18:48 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-04-25 14:11:50 +0000

    release: install pkg to install media
    
    This is the most straightforward way to make installation of base system
    packages from install media possible. Bootstrapping pkg at install time
    does not work since the root filesystem of install media is immutable.
    
    Reviewed by:    bz, cperciva, emaste
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D49968
---
 release/Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/release/Makefile b/release/Makefile
index d908059d781b..65a39d500f0b 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -193,6 +193,7 @@ disc1: packagesystem
 .endif
 .if ${.MAKE.OS} == "FreeBSD" && (!defined(NOPKG) || empty(NOPKG))
 # Install packages onto release media.
+	${PKG_INSTALL} pkg || true
 	${PKG_INSTALL} wifi-firmware-kmod-release || true
 	${PKG_CLEAN} || true
 .endif
@@ -231,6 +232,11 @@ bootonly: packagesystem
 	cp MANIFEST ${.TARGET}/usr/freebsd-dist
 	echo "./usr/freebsd-dist type=dir uname=root gname=wheel mode=0755" >> ${.TARGET}/METALOG
 	echo "./usr/freebsd-dist/MANIFEST type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
+.if ${.MAKE.OS} == "FreeBSD" && (!defined(NOPKG) || empty(NOPKG))
+# Install packages onto release media.
+	${PKG_INSTALL} pkg || true
+	${PKG_CLEAN} || true
+.endif
 # Set up installation environment
 	ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf
 	echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf
@@ -266,6 +272,7 @@ dvd: packagesystem
 .endif
 .if ${.MAKE.OS} == "FreeBSD" && (!defined(NOPKG) || empty(NOPKG))
 # Install packages onto release media.
+	${PKG_INSTALL} pkg || true
 	${PKG_INSTALL} wifi-firmware-kmod-release || true
 	${PKG_CLEAN} || true
 .endif