aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@freebsdfoundation.org>2025-07-24 08:43:33 +0000
committerEd Maste <emaste@FreeBSD.org>2025-09-25 12:35:54 +0000
commitf4f0308440d2321fa9172dab1029f16a70289e4e (patch)
tree143c79b7314e83586619850f055c1ad69a74ae4b
parenta15f2c5cc58f403407daf797a2e6963adffa6c2c (diff)
release: create pkgbase repo config from Makefile
This will allow the VM image build scripts to use the same repository config file for installing base system packages at build time. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51482
-rw-r--r--release/Makefile22
-rwxr-xr-xrelease/scripts/pkgbase-stage.lua18
2 files changed, 19 insertions, 21 deletions
diff --git a/release/Makefile b/release/Makefile
index 491c343398b4..fb2a60130700 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -133,7 +133,7 @@ CLEANFILES+= ${I}.xz
.if defined(WITH_DVD) && !empty(WITH_DVD)
CLEANFILES+= pkg-stage
.endif
-CLEANDIRS= dist pkgdb pkgbase-repo pkgbase-repo-conf ftp disc1 disc1-disc1 disc1-memstick bootonly bootonly-bootonly bootonly-memstick dvd
+CLEANDIRS= dist pkgdb pkgbase-repo pkgbase-repo-dir ftp disc1 disc1-disc1 disc1-memstick bootonly bootonly-bootonly bootonly-memstick dvd
beforeclean:
chflags -R noschg .
.include <bsd.obj.mk>
@@ -194,8 +194,10 @@ dvd: packagesystem
.endif
.if !defined(NOPKGBASE) || empty(NOPKGBASE)
-PKGBASE_REPO= pkgbase-repo
-PKG_ABI= $$(${PKG_CMD} -o ABI_FILE=${.TARGET}/usr/bin/uname config ABI)
+PKGBASE_REPO_DIR= pkgbase-repo-dir
+WSTAGEDIR!= ${IMAKE} -f Makefile.inc1 -C ${WORLDDIR} -V WSTAGEDIR
+PKG_ABI_FILE= ${WSTAGEDIR}/usr/bin/uname
+PKG_ABI= $$(${PKG_CMD} -o ABI_FILE=${PKG_ABI_FILE} config ABI)
.endif
pkgbase-repo:
@@ -204,7 +206,13 @@ pkgbase-repo:
( ${IMAKE} -C ${WORLDDIR} packages REPODIR=${.OBJDIR}/pkgbase-repo \
INCLUDE_PKG_IN_PKGBASE_REPO=YES BOOTSTRAP_PKG_FROM_PORTS=YES )
-disc1: ${PKGBASE_REPO}
+pkgbase-repo-dir: pkgbase-repo
+ mkdir -p pkgbase-repo-dir
+ printf "FreeBSD-base: { url: "file://%s", enabled: yes }" \
+ ${.OBJDIR}/pkgbase-repo/${PKG_ABI}/latest \
+ > pkgbase-repo-dir/FreeBSD-base.conf
+
+disc1: ${PKGBASE_REPO_DIR}
# Install system
mkdir -p ${.TARGET}
( cd ${WORLDDIR} && ${IMAKE} installworld installkernel distribution \
@@ -218,7 +226,7 @@ disc1: ${PKGBASE_REPO}
# Create offline pkgbase repo on release media
mkdir -p ${.TARGET}/usr/freebsd-packages/repos/
${.CURDIR}/scripts/pkgbase-stage.lua disc \
- ${.OBJDIR}/pkgbase-repo/${PKG_ABI}/latest \
+ ${.OBJDIR}/pkgbase-repo-dir \
${.TARGET}/usr/freebsd-packages/offline \
"${_ALL_libcompats}" ${PKG_ABI}
cp ${.CURDIR}/scripts/FreeBSD-base-offline.conf \
@@ -308,7 +316,7 @@ bootonly:
echo "./boot/loader.conf type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
echo "./etc/rc.local type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
-dvd: ${PKGBASE_REPO}
+dvd: ${PKGBASE_REPO_DIR}
# Install system
mkdir -p ${.TARGET}
( cd ${WORLDDIR} && ${IMAKE} installworld installkernel distribution \
@@ -318,7 +326,7 @@ dvd: ${PKGBASE_REPO}
# Create offline pkgbase repo on release media
mkdir -p ${.TARGET}/usr/freebsd-packages/repos/
${.CURDIR}/scripts/pkgbase-stage.lua dvd \
- ${.OBJDIR}/pkgbase-repo/${PKG_ABI}/latest \
+ ${.OBJDIR}/pkgbase-repo-dir \
${.TARGET}/usr/freebsd-packages/offline \
"${_ALL_libcompats}" ${PKG_ABI}
cp ${.CURDIR}/scripts/FreeBSD-base-offline.conf \
diff --git a/release/scripts/pkgbase-stage.lua b/release/scripts/pkgbase-stage.lua
index 6845e0079b05..80de4ec80d20 100755
--- a/release/scripts/pkgbase-stage.lua
+++ b/release/scripts/pkgbase-stage.lua
@@ -81,28 +81,18 @@ local function main()
-- Determines package subset selected
local media = assert(arg[1])
assert(media == "disc" or media == "dvd")
- -- Local repository to fetch from
- local source = assert(arg[2])
+ -- Directory containing FreeBSD-base repository config
+ local repo_dir = assert(arg[2])
-- Directory to create new repository
local target = assert(arg[3])
- -- =hitespace separated list of all libcompat names (e.g. "32")
+ -- Whitespace separated list of all libcompat names (e.g. "32")
local all_libcompats = assert(arg[4])
-- ABI of repository
local ABI = assert(arg[5])
- assert(os.execute("mkdir -p pkgbase-repo-conf"))
- local f <close> = assert(io.open("pkgbase-repo-conf/FreeBSD-base.conf", "w"))
- assert(f:write(string.format([[
- FreeBSD-base: {
- url: "file://%s",
- enabled: yes
- }
- ]], source)))
- assert(f:close())
-
local pkg = "pkg -o ASSUME_ALWAYS_YES=yes -o IGNORE_OSVERSION=yes " ..
"-o ABI=" .. ABI .. " " ..
- "-o INSTALL_AS_USER=1 -o PKG_DBDIR=./pkgdb -R ./pkgbase-repo-conf "
+ "-o INSTALL_AS_USER=1 -o PKG_DBDIR=./pkgdb -R " .. repo_dir .. " "
assert(os.execute(pkg .. "update"))