#!/bin/sh ################################################################################ # # make_openbsd_iso # # A simple script for creating an OpenBSD boot ISO from # the specified distribution. For example: # # $ ./make_openbsd_iso amd64 snapshots # # or # # $ ./make_openbsd_iso amd64 4.5 # # Author: David C. Snyder - 09/05/2009 # ################################################################################ ARCH=$1 REL=$2 DIR="${REL}/${ARCH}" if [ -z "$REL" -o -z "$ARCH" ] then echo "Usage: $0 architecture release (eg. amd64 4.6)" exit 1 fi if [ -f ${DIR}/MD5 ] then (cd $DIR 2>/dev/null && md5sum -c MD5) if [ $? -ne 0 ] then echo "The MD5 checksums don't match!" exit 2 fi SUM_FILE=${DIR}/MD5 fi if [ -f ${DIR}/SHA256 ] then (cd 2>/dev/null $DIR && sha256sum -c SHA256) if [ $? -ne 0 ] then echo "The SHA256 checksums don't match!" exit 3 fi SUM_FILE=${DIR}/SHA256 fi if [ -z "$SUM_FILE" -o ! -f "$SUM_FILE" ] then echo "Could not find a checksum file!" exit 4 fi CD_PATH=`dirname \`strings ${DIR}/cdbr | grep $ARCH | sed 's,^/,,'\`` VER=`perl -e ' ($d,$m,$y) = (localtime( (stat "'$SUM_FILE'")[9] ))[3..5]; printf "OpenBSD-'${ARCH}-${REL}'-%02d-%02d-%02d", $y%100, $m+1, $d; '` echo "mkisofs -no-emul-boot -m \*.iso -v -r -T -J -V $VER -root ${CD_PATH} -b ${CD_PATH}/cdbr -c boot.catalog -o ${VER}.iso ${DIR}" | sh -x echo "" ls -l ${VER}.iso echo "" echo "- Now go buy some OpenBSD stuff from http://www.openbsd.org/orders.html !"