#!/bin/sh # License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. # cd2.sh -- the second install CD: the makronix set. # # usage: cd2.sh # # Makronix installs from two CDs. The first (the installcd of src/distrib/ # amd64/cdroms, patch 0012) carries the system and boots the installer into # RAM; sysinst unpacks what is on it and then asks for the second CD, which # carries the pkgsrc userland (CDE, vim, flex under /usr/pkg), the `makronix' # set, and cgdroot.kmod (the encrypted installation copies it into the boot # partition at the end, when the second CD is the one in the drive). # # The image is a data CD: ISO 9660 with Rock Ridge, made with the build's own # makefs (nbmakefs), the way the other media are made (distrib/common/ # Makefile.bootcd). Layout, the same paths sysinst looks at on any CD: # # amd64/binary/sets/makronix.tar.xz MD5 SHA512 (the lines of makronix) # amd64/installation/miniroot/cgdroot.kmod # # Written to RELEASEDIR/images/Makronix--amd64-cd2.iso. Run by # `make iso' after build.sh iso-image. set -eu TOP=$(cd "$(dirname "$0")/.." && pwd) # This tool writes build/obj or releasedir: only inside the build lock. if [ -z "${BUILD_LOCK_HELD:-}" ] || [ ! -d "$BUILD_LOCK_HELD" ]; then echo "${0##*/}: run this through make or tools/build-lock.sh" >&2 exit 1 fi OBJ=$TOP/build/obj REL=$OBJ/releasedir SETS=$REL/amd64/binary/sets MINI=$REL/amd64/installation/miniroot STAGE=$TOP/build/cd2 die() { echo "cd2: $*" >&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/makronix.tar.xz" ] || die "no $SETS/makronix.tar.xz (make release first)" [ -f "$MINI/cgdroot.kmod" ] || die "no $MINI/cgdroot.kmod (make release first)" # the version is in the name of the first CD cd1=$(ls "$REL"/images/Makronix-*-amd64.iso 2>/dev/null | head -1) [ -n "$cd1" ] || die "no first CD in $REL/images (build.sh iso-image first)" ver=${cd1##*/Makronix-} ver=${ver%-amd64.iso} rm -rf "$STAGE" mkdir -p "$STAGE/amd64/binary/sets" "$STAGE/amd64/installation/miniroot" ln "$SETS/makronix.tar.xz" "$STAGE/amd64/binary/sets/makronix.tar.xz" 2>/dev/null \ || cp -p "$SETS/makronix.tar.xz" "$STAGE/amd64/binary/sets/makronix.tar.xz" for f in MD5 SHA512; do grep 'makronix' "$SETS/$f" > "$STAGE/amd64/binary/sets/$f" || true done ln "$MINI/cgdroot.kmod" "$STAGE/amd64/installation/miniroot/cgdroot.kmod" 2>/dev/null \ || cp -p "$MINI/cgdroot.kmod" "$STAGE/amd64/installation/miniroot/cgdroot.kmod" OUT=$REL/images/Makronix-$ver-amd64-cd2.iso rm -f "$OUT" "$MAKEFS" -t cd9660 -o rockridge,label=MAKRONIX_INSTALL_CD2,publisher=Makronix "$OUT" "$STAGE" echo "cd2: ${OUT#$TOP/}: $(du -h "$OUT" | cut -f1)"