tools/museum-pack.sh hard-links the IRIX 6.5.29 installation CDs, the Mac OS 9.2 and Tiger images, the SunOS 4.1.4 CD and the PROMs into build/museum-pack (SHA256 MANIFEST, then a tar); museum media --pack DIR imports a pack in place. The BSD-3-Clause ARCS firmware henry_arcs.scc.bin is taken from build/firmware and packed. The Sun SS-5 PROM and MAME's indy_4610 ROM set are proprietary and are only packed when the owner supplies them. Nothing of the pack is committed or part of the release. checkflist exit 0 after installing the updated program.
194 lines
6.1 KiB
Bash
Executable File
194 lines
6.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
|
#
|
|
# museum-pack.sh -- pack the owner's museum media into a private media pack
|
|
#
|
|
# usage: tools/museum-pack.sh [--no-tar] [--out DIR]
|
|
#
|
|
# The museum's operating system media are proprietary: they belong to their
|
|
# owner, are not part of Makronix and must not be committed or redistributed.
|
|
# This tool therefore writes the pack under build/ (gitignored) from the files
|
|
# the owner already has, with hard links (same file system, no second copy)
|
|
# and a MANIFEST of SHA256 sums. The pack has the museum home's layout:
|
|
#
|
|
# media/irix65/*.iso
|
|
# media/sunos4/sunos_4.1.4_install.iso ss5.bin
|
|
# media/macos9/*.ISO
|
|
# media/tiger/*.iso
|
|
#
|
|
# so it can be unpacked over $HOME/Museum, or used in place with
|
|
# `museum media --pack DIR`.
|
|
#
|
|
# Sources come from the environment, defaulting to the known paths here:
|
|
#
|
|
# MUSEUM_IRIX_DIR directory with the IRIX 6.5.29 *.iso
|
|
# MUSEUM_MACOS9 the Mac OS 9 install CD image
|
|
# MUSEUM_TIGER the Mac OS X 10.4 install DVD image
|
|
# MUSEUM_SUNOS4 the SunOS 4.1.4 install CD image
|
|
# MUSEUM_SS5 the SS-5 PROM (ss5.bin), optional but needed to boot
|
|
# MUSEUM_ARCS henry_arcs.scc.bin (qemu-sgi), optional
|
|
#
|
|
# A missing PROM is reported and the pack is still written; a missing
|
|
# install CD is an error.
|
|
|
|
set -eu
|
|
|
|
TOP=$(cd "$(dirname "$0")/.." && pwd)
|
|
OUT=$TOP/build/museum-pack
|
|
TAR=1
|
|
|
|
while [ $# -gt 0 ]; do
|
|
case $1 in
|
|
--no-tar) TAR=0 ;;
|
|
--out) shift; [ $# -gt 0 ] || { echo "usage: ${0##*/} [--no-tar] [--out DIR]" >&2; exit 2; }; OUT=$1 ;;
|
|
*) echo "usage: ${0##*/} [--no-tar] [--out DIR]" >&2; exit 2 ;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
IRIX_DIR=${MUSEUM_IRIX_DIR:-"$HOME/rev/sgi/fsck.technology/software/Silicon Graphics/IRIX Install Media/SGI IRIX 6.5/SGI IRIX 6.5.29"}
|
|
MACOS9=${MUSEUM_MACOS9:-"$HOME/rev/apple/MAC_OS_9-2-2_693-4669_0.ISO"}
|
|
TIGER=${MUSEUM_TIGER:-"$HOME/rev/apple/tiger-10-4-6-ppc.iso"}
|
|
SUNOS4=${MUSEUM_SUNOS4:-"$HOME/rev/sun/sunos_4.1.4_install.iso"}
|
|
SS5=${MUSEUM_SS5:-"$HOME/rev/sun/ss5.bin"}
|
|
ARCS=${MUSEUM_ARCS:-"$HOME/rev/sgi/henry_arcs.scc.bin"}
|
|
# the BSD-licensed ARCS firmware can be downloaded once into build/firmware/
|
|
[ -f "$ARCS" ] || ARCS=$TOP/build/firmware/henry_arcs.scc.bin
|
|
|
|
missing=
|
|
warn() { echo "museum-pack: $*" >&2; }
|
|
|
|
sha256_file()
|
|
{
|
|
if command -v sha256sum >/dev/null 2>&1; then
|
|
sha256sum "$1" | awk '{print $1}'
|
|
else
|
|
cksum -a sha256 "$1" | awk '{print $NF}'
|
|
fi
|
|
}
|
|
|
|
size_file()
|
|
{
|
|
if stat -c '%s' "$1" >/dev/null 2>&1; then
|
|
stat -c '%s' "$1"
|
|
else
|
|
stat -f '%z' "$1"
|
|
fi
|
|
}
|
|
|
|
# link SRC DEST: a hard link where the file system allows it, a copy otherwise
|
|
link()
|
|
{
|
|
mkdir -p "$(dirname "$2")"
|
|
[ -e "$2" ] && return 0
|
|
if ! ln "$1" "$2" 2>/dev/null; then
|
|
cp -p "$1" "$2"
|
|
fi
|
|
}
|
|
|
|
add()
|
|
{
|
|
src=$1
|
|
id=$2
|
|
[ -f "$src" ] || { warn "missing $id media: $src"; missing="$missing $id"; return 1; }
|
|
[ -s "$src" ] || { warn "empty $id media: $src"; missing="$missing $id"; return 1; }
|
|
base=$(basename "$src")
|
|
link "$src" "$OUT/media/$id/$base"
|
|
printf '%s %s %s %s\n' "$(sha256_file "$src")" \
|
|
"$(size_file "$src")" "$id" "$base" >> "$OUT/MANIFEST.files"
|
|
echo " $id/$base"
|
|
}
|
|
|
|
rm -rf "$OUT"
|
|
mkdir -p "$OUT/media"
|
|
: > "$OUT/MANIFEST.files"
|
|
|
|
echo "museum-pack: IRIX 6.5.29"
|
|
if [ -d "$IRIX_DIR" ]; then
|
|
for iso in "$IRIX_DIR"/*.iso; do
|
|
[ -f "$iso" ] || continue
|
|
add "$iso" irix65 || true
|
|
done
|
|
else
|
|
warn "no IRIX media directory: $IRIX_DIR"
|
|
missing="$missing irix65"
|
|
fi
|
|
echo "museum-pack: Mac OS 9.2"
|
|
add "$MACOS9" macos9 || true
|
|
echo "museum-pack: Mac OS X 10.4 Tiger"
|
|
add "$TIGER" tiger || true
|
|
echo "museum-pack: SunOS 4.1.4"
|
|
add "$SUNOS4" sunos4 || true
|
|
echo "museum-pack: PROMs"
|
|
if [ -f "$SS5" ]; then
|
|
add "$SS5" sunos4 || true
|
|
else
|
|
warn "no SS-5 PROM at $SS5; SunOS 4.1.4 cannot boot without it"
|
|
echo " ss5.bin: missing (set MUSEUM_SS5=/path/to/ss5.bin)"
|
|
missing="$missing ss5.bin"
|
|
fi
|
|
if [ -f "$ARCS" ]; then
|
|
add "$ARCS" irix65 || true
|
|
if [ -f "$(dirname "$ARCS")/LICENSE.r9999" ]; then
|
|
add "$(dirname "$ARCS")/LICENSE.r9999" irix65 || true
|
|
fi
|
|
else
|
|
warn "no henry_arcs.scc.bin at $ARCS; qemu-sgi boots only after the"
|
|
warn "installed IRIX kernel and the ARCS firmware are in media/irix65/"
|
|
missing="$missing henry_arcs.scc.bin"
|
|
fi
|
|
|
|
# the manifest: a header, then the files, sorted by machine and name
|
|
{
|
|
echo "# Makronix Museum media pack, $(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
echo "# PRIVATE: the media are the owner's; not part of Makronix."
|
|
echo "# sha256 bytes machine file"
|
|
sort -k3,3 -k4,4 "$OUT/MANIFEST.files"
|
|
} > "$OUT/MANIFEST"
|
|
rm -f "$OUT/MANIFEST.files"
|
|
|
|
cat > "$OUT/README" <<'EOF'
|
|
Makronix Museum media pack
|
|
==========================
|
|
|
|
This pack is a private copy of the museum owner's installation media. The
|
|
media are proprietary and are NOT part of Makronix: do not redistribute this
|
|
pack, and do not commit it to the Makronix tree.
|
|
|
|
The layout is the museum home:
|
|
|
|
media/irix65/ IRIX 6.5.29 installation CDs
|
|
media/sunos4/ SunOS 4.1.4 install CD and the SS-5 PROM (ss5.bin)
|
|
media/macos9/ Mac OS 9.2 install CD
|
|
media/tiger/ Mac OS X 10.4 install DVD
|
|
|
|
Use it in place (a mounted USB stick or DVD) with:
|
|
|
|
museum media --pack /path/to/museum-pack
|
|
|
|
or unpack it into the museum home:
|
|
|
|
tar -C "$HOME/Museum" -xf Makronix-museum-media-YYYY-MM-DD.tar
|
|
|
|
The Macs need no PROM: QEMU's OpenBIOS is part of emulators/qemu. SunOS
|
|
4.1.4 needs the SPARCstation 5 PROM (ss5.bin, from an SS-5 or a ROM archive);
|
|
it is proprietary and is only packed when the owner puts it at MUSEUM_SS5.
|
|
IRIX's qemu-sgi uses henry_arcs.scc.bin, the BSD-3-Clause ARCS firmware of
|
|
the r9999/qemu-sgi-ip22 projects; this pack includes it when present in
|
|
build/firmware/. MAME's indy_4610 ROM set is proprietary and is not packed.
|
|
|
|
The IRIX pack holds the installation CDs, not an installed IRIX: qemu-sgi
|
|
boots an installed kernel from vms/irix65/base.img (see museum(1)).
|
|
EOF
|
|
|
|
total=$(awk '{s += $2} END {printf "%.1f", s / 1073741824}' "$OUT/MANIFEST")
|
|
echo "museum-pack: $OUT ($total GiB)"
|
|
[ -z "$missing" ] || echo "museum-pack: missing:$missing" >&2
|
|
|
|
if [ "$TAR" = 1 ]; then
|
|
tarfile=$TOP/build/Makronix-museum-media-$(date +%Y-%m-%d).tar
|
|
echo "museum-pack: tar $tarfile (this reads every media file once)"
|
|
tar -cf "$tarfile" -C "$OUT" .
|
|
ls -lh "$tarfile"
|
|
fi
|