4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
15 # Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved.
16 # Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
20 # Build an ISO installer using the Kayak tools.
23 if [ `id -u` != "0" ]; then
24 echo "You must be root to run this script."
28 if [ -z "$BUILDSEND_MP" ]; then
29 echo "Using /rpool/kayak_image for BUILDSEND_MP"
30 BUILDSEND_MP
=/rpool
/kayak_image
33 if [ -z "$VERSION" ]; then
34 echo "VERSION not set." >&2
37 echo "Using version $VERSION..."
46 # Allow temporary directory override
49 KAYAK_MINIROOT
=$BUILDSEND_MP/boot_archive.gz
50 ZFS_IMG
=$BUILDSEND_MP/kayak_
${VERSION}.zfs
52 [ ! -f $KAYAK_MINIROOT -o ! -f $ZFS_IMG ] && echo "Missing files." && exit 1
54 ISO_ROOT
=$TMPDIR/iso_root
55 BA_ROOT
=$TMPDIR/boot_archive
58 DST_ISO
=$BUILDSEND_MP/${VERSION}.iso
60 #############################################################################
62 # The kayak mini-root is used for both the ISO root filesystem and for the
63 # miniroot that is loaded and mounted on / when booted.
70 stage
"Adding files to ISO root"
71 # our tar(1) doesn't seem to support multiple file args with -C...
72 tar -cf - -C $BUILDSEND_MP/root boot |
tar -xf - -C $ISO_ROOT
73 tar -cf - -C $BUILDSEND_MP/root platform |
tar -xf - -C $ISO_ROOT
75 # Place the full ZFS image into the ISO root so it does not form part of the
76 # boot archive (otherwise the boot seems to hang for several minutes while
77 # the miniroot is loaded)
79 stage
"Adding ZFS image to ISO root"
80 pv
$ZFS_IMG > $ISO_ROOT/unleashed.zfs
81 # Create a file to indicate that this is the right volume set on which to
82 # find the image - see src/mount_media.c
83 echo "unleashed-installer" > $ISO_ROOT/.volsetid
85 # Remind people this is the installer.
86 cat <<EOF > $ISO_ROOT/boot/loader.conf.local
87 loader_menu_title="Welcome to the Unleashed installer"
89 ttya-mode="115200,8,n,1,-"
94 # Install the miniroot $ISO_ROOT as the boot archive.
96 stage
"Installing boot archive"
97 cp $KAYAK_MINIROOT ${KAYAK_MINIROOT%.gz}.
hash $ISO_ROOT/platform
/
98 stage
"ISO root size: `du -sh $ISO_ROOT/.`"
100 # And finally, burn the ISO.
101 LC_ALL
=C mkisofs
-N -l -R -U -d -D \
111 -V "Unleashed $VERSION" \
115 stage
"$DST_ISO is ready"