Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions release/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
# Variables affecting the build process:
# WORLDDIR: location of src tree -- must have built world and default kernel
# (by default, the directory above this one)
# PORTSDIR: location of ports tree to distribute (default: /usr/ports)
# PORTSDIR: location of mports tree to distribute (default: /usr/mports)
# MPORT_REPOSITORY: blessed mport package repository to stage on dvd1.iso
# DVD_PACKAGE_ROOTS: application packages offered by bsdinstall
# XTRADIR: xtra-bits-dir argument for <arch>/mkisoimages.sh
# NOPKG: if set, do not distribute third-party packages
# NOPORTS: if set, do not distribute ports tree
Expand All @@ -36,6 +38,8 @@

WORLDDIR?= ${.CURDIR}/..
PORTSDIR?= /usr/mports
MPORT_REPOSITORY?= ${PORTSDIR}/Packages/${TARGET_ARCH}/All
DVD_PACKAGE_ROOTS?= midnightbsd-desktop bash zsh sudo screen tmux nano vim rsync git

.if !defined(TARGET) || empty(TARGET)
TARGET= ${MACHINE}
Expand Down Expand Up @@ -222,7 +226,7 @@ release.iso: disc1.iso
disc1.iso: disc1
sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_CD ${.TARGET} disc1 ${XTRADIR}

dvd1.iso: dvd pkg-stage
dvd1.iso: pkg-stage
sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_DVD ${.TARGET} dvd ${XTRADIR}

bootonly.iso: bootonly
Expand All @@ -240,11 +244,12 @@ packagesystem: base.txz kernel.txz ${EXTRA_PACKAGES}
sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST
touch ${.TARGET}

pkg-stage:
pkg-stage: dvd
.if !defined(NOPKG) || empty(NOPKG)
env PORTSDIR=${PORTSDIR} REPOS_DIR=${.CURDIR}/pkg_repos/ \
env ROOTDIR=${.OBJDIR}/dvd \
MPORT_REPOSITORY=${MPORT_REPOSITORY} \
DVD_PACKAGE_ROOTS="${DVD_PACKAGE_ROOTS}" \
sh ${.CURDIR}/scripts/pkg-stage.sh
mkdir -p ${.OBJDIR}/dvd/packages/repos/
.endif
touch ${.TARGET}

Expand Down
99 changes: 99 additions & 0 deletions release/packages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Packages on MidnightBSD installation media

MidnightBSD DVD images can carry a selected subset of a normal, blessed mport
repository. The DVD contains the complete repository index but only the
package bundles needed for the installer choices and their runtime dependency
closure. This keeps the image bounded while leaving the installed system with
a complete package catalog for later network use.

## Repository input

Build and bless the packages with Magus before building the release. The
directory passed as `MPORT_REPOSITORY` must contain the uncompressed
`index.db` produced by `magus-bless` and every `.mport` bundle referenced by
that index. The index and bundles must all come from the same Magus run and
match the release architecture and OS version.

The default repository location is:

```text
/usr/mports/Packages/${TARGET_ARCH}/All
```

`/usr/mports` is the canonical MidnightBSD mports path. A release
configuration can override the repository and top-level choices:

```sh
MPORT_REPOSITORY="/path/to/blessed/repository"
DVD_PACKAGE_ROOTS="midnightbsd-desktop bash zsh sudo screen tmux nano vim rsync git"
```

`NOPKG` continues to disable third-party package staging. Package payloads
are currently added only to `dvd1.iso`.

## Staging

`release/scripts/pkg-stage.sh` validates every configured root against the
blessed index, follows the `depends` table recursively, and copies the exact
bundle selected by each package name and version. It rejects ambiguous or
missing index entries, missing bundles, unsafe filenames, and SHA-256
mismatches. A staging failure stops the DVD build rather than producing
incomplete offline media.

The resulting `/packages` directory contains:

- `index.db`: the complete blessed repository index, including remote entries
and mirrors.
- `installer.tsv`: curated application roots and their default checklist
state. `midnightbsd-desktop` is selected by default.
- `catalog.tsv`: a sanitized, searchable catalog of application packages.
- `.mport` files: only the configured roots and their recursive dependencies.

Only application roots (`packages.type = 0`) are offered. The type stored in
the full index is not changed.

## Installer behavior

bsdinstall mounts the DVD package directory read-only at `/packages` inside
the target system. Its package screen provides a curated checklist plus a
name-and-description search of the full catalog. Search results are marked
as either present on the DVD or requiring the network.

The complete index is copied to `/var/db/mport/index.db` if the target does not
already have one. Selected packages are installed with:

```sh
mport -U -c "$BSDINSTALL_CHROOT" install -y package-name
```

`mport install` is preferable to `mport add` here. It uses the blessed index,
checks package hashes, resolves exact dependency versions, marks dependencies
automatic, uses `/packages` before attempting a download, and supports the
advanced network search. `-U` prevents an index refresh during installation
without disabling downloads for bundles absent from the DVD.

Local curated packages must have their complete dependency closure on the
DVD. Network-only installation failures are reported and return the user to
the package menu; they do not invalidate an otherwise completed base-system
installation.

## Future system packages

Installing the base operating system as mport packages is deliberately out of
scope. The media layout and full index preserve `packages.type`, so a future
pkgbase-like installer can use system packages (`type = 1`) without changing
the third-party application menu. Base-system extraction and application
selection should remain separate until that work is designed and implemented.

## Validation checklist

- Exercise dependency cycles, shared dependencies, missing bundles, duplicate
roots, invalid types, and incorrect hashes with a synthetic index.
- Confirm that a disconnected installation of `midnightbsd-desktop` uses only
DVD bundles and records its dependencies as automatic.
- Confirm that remote search results install when networking and DNS are
configured and fail cleanly otherwise.
- Boot-test `dvd1.iso`, revisit Packages from Final Configuration, and verify
package-media unmounting.
- Verify that disc1, bootonly, and memory-stick images do not gain the DVD
package payload.
11 changes: 9 additions & 2 deletions release/release.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ PORTBRANCH="master"
#NOPORTS=
#NOSRC=
#WITH_DVD=

## Set the directory containing index.db and package bundles from one blessed
## Magus run. The default is /usr/mports/Packages/${TARGET_ARCH}/All.
#MPORT_REPOSITORY="/usr/mports/Packages/amd64/All"

## Override the top-level application packages offered by bsdinstall.
#DVD_PACKAGE_ROOTS="midnightbsd-desktop bash zsh sudo screen tmux nano vim rsync git"
#WITH_COMPRESSED_IMAGES=

## Set to '1' to disable multi-threaded xz(1) compression.
Expand Down Expand Up @@ -77,8 +84,8 @@ PORTBRANCH="master"
## the chroot. This is intended for use when /usr/src already exists.
#SRC_UPDATE_SKIP=

## Set to a non-empty value skip checkout or update of /usr/ports in
## the chroot. This is intended for use when /usr/ports already exists.
## Set to a non-empty value skip checkout or update of /usr/mports in
## the chroot. This is intended for use when /usr/mports already exists.
#PORTS_UPDATE_SKIP=

## Set to pass additional flags to make(1) for the build chroot setup, such
Expand Down
39 changes: 25 additions & 14 deletions release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ env_setup() {
WITH_DVD=
WITH_COMPRESSED_IMAGES=

# A blessed mport repository and optional package-root override used when
# constructing dvd1.iso.
MPORT_REPOSITORY=
DVD_PACKAGE_ROOTS=

# Set to non-empty value to build virtual machine images as part of
# the release.
WITH_VMIMAGES=
Expand Down Expand Up @@ -194,6 +199,12 @@ env_check() {
KERNCONF=\"${KERNEL}\" ${CONF_FILES} ${SRCPORTS} \
WITH_DVD=${WITH_DVD} WITH_VMIMAGES=${WITH_VMIMAGES} \
WITH_CLOUDWARE=${WITH_CLOUDWARE} XZ_THREADS=${XZ_THREADS}"
if [ -n "${MPORT_REPOSITORY}" ]; then
RELEASE_RMAKEFLAGS="${RELEASE_RMAKEFLAGS} MPORT_REPOSITORY=${MPORT_REPOSITORY}"
fi
if [ -n "${DVD_PACKAGE_ROOTS}" ]; then
RELEASE_RMAKEFLAGS="${RELEASE_RMAKEFLAGS} DVD_PACKAGE_ROOTS=\"${DVD_PACKAGE_ROOTS}\""
fi

return 0
} # env_check()
Expand All @@ -211,10 +222,10 @@ chroot_setup() {
fi
fi
if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then
if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then
git -C ${CHROOTDIR}/usr/ports pull -q
if [ -d "${CHROOTDIR}/usr/mports/.git" ]; then
git -C ${CHROOTDIR}/usr/mports pull -q
else
${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports
${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/mports
fi
fi

Expand All @@ -238,7 +249,7 @@ extra_chroot_setup() {
[ -e /etc/resolv.conf -a ! -e ${CHROOTDIR}/etc/resolv.conf ] && \
cp /etc/resolv.conf ${CHROOTDIR}/etc/resolv.conf
# Run ldconfig(8) in the chroot directory so /var/run/ld-elf*.so.hints
# is created. This is needed by ports-mgmt/pkg.
# is created. This is needed when building software from mports.
eval chroot ${CHROOTDIR} /etc/rc.d/ldconfig forcerestart

# If MAKE_CONF and/or SRC_CONF are set and not character devices
Expand All @@ -254,9 +265,9 @@ extra_chroot_setup() {

_gitcmd="$(which git)"
if [ -z "${NOGIT}" -a -z "${_gitcmd}" ]; then
# Install git from ports if the ports tree is available;
# otherwise install the pkg.
if [ -d ${CHROOTDIR}/usr/ports ]; then
# Install git from mports if the mports tree is available;
# otherwise install it with mport.
if [ -d ${CHROOTDIR}/usr/mports ]; then
# Trick the ports 'run-autotools-fixup' target to do the right
# thing.
_OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U)
Expand All @@ -270,19 +281,19 @@ extra_chroot_setup() {
PBUILD_FLAGS="OSVERSION=${_OSVERSION} BATCH=yes"
PBUILD_FLAGS="${PBUILD_FLAGS} UNAME_r=${UNAME_r}"
PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}"
PBUILD_FLAGS="${PBUILD_FLAGS} WRKDIRPREFIX=/tmp/ports"
PBUILD_FLAGS="${PBUILD_FLAGS} WRKDIRPREFIX=/tmp/mports"
PBUILD_FLAGS="${PBUILD_FLAGS} DISTDIR=/tmp/distfiles"
eval chroot ${CHROOTDIR} env OPTIONS_UNSET=\"${GITUNSETOPTS}\" \
${PBUILD_FLAGS} \
make -C /usr/ports/devel/git FORCE_PKG_REGISTER=1 \
WRKDIRPREFIX=/tmp/ports \
make -C /usr/mports/devel/git FORCE_PKG_REGISTER=1 \
WRKDIRPREFIX=/tmp/mports \
DISTDIR=/tmp/distfiles \
install clean distclean
else
eval chroot ${CHROOTDIR} env ASSUME_ALWAYS_YES=yes \
pkg install -y devel/git
mport install -y git
eval chroot ${CHROOTDIR} env ASSUME_ALWAYS_YES=yes \
pkg clean -y
mport clean
fi
fi

Expand All @@ -294,11 +305,11 @@ extra_chroot_setup() {
PBUILD_FLAGS="OSVERSION=${_OSVERSION} BATCH=yes"
PBUILD_FLAGS="${PBUILD_FLAGS} UNAME_r=${UNAME_r}"
PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}"
PBUILD_FLAGS="${PBUILD_FLAGS} WRKDIRPREFIX=/tmp/ports"
PBUILD_FLAGS="${PBUILD_FLAGS} WRKDIRPREFIX=/tmp/mports"
PBUILD_FLAGS="${PBUILD_FLAGS} DISTDIR=/tmp/distfiles"
for _PORT in ${EMBEDDEDPORTS}; do
eval chroot ${CHROOTDIR} env ${PBUILD_FLAGS} make -C \
/usr/ports/${_PORT} \
/usr/mports/${_PORT} \
FORCE_PKG_REGISTER=1 deinstall install clean distclean
done
fi
Expand Down
Loading