-fi
-
-# Root of the ISO and USB images
-echo "* Populating root filesystem..."
-overlay=$(mktemp -d ${BUILDTMP}/overlay.XXXXXX)
-install -d -m 755 $overlay
-trap "rm -rf $overlay" ERR INT
-
-# Create version files
-echo "* Creating version files"
-
-# Boot Manager compares pl_version in both places to make sure that
-# the right CD is mounted. We used to boot from an initrd and mount
-# the CD on /usr. Now we just run everything out of the initrd.
-for file in $overlay/pl_version $overlay/usr/isolinux/pl_version ; do
- mkdir -p $(dirname $file)
- echo "$FULL_VERSION_STRING" >$file
-done
-
-# Install boot server configuration files
-echo "* Installing boot server configuration files"
-
-# We always intended to bring up and support backup boot servers,
-# but never got around to it. Just install the same parameters for
-# both for now.
-for dir in $overlay/usr/boot $overlay/usr/boot/backup ; do
+ done
+
+}
+
+####################
+function init_serial () {
+ local console=$1; shift
+ if [ "$console" == "$GRAPHIC_CONSOLE" ] ; then
+ IS_SERIAL=
+ console_spec=""
+ echo "Standard, graphic, non-serial mode"
+ else
+ IS_SERIAL=true
+ console_dev=$(echo "$console" | awk -F: ' {print $1}')
+ console_baud=$(echo "$console" | awk -F: ' {print $2}')
+ [ -z "$console_baud" ] && console_baud="115200"
+ local console_parity=$(echo "$console" | awk -F: ' {print $3}')
+ [ -z "$console_parity" ] && console_parity="n"
+ local console_bits=$(echo "$console" | awk -F: ' {print $4}')
+ [ -z "$console_bits" ] && console_bits="8"
+ console_spec="console=${console_dev},${console_baud}${console_parity}${console_bits}"
+ local tty_nb=$(echo $console_dev | sed -e 's,[a-zA-Z],,g')
+ console_serial_line="SERIAL ${tty_nb} ${console_baud}"
+ echo "Serial mode"
+ echo "console_serial_line=${console_serial_line}"
+ echo "console_spec=${console_spec}"
+ fi
+}
+
+#################### run once : build the overlay image
+function build_overlay () {
+
+ BUILDTMP=$(mktemp -d ${BUILDTMP}/bootcd.XXXXXX)
+ push_cleanup rm -fr "${BUILDTMP}"
+
+ # initialize ISOFS
+ ISOFS="${BUILDTMP}/isofs"
+ mkdir -p "$ISOFS"
+ for i in "$ISOREF"/isofs/{bootcd.img,kernel}; do
+ ln -s "$i" "$ISOFS"
+ done
+ # use new location as of fedora 12
+ # used to be in /usr/lib/syslinux/isolinux.bin
+ # removed backward compat in jan. 2015
+ # as of syslinux 6.05 (fedora 21) ldlinux.c32 is required by isolinux.bin
+ # the debug version can come in handy at times, and is 40k as well
+ isolinuxdir="/usr/share/syslinux"
+ isolinuxfiles="isolinux.bin ldlinux.c32 isolinux-debug.bin memdisk"
+ for isolinuxfile in $isolinuxfiles; do
+ [ -f $isolinuxdir/$isolinuxfile ] && cp $isolinuxdir/$isolinuxfile "${BUILDTMP}/isofs"
+ done
+
+ # Root of the ISO and USB images
+ echo "* Populating root filesystem..."
+ OVERLAY="${BUILDTMP}/overlay"
+ install -d -m 755 $OVERLAY
+ push_cleanup rm -fr $OVERLAY
+
+ # Create version files
+ echo "* Creating version files"
+
+ # Boot Manager compares pl_version in both places to make sure that
+ # the right CD is mounted. We used to boot from an initrd and mount
+ # the CD on /usr. Now we just run everything out of the initrd.
+ for file in $OVERLAY/pl_version $OVERLAY/usr/isolinux/pl_version ; do
+ mkdir -p $(dirname $file)
+ echo "$FULL_VERSION_STRING" >$file
+ done
+
+ # Install boot server configuration files
+ echo "* Installing boot server configuration files"
+
+ # We always intended to bring up and support backup boot servers,
+ # but never got around to it. Just install the same parameters for
+ # both for now.
+ for dir in $OVERLAY/usr/boot $OVERLAY/usr/boot/backup ; do