Files
makronix/tools/cd-source.sh
T
lotherk 5fc42ec1ac source DVD: 5.8 GB in parts, the installer cats them
The source set is 5.8 GB; one ISO 9660 file can hold 4 GB (the size field
is 32 bits) and makefs truncated src.tgz to 1.5 GB (measured 2026-11-15:
the installer's gzip stopped with "unexpected end of file").  UDF would
hold the single file, but NetBSD rejected the makefs image with EINVAL
(measured 2026-11-16 on a dvdrom image and on a small test image).

- tools/cd-source.sh splits src.tgz into 2 GiB parts (src.tgz.aa, .ab,
  ...) and writes ISO 9660 with Rock Ridge; the README gives the
  `cat ... | tar` command.
- sysinst: set_file_exists_p() accepts the first part, and the source set
  is extracted with `sh -c 'cat .../src.tgz.* | tar --chroot -xzpf -'`.
  run_program() splits its command into argv and has no shell: without
  `sh -c`, cat wrote the parts to the terminal and tar never ran (measured
  2026-11-16, build/logs/install-simple-source-2026-11-16f.log).
- tools/install-simple.sh: the -S test swaps in the source DVD for the
  source prompt and back to the install DVD for the makronix set that
  follows it; DVDISO/CDSRC can name copies outside RELEASEDIR, because a
  release in another session removes images (measured 2026-11-15).

Measured (build/logs/install-simple-source-2026-11-16h.log): the full
profile asked for the source DVD, the parts were extracted, the installed
system passes "/usr/src holds the tree", "/usr/src has PINS and pkgsrc",
"all 1569 Makronix distfiles are in /usr/src/distfiles", and PINS names the
base.  The run exits 1 on dbus and cupsd not enabled/running, unrelated to
the source set.
2026-11-16 03:09:27 +00:00

85 lines
3.1 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/"
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 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)"