12ef74d22SJordan K. Hubbard#!/bin/sh 22ef74d22SJordan K. Hubbard# 32ef74d22SJordan K. Hubbard# Module: mkisoimages.sh 42ef74d22SJordan K. Hubbard# Author: Jordan K Hubbard 52ef74d22SJordan K. Hubbard# Date: 22 June 2001 62ef74d22SJordan K. Hubbard# 72ef74d22SJordan K. Hubbard# 82ef74d22SJordan K. Hubbard# This script is used by release/Makefile to build the (optional) ISO images 92ef74d22SJordan K. Hubbard# for a FreeBSD release. It is considered architecture dependent since each 102ef74d22SJordan K. Hubbard# platform has a slightly unique way of making bootable CDs. This script 112ef74d22SJordan K. Hubbard# is also allowed to generate any number of images since that is more of 122ef74d22SJordan K. Hubbard# publishing decision than anything else. 132ef74d22SJordan K. Hubbard# 142ef74d22SJordan K. Hubbard# Usage: 152ef74d22SJordan K. Hubbard# 168dd9e9d0SJohn Baldwin# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir] 172ef74d22SJordan K. Hubbard# 188dd9e9d0SJohn Baldwin# Where -b is passed if the ISO image should be made "bootable" by 192ef74d22SJordan K. Hubbard# whatever standards this architecture supports (may be unsupported), 202ef74d22SJordan K. Hubbard# image-label is the ISO image label, image-name is the filename of the 212ef74d22SJordan K. Hubbard# resulting ISO image, base-bits-dir contains the image contents and 222ef74d22SJordan K. Hubbard# extra-bits-dir, if provided, contains additional files to be merged 232ef74d22SJordan K. Hubbard# into base-bits-dir as part of making the image. 242ef74d22SJordan K. Hubbard 25a7d9306aSEd Masteset -e 26a7d9306aSEd Maste 2793cf995aSEd Masteif [ "$1" = "-b" ]; then 2813cb0041SJessica Clarke MAKEFSARG="$4" 2913cb0041SJessica Clarkeelse 3013cb0041SJessica Clarke MAKEFSARG="$3" 3113cb0041SJessica Clarkefi 3213cb0041SJessica Clarke 3313cb0041SJessica Clarkeif [ -f ${MAKEFSARG} ]; then 3413cb0041SJessica Clarke BASEBITSDIR=`dirname ${MAKEFSARG}` 3513cb0041SJessica Clarke METALOG=${MAKEFSARG} 3613cb0041SJessica Clarkeelif [ -d ${MAKEFSARG} ]; then 3713cb0041SJessica Clarke BASEBITSDIR=${MAKEFSARG} 3813cb0041SJessica Clarke METALOG= 3913cb0041SJessica Clarkeelse 4013cb0041SJessica Clarke echo "${MAKEFSARG} must exist" 4113cb0041SJessica Clarke exit 1 4213cb0041SJessica Clarkefi 4313cb0041SJessica Clarke 4413cb0041SJessica Clarkeif [ "$1" = "-b" ]; then 45cf6ba592SNathan Whitehorn # This is highly x86-centric and will be used directly below. 4613cb0041SJessica Clarke bootable="-o bootimage=i386;$BASEBITSDIR/boot/cdboot -o no-emul-boot" 47ef6cf7f1SYoshihiro Takahashi shift 482ef74d22SJordan K. Hubbardelse 492ef74d22SJordan K. Hubbard bootable="" 502ef74d22SJordan K. Hubbardfi 512ef74d22SJordan K. Hubbard 522ef74d22SJordan K. Hubbardif [ $# -lt 3 ]; then 5327065039SDevin Teske echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" 542ef74d22SJordan K. Hubbard exit 1 552ef74d22SJordan K. Hubbardfi 562ef74d22SJordan K. Hubbard 5727065039SDevin TeskeLABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift 5827065039SDevin TeskeNAME="$1"; shift 5913cb0041SJessica Clarke# MAKEFSARG extracted already 6013cb0041SJessica Clarkeshift 612ef74d22SJordan K. Hubbard 62a2aef24aSEitan Adlerpublisher="The FreeBSD Project. https://www.FreeBSD.org/" 6313cb0041SJessica Clarkeecho "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab" 6413cb0041SJessica Clarkeif [ -n "${METALOG}" ]; then 6513cb0041SJessica Clarke metalogfilename=$(mktemp /tmp/metalog.XXXXXX) 6613cb0041SJessica Clarke cat ${METALOG} > ${metalogfilename} 6713cb0041SJessica Clarke echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} 6813cb0041SJessica Clarke MAKEFSARG=${metalogfilename} 6913cb0041SJessica Clarkefi 70*1a9b1c36SJessica Clarkemakefs -D -N ${BASEBITSDIR}/etc -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@" 7113cb0041SJessica Clarkerm -f "$BASEBITSDIR/etc/fstab" 7213cb0041SJessica Clarkeif [ -n "${METALOG}" ]; then 7313cb0041SJessica Clarke rm ${metalogfilename} 7413cb0041SJessica Clarkefi 75