Merge from vendor branch BINUTILS:
[dragonfly.git] / release / alpha / mkisoimages.sh
1 #!/bin/sh
2 #
3 # Module: mkisoimages.sh
4 # Author: Jordan K Hubbard
5 # Date:   22 June 2001
6 #
7 # $FreeBSD: src/release/alpha/mkisoimages.sh,v 1.2.2.4 2003/03/18 23:15:08 obrien Exp $
8 # $DragonFly: src/release/alpha/Attic/mkisoimages.sh,v 1.2 2003/06/17 04:27:19 dillon Exp $
9 #
10 # This script is used by release/Makefile to build the (optional) ISO images
11 # for a FreeBSD release.  It is considered architecture dependent since each
12 # platform has a slightly unique way of making bootable CDs.  This script
13 # is also allowed to generate any number of images since that is more of
14 # publishing decision than anything else.
15 #
16 # Usage:
17 #
18 # mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
19 #
20 # Where -b is passed if the ISO image should be made "bootable" by
21 # whatever standards this architecture supports (may be unsupported),
22 # image-label is the ISO image label, image-name is the filename of the
23 # resulting ISO image, base-bits-dir contains the image contents and
24 # extra-bits-dir, if provided, contains additional files to be merged
25 # into base-bits-dir as part of making the image.
26
27 if [ "x$1" = "x-b" ]; then
28         bootable="yes"
29         shift
30 fi
31
32 if [ $# -lt 3 ]; then
33         echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]'
34         exit 1
35 fi
36
37 type mkisofs 2>&1 | grep " is " >/dev/null
38 if [ $? -ne 0 ]; then
39         echo The mkisofs port is not installed.  Trying to get it now.
40         if [ -f /usr/ports/sysutils/mkisofs/Makefile ]; then
41                 cd /usr/ports/sysutils/mkisofs && make install && make clean
42         else
43                 if ! pkg_add -r mkisofs; then
44                         echo "Could not get it via pkg_add - please go install this"
45                         echo "from the ports collection and run this script again."
46                         exit 2
47                 fi
48         fi
49 fi
50
51 LABEL=$1; shift
52 NAME=$1; shift
53
54 mkisofs -r -J -V $LABEL -o $NAME $*
55
56 type setcdboot 2>&1 | grep " is " >/dev/null
57 if [ $? -ne 0 ]; then
58         echo The setcdboot port is not installed.  Trying to get it now.
59         if [ -f /usr/ports/sysutils/setcdboot/Makefile ]; then
60                 cd /usr/ports/sysutils/setcdboot && make install && make clean
61         else
62                 if ! pkg_add -r setcdboot; then
63                         echo "Could not get it via pkg_add - please go install this"
64                         echo "from the ports collection and run this script again."
65                         exit 2
66                 fi
67         fi
68 fi
69 if [ "x$bootable" != "x" ]; then
70         setcdboot $NAME /boot/cdboot
71 fi