Files
makronix/tools/cd-source.sh
T
lotherk 6d0c92ae38 signify: sign the release automatically, verify it before an upgrade
- make sourcesets signs RELEASEDIR/source/sets/SHA512 inside the build lock
  when SIGNIFY_SECKEY is set (tools/sign-release.sh auto); a build without
  the key says so and stays unsigned.
- make iso signs the package summary first; tools/cd3.sh puts
  pkg_summary.gz.sig next to the summary on the DVD and on every package CD.
- tools/cd-source.sh carries SHA512.sig on the source DVD and the README
  names the two verification commands.
- tools/upgrade-verify.sh: verifies root key -> release key -> SHA512 and
  then the SHA512 of the set files; the upgrade command (tasksd t0055) calls
  it before sysupgrade/pkg_add run as root.

Measured 2026-11-16: the source SHA512 signed with the release key verifies
through the chain ("signed by the root key", "good signature"), the copy
extracted from the source DVD too, the package summary verifies, and
upgrade-verify checks src.tgz (5.8 GB) against SHA512.  `make iso` itself
was not run to the end: a commit in another session changed src/ during the
release, so build-stamp refused the packaging
(build/logs/release-iso-2026-11-16-signed.log).
2026-11-16 10:38:59 +00:00

93 lines
3.5 KiB
Bash
Executable File

#!/bin/sh
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
# cd-source.sh -- the source DVD: the one source set, on its own medium.
#
# usage: cd-source.sh
#
# The install DVD carries the system and the programs; the sources are their
# own DVD (Konrad, 2026-11-15). It is a data DVD, ISO 9660 with Rock Ridge,
# made with the build's own makefs (nbmakefs). ISO 9660 stores a file size
# in 32 bits, and makefs truncated the 5.8 GB set at 4 GB (measured
# 2026-11-15: the installer's gzip saw a 1.5 GB file and stopped with
# "unexpected end of file"). The set is therefore split into parts of 2 GiB
# and sysinst cats them; the layout the installer looks for is
#
# source/sets/src.tgz MD5 SHA512 the one set, unpacked to /usr/src
# README the commands to install it
#
# Written to RELEASEDIR/images/Makronix-<version>-amd64-source.iso. Run by
# `make isosrc' after `make sourcesets'. The set is 5.5 GB (2026-11-15), so
# the medium is a dual-layer DVD (8.5 GB), not a DVD-5.
set -eu
TOP=$(cd "$(dirname "$0")/.." && pwd)
OBJ=$TOP/build/obj
REL=$OBJ/releasedir
SETS=$REL/source/sets
STAGE=$TOP/build/cdsource
VER=$(cat "$TOP/src/sys/conf/makronix-release")
die()
{
echo "cd-source: $*" >&2
exit 1
}
MAKEFS=$(ls "$OBJ"/tooldir.*/bin/nbmakefs 2>/dev/null | head -1)
[ -x "$MAKEFS" ] || die "no nbmakefs in $OBJ/tooldir.*/bin"
[ -f "$SETS/src.tgz" ] || die "no $SETS/src.tgz (make sourcesets first)"
[ -f "$SETS/MD5" ] || die "no $SETS/MD5 (make sourcesets first)"
[ -f "$SETS/SHA512" ] || die "no $SETS/SHA512 (make sourcesets first)"
rm -rf "$STAGE"
mkdir -p "$STAGE/source/sets"
# ISO 9660 stores a file size in 32 bits: split the set into parts below
# 2 GiB. sysinst cats them (set_file_exists_p, extract_file_to) and the
# README says how to do it by hand.
split -b 2000m "$SETS/src.tgz" "$STAGE/source/sets/src.tgz."
cp -p "$SETS/MD5" "$SETS/SHA512" "$STAGE/source/sets/"
if [ -f "$SETS/SHA512.sig" ]; then
cp -p "$SETS/SHA512.sig" "$STAGE/source/sets/"
fi
cat > "$STAGE/README" <<EOF
The Makronix source set, version $VER
=====================================
This DVD carries the whole Makronix tree: src/, xsrc/, ext/, pkgsrc/,
mobile/, www/, docs/, tools/, the root files, the pins and the distfiles of
the Makronix packages. It unpacks to /usr/src, and a system with it can
rebuild itself without a network.
Install it on a running system, as root. The set is split into parts
because one ISO 9660 file cannot be larger than 4 GiB; cat them in order:
mkdir -p /mnt
mount -t cd9660 /dev/cd0a /mnt
cat /mnt/source/sets/src.tgz.* | tar -xzpf - -C /
umount /mnt
The set is root:wsrc; the user that builds is in the wsrc group. Then:
cd /usr/src
export MAKRONIX_TOP=/usr/src
make release ARCH=amd64
Size and hashes: source/sets/MD5, source/sets/SHA512. The SHA512 is signed
(root key -> release key, signify); check it before you unpack:
signify -V -p /etc/signify/makronix-root.pub -m /etc/signify/makronix-0.99.pub -x /etc/signify/makronix-0.99.pub.sig
signify -V -p /etc/signify/makronix-0.99.pub -m /mnt/source/sets/SHA512 -x /mnt/source/sets/SHA512.sig
The install DVD carries the system and the programs, not the sources; this
DVD is the one that does.
EOF
mkdir -p "$REL/images"
OUT=$REL/images/Makronix-$VER-amd64-source.iso
rm -f "$OUT"
"$MAKEFS" -t cd9660 -o rockridge,label=MAKRONIX_SOURCE,publisher=Makronix \
"$OUT" "$STAGE"
echo "cd-source: ${OUT#$TOP/}: $(du -h "$OUT" | cut -f1)"