Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/release/i386/mkisoimages.sh
34677 views
1
#!/bin/sh
2
#
3
# Module: mkisoimages.sh
4
# Author: Jordan K Hubbard
5
# Date: 22 June 2001
6
#
7
#
8
# This script is used by release/Makefile to build the (optional) ISO images
9
# for a FreeBSD release. It is considered architecture dependent since each
10
# platform has a slightly unique way of making bootable CDs. This script
11
# is also allowed to generate any number of images since that is more of
12
# publishing decision than anything else.
13
#
14
# Usage:
15
#
16
# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
17
#
18
# Where -b is passed if the ISO image should be made "bootable" by
19
# whatever standards this architecture supports (may be unsupported),
20
# image-label is the ISO image label, image-name is the filename of the
21
# resulting ISO image, base-bits-dir contains the image contents and
22
# extra-bits-dir, if provided, contains additional files to be merged
23
# into base-bits-dir as part of making the image.
24
25
set -e
26
27
scriptdir=$(dirname $(realpath $0))
28
. ${scriptdir}/../scripts/tools.subr
29
30
if [ "$1" = "-b" ]; then
31
MAKEFSARG="$4"
32
else
33
MAKEFSARG="$3"
34
fi
35
36
if [ -f ${MAKEFSARG} ]; then
37
BASEBITSDIR=`dirname ${MAKEFSARG}`
38
METALOG=${MAKEFSARG}
39
elif [ -d ${MAKEFSARG} ]; then
40
BASEBITSDIR=${MAKEFSARG}
41
METALOG=
42
else
43
echo "${MAKEFSARG} must exist"
44
exit 1
45
fi
46
47
if [ "$1" = "-b" ]; then
48
# This is highly x86-centric and will be used directly below.
49
bootable="-o bootimage=i386;$BASEBITSDIR/boot/cdboot -o no-emul-boot"
50
shift
51
else
52
bootable=""
53
fi
54
55
if [ $# -lt 3 ]; then
56
echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]"
57
exit 1
58
fi
59
60
LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift
61
NAME="$1"; shift
62
# MAKEFSARG extracted already
63
shift
64
65
publisher="The FreeBSD Project. https://www.FreeBSD.org/"
66
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab"
67
if [ -n "${METALOG}" ]; then
68
metalogfilename=$(mktemp /tmp/metalog.XXXXXX)
69
cat ${METALOG} > ${metalogfilename}
70
echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename}
71
MAKEFSARG=${metalogfilename}
72
fi
73
${MAKEFS} -D -N ${BASEBITSDIR}/etc -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@"
74
rm -f "$BASEBITSDIR/etc/fstab"
75
if [ -n "${METALOG}" ]; then
76
rm ${metalogfilename}
77
fi
78
79