git: 6dafe8c1e46e - main - Clean pkg cache in release media

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Tue, 10 Dec 2024 17:29:05 UTC
The branch main has been updated by bofh:

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

commit 6dafe8c1e46e58097b277ab9babb3ec5336713d7
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2024-12-10 17:24:43 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2024-12-10 17:28:55 +0000

    Clean pkg cache in release media
    
    Recently wifi-firmware-kmod-release pkgs were added in the release
    installation media, but unfortunately the pkgs were not cleaned up after
    the installation. These kept the stale pkgs in the /var/cache. The pkgs
    should be removed with pkg clean.
    
    PR:             283112
    Reported by:    yanhui.he@broadcom.com
    Reviewed by:    cperciva, emaste
    Approved by:    cperciva, emaste, re (implicit)
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D47942
---
 release/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/release/Makefile b/release/Makefile
index a99486ea4b84..ee2f52ad56af 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -79,6 +79,7 @@ PKG_ARGS+=	-o METALOG=METALOG
 PKG_ENV+=	ASSUME_ALWAYS_YES=yes
 PKG_ARGS+=	-r ${.TARGET} -o REPOS_DIR=${.CURDIR}/pkg_repos
 PKG_INSTALL=	env ${PKG_ENV} ${PKG_CMD} ${PKG_ARGS} install
+PKG_CLEAN=	env ${PKG_ENV} ${PKG_CMD} ${PKG_ARGS} clean -a
 .endif
 
 .if !defined(VOLUME_LABEL) || empty(VOLUME_LABEL)
@@ -194,6 +195,7 @@ disc1: packagesystem
 .if ${.MAKE.OS} == "FreeBSD" && (!defined(NOPKG) || empty(NOPKG))
 # Install packages onto release media.
 	${PKG_INSTALL} wifi-firmware-kmod-release || true
+	${PKG_CLEAN} || true
 .endif
 # Set up installation environment
 	ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf
@@ -270,6 +272,7 @@ dvd: packagesystem
 .if ${.MAKE.OS} == "FreeBSD" && (!defined(NOPKG) || empty(NOPKG))
 # Install packages onto release media.
 	${PKG_INSTALL} wifi-firmware-kmod-release || true
+	${PKG_CLEAN} || true
 .endif
 # Set up installation environment
 	ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf