Page MenuHomeFreeBSD

D51483.1777731456.diff
No OneTemporary

Size
5 KB
Referenced Files
None
Subscribers
None

D51483.1777731456.diff

diff --git a/release/Makefile b/release/Makefile
--- a/release/Makefile
+++ b/release/Makefile
@@ -23,7 +23,8 @@
# (by default, the directory above this one)
# NODISTSETS: if set, do not include dist sets or MANIFEST
# PKGBASE: if set, include pkgbase packages rather than dist tarballs in
-# disc1 and dvd1 installation media
+# disc1 and dvd1 installation media and build VM/cloud images
+# with packaged base systems.
# PORTSDIR: location of ports tree to distribute (default: /usr/ports)
# XTRADIR: xtra-bits-dir argument for <arch>/mkisoimages.sh
# NOPKG: if set, do not distribute third-party packages
diff --git a/release/Makefile.vm b/release/Makefile.vm
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -131,7 +131,7 @@
cw-${_CW:tl}-${_FS}-${_FMT}: cw-ec2-base-${_FS}-${_FMT}
.endif
-cw-${_CW:tl}-${_FS}-${_FMT}: ${QEMUTGT}
+cw-${_CW:tl}-${_FS}-${_FMT}: ${QEMUTGT} ${PKGBASE_REPO_DIR}
mkdir -p ${.OBJDIR}/${.TARGET}
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} SWAPSIZE=${SWAPSIZE} \
QEMUSTATIC=${QEMUSTATIC} \
@@ -139,6 +139,8 @@
${WITHOUT_QEMU:DWITHOUT_QEMU=true} \
${NO_ROOT:DNO_ROOT=true} \
PKG_INSTALL_EPOCH=${PKG_INSTALL_EPOCH:U${GITEPOCH}} \
+ PKGBASE=${PKGBASE} \
+ PKGBASE_REPO_DIR=${.OBJDIR}/pkgbase-repo-dir \
${.CURDIR}/scripts/mk-vmimage.sh \
-C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \
-F ${"${_CW:MEC2-BUILDER}" != "":?ufs:${_FS}} \
@@ -182,7 +184,7 @@
vm-base: vm-image
-vm-image: ${QEMUTGT}
+vm-image: ${QEMUTGT} ${PKGBASE_REPO_DIR}
.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
. for FORMAT in ${VMFORMATS}
. for FS in ${VMFSLIST}
@@ -192,6 +194,8 @@
${WITHOUT_QEMU:DWITHOUT_QEMU=true} \
${NO_ROOT:DNO_ROOT=true} \
PKG_INSTALL_EPOCH=${PKG_INSTALL_EPOCH:U${GITEPOCH}} \
+ PKGBASE=${PKGBASE} \
+ PKGBASE_REPO_DIR=${.OBJDIR}/pkgbase-repo-dir \
${.CURDIR}/scripts/mk-vmimage.sh \
-C ${.CURDIR}/tools/vmimage.subr \
-d ${.OBJDIR}/${.TARGET}-${FORMAT}-${FS} -F ${FS} \
diff --git a/release/tools/ec2-builder.conf b/release/tools/ec2-builder.conf
--- a/release/tools/ec2-builder.conf
+++ b/release/tools/ec2-builder.conf
@@ -11,6 +11,18 @@
export INSTALLOPTS="WITHOUT_DEBUG_FILES=YES WITHOUT_KERNEL_SYMBOLS=YES \
WITHOUT_LIB32=YES WITHOUT_TESTS=YES WITHOUT_LLDB=YES"
+# Equivalent to INSTALLOPTS for pkgbase
+vm_filter_base_packages() {
+ grep < /dev/stdin -v \
+ -e '.*-dbg$' \
+ -e '.*-lib32$' \
+ -e '^FreeBSD-src.*' \
+ -e '^FreeBSD-tests.*' \
+ -e '^FreeBSD-lldb.*' \
+ -e '^FreeBSD-kernel.*'
+ echo "FreeBSD-kernel-man"
+ echo "FreeBSD-kernel-generic"
+}
# Packages to install into the image we're creating. In addition to packages
# present on all EC2 AMIs, we install:
# * ec2-scripts, which provides a range of EC2ification startup scripts,
diff --git a/release/tools/ec2-small.conf b/release/tools/ec2-small.conf
--- a/release/tools/ec2-small.conf
+++ b/release/tools/ec2-small.conf
@@ -14,6 +14,19 @@
export INSTALLOPTS="WITHOUT_DEBUG_FILES=YES WITHOUT_KERNEL_SYMBOLS=YES \
WITHOUT_LIB32=YES WITHOUT_TESTS=YES WITHOUT_LLDB=YES"
+# Equivalent to INSTALLOPTS for pkgbase
+vm_filter_base_packages() {
+ grep < /dev/stdin -v \
+ -e '.*-dbg$' \
+ -e '.*-lib32$' \
+ -e '^FreeBSD-src.*' \
+ -e '^FreeBSD-tests.*' \
+ -e '^FreeBSD-lldb.*' \
+ -e '^FreeBSD-kernel.*'
+ echo "FreeBSD-kernel-man"
+ echo "FreeBSD-kernel-generic"
+}
+
# Packages to install into the image we're creating. In addition to packages
# present on all EC2 AMIs, we install:
# * ec2-scripts, which provides a range of EC2ification startup scripts,
diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr
--- a/release/tools/vmimage.subr
+++ b/release/tools/vmimage.subr
@@ -57,13 +57,36 @@
return 0
}
+# Reads a list of all base system packages from stdin.
+# Writes a list of base system packages to install to stdout.
+# This can be overridden by configuration files to modify the
+# set of base packages installed to the image.
+vm_filter_base_packages() {
+ grep < /dev/stdin -v \
+ -e '^FreeBSD-src.*' \
+ -e '^FreeBSD-kernel.*'
+ echo "FreeBSD-kernel-man"
+ echo "FreeBSD-kernel-generic"
+ echo "FreeBSD-kernel-generic-dbg"
+}
+
vm_install_base() {
# Installs the FreeBSD userland/kernel to the virtual machine disk.
- cd ${WORLDDIR} && \
- make DESTDIR=${DESTDIR} ${INSTALLOPTS} \
- installworld installkernel distribution || \
- err "\n\nCannot install the base system to ${DESTDIR}."
+ if [ -n "${PKGBASE}" ]; then
+ local pkg_cmd
+ pkg_cmd="pkg --rootdir ${DESTDIR} --repo-conf-dir ${PKGBASE_REPO_DIR}
+ -o ASSUME_ALWAYS_YES=yes -o IGNORE_OSVERSION=yes
+ -o INSTALL_AS_USER=yes "
+ $pkg_cmd update
+ selected=$($pkg_cmd rquery -U -r FreeBSD-base %n | vm_filter_base_packages)
+ $pkg_cmd install -U -r FreeBSD-base $selected
+ else
+ cd ${WORLDDIR} && \
+ make DESTDIR=${DESTDIR} ${INSTALLOPTS} \
+ installworld installkernel distribution || \
+ err "\n\nCannot install the base system to ${DESTDIR}."
+ fi
# Bootstrap etcupdate(8) database.
mkdir -p ${DESTDIR}/var/db/etcupdate

File Metadata

Mime Type
text/plain
Expires
Sat, May 2, 2:17 PM (4 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28540691
Default Alt Text
D51483.1777731456.diff (5 KB)

Event Timeline