mkisoimages.sh revision 134280
11590Srgrimes#!/bin/sh
21590Srgrimes#
31590Srgrimes# Module: mkisoimages.sh
41590Srgrimes# Author: Jordan K Hubbard
51590Srgrimes# Date:   22 June 2001
61590Srgrimes#
71590Srgrimes# $FreeBSD: head/release/sparc64/mkisoimages.sh 134280 2004-08-25 00:48:35Z kensmith $
81590Srgrimes#
91590Srgrimes# This script is used by release/Makefile to build the (optional) ISO images
101590Srgrimes# for a FreeBSD release.  It is considered architecture dependent since each
111590Srgrimes# platform has a slightly unique way of making bootable CDs.  This script
121590Srgrimes# is also allowed to generate any number of images since that is more of
131590Srgrimes# publishing decision than anything else.
141590Srgrimes#
151590Srgrimes# Usage:
161590Srgrimes#
171590Srgrimes# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
181590Srgrimes#
191590Srgrimes# Where -b is passed if the ISO image should be made "bootable" by
201590Srgrimes# whatever standards this architecture supports (may be unsupported),
211590Srgrimes# image-label is the ISO image label, image-name is the filename of the
221590Srgrimes# resulting ISO image, base-bits-dir contains the image contents and
231590Srgrimes# extra-bits-dir, if provided, contains additional files to be merged
241590Srgrimes# into base-bits-dir as part of making the image.
251590Srgrimes
261590Srgrimespublisher="The FreeBSD Project.  http://www.freebsd.org/"
271590SrgrimesIMG=/tmp/bootfs
281590SrgrimesMNT=/mnt
291590Srgrimes
301590Srgrimesif [ "x$1" = "x-b" ]; then
3128199Scharnier	dd if=/dev/zero of=${IMG} bs=512 count=1024
321590Srgrimes	MD=`mdconfig -a -t vnode -f ${IMG}`
331590Srgrimes	sunlabel -w -B -b $4/boot/boot1 ${MD} auto
341590Srgrimes	newfs -O1 -o space -m 0 /dev/${MD}c
351590Srgrimes	mount /dev/${MD}c ${MNT}
361590Srgrimes	mkdir ${MNT}/boot
3728199Scharnier	cp $4/boot/loader ${MNT}/boot
381590Srgrimes	umount ${MNT}
3928199Scharnier	mdconfig -d -u ${MD#md}
4028199Scharnier	bootable="-B ,,,,${IMG}"
4150477Speter	shift
421590Srgrimeselse
431590Srgrimes	bootable=""
44307773Sbaptfi
45307773Sbapt
461590Srgrimesif [ $# -lt 3 ]; then
47307773Sbapt	echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]'
4828199Scharnier	rm -f ${IMG}
49307773Sbapt	exit 1
5028199Scharnierfi
511590Srgrimes
521590Srgrimestype mkisofs 2>&1 | grep " is " >/dev/null
531590Srgrimesif [ $? -ne 0 ]; then
54200462Sdelphij	echo The cdrtools port is not installed.  Trying to get it now.
55307773Sbapt	if [ -f /usr/ports/sysutils/cdrtools/Makefile ]; then
5628199Scharnier		cd /usr/ports/sysutils/cdrtools && make install BATCH=yes && make clean
571590Srgrimes	else
581590Srgrimes		if ! pkg_add -r cdrtools; then
591590Srgrimes			echo "Could not get it via pkg_add - please go install this"
601590Srgrimes			echo "from the ports collection and run this script again."
6187303Sdwmalone			exit 2
621590Srgrimes		fi
63227187Sed	fi
641590Srgrimesfi
65227187Sed
6692922SimpLABEL=$1; shift
671590SrgrimesNAME=$1; shift
681590Srgrimes
69102944Sdwmalonemkisofs $bootable -r -J -V $LABEL -P "$publisher" -o $NAME $*
701590Srgrimesrm -f ${IMG}
71102944Sdwmalone