3 # Builds custom BootCD ISO and USB images in the current
6 # Aaron Klingaman <alk@absarokasoft.com>
7 # Mark Huang <mlhuang@cs.princeton.edu>
8 # Copyright (C) 2004-2007 The Trustees of Princeton University
11 COMMAND=$(basename $0)
13 PATH=/sbin:/bin:/usr/sbin:/usr/bin
16 # uncomment this on to get systemd's full log on console (slows things down)
20 DEFAULT_TYPES="usb iso"
21 # Leave 4 MB of free space
22 GRAPHIC_CONSOLE="graphic"
23 SERIAL_CONSOLE="ttyS0:115200:n:8"
24 CONSOLE_INFO=$GRAPHIC_CONSOLE
25 MKISOFS_OPTS="-R -J -r -f -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table"
28 # command-line settable args
29 NODE_CONFIGURATION_FILE=
39 FULL_VERSION_STRING=""
47 console_serial_line=""
50 #################### compute all supported types
51 # removing support for serial in the type
52 # this is because kargs.txt goes in the overlay, that is computed only once
53 # so we cannot handle serial and graphic modes within the same invokation of this script
56 for x in iso usb usb_partition; do for c in "" "_cramfs" ; do
63 ALL_TYPES="$ALL_TYPES $t" ;;
67 #################### cleanup utilities
68 declare -a _CLEANUPS=()
69 function do_cleanup() {
70 cd / ; for i in "${_CLEANUPS[@]}"; do $i ; done
72 function push_cleanup() {
73 _CLEANUPS=( "${_CLEANUPS[@]}" "$*" )
75 function pop_cleanup() {
76 unset _CLEANUPS[$((${#_CLEANUPS[@]} - 1))]
79 #################### initialization
80 function init_and_check () {
82 # Change to our source directory
83 local srcdir=$(cd $DIRNAME && pwd -P)
87 ISOREF=$PWD/${VARIANT}
89 # The reference image is expected to have been built by prep.sh (see .spec)
90 # we disable the initial logic that called prep.sh if that was not the case
91 # this is because prep.sh needs to know pldistro
92 if [ ! -f $ISOREF/isofs/bootcd.img -o ! -f $ISOREF/version.txt ] ; then
93 echo "Could not find isofs and version.txt in $ISOREF"
94 if [ "$VARIANT" == "build" ] ; then
95 echo "You have to run prep.sh prior to calling $COMMAND"
97 echo "You need to create your variant image, see kvariant.sh"
103 # build/version.txt written by prep.sh
104 BOOTCD_VERSION=$(cat ${VARIANT}/version.txt)
106 if [ -f /etc/planetlab/plc_config ] ; then
107 # Source PLC configuration
108 . /etc/planetlab/plc_config
111 # use /var/tmp that should be large enough on both chroot- or vserver-based myplc
114 FULL_VERSION_STRING="${PLC_NAME} BootCD ${BOOTCD_VERSION}"
119 # the custom-dir feature is designed to let a myplc try/ship a patched bootcd
120 # without the need for a full devel environment
121 # for example, you would create /root/custom-bootcd/etc/rc.d/init.d/pl_hwinit
122 # and run this script with -C /root/custom-bootcd
123 # this creates a third .img image of the custom dir, that 'hides' the files from
124 # bootcd.img in the resulting unionfs
125 # it seems that this feature has not been used nor tested in a long time, use with care
128 echo "Usage: $COMMAND [OPTION]..."
129 echo " -f plnode.txt Node to customize CD for (default: none)"
130 echo " -t 'types' Build the specified images (default: $DEFAULT_TYPES)"
131 echo " NOTE: mentioning 'serial' as part of the type is not supported anymore"
132 echo " -a Build all known types as listed below"
133 echo " -s console-info Enable a serial line as console and also bring up getty on that line"
134 echo " console-info: tty:baud-rate:parity:bits"
135 echo " or 'default' shortcut for $SERIAL_CONSOLE"
136 echo " -S equivalent to -s default"
137 echo " -O output-base The prefix of the generated files (default: PLC_NAME-BootCD-VERSION)"
138 echo " useful when multiple types are provided"
139 echo " can be a full path"
140 echo " -o output-name The full name of the generated file"
141 echo " -C custom-dir Custom directory"
142 echo " -V variant Use a variant - see kvariant.sh"
143 echo " -n Dry run - mostly for debug/test purposes"
144 echo " -k Add additional parameters to the kargs.txt file"
145 echo " -h This message"
146 echo "All known types: $ALL_TYPES"
151 function parse_command_line () {
156 while getopts "f:t:as:SO:o:C:V:k:nh" opt ; do
158 f) NODE_CONFIGURATION_FILE=$OPTARG ;;
159 t) TYPES="$TYPES $OPTARG" ;;
160 a) TYPES="$ALL_TYPES" ;;
161 s) CONSOLE_INFO="$OPTARG" ;;
162 S) CONSOLE_INFO=$SERIAL_CONSOLE ;;
163 O) OUTPUT_BASE="$OPTARG" ;;
164 o) OUTPUT_NAME="$OPTARG" ;;
165 C) CUSTOM_DIR="$OPTARG" ;;
166 V) VARIANT="$OPTARG" ;;
167 k) KERNEL_ARGS="$KERNEL_ARGS $OPTARG" ;;
173 # use defaults if not set
174 [ -z "$TYPES" ] && TYPES="$DEFAULT_TYPES"
175 [ -z "$VARIANT" ] && VARIANT="build"
176 [ "$CONSOLE_INFO" == "default" ] && CONSOLE_INFO=$SERIAL_CONSOLE
178 if [ -n "$NODE_CONFIGURATION_FILE" ] ; then
179 # check existence of NODE_CONFIGURATION_FILE and normalize as we will change directory
180 if [ ! -f "$NODE_CONFIGURATION_FILE" ] ; then
181 echo "Node configuration file $NODE_CONFIGURATION_FILE not found - exiting"
184 cf_dir="$(dirname $NODE_CONFIGURATION_FILE)"
185 cf_dir="$(cd $cf_dir; pwd -P)"
186 cf_file="$(basename $NODE_CONFIGURATION_FILE)"
187 NODE_CONFIGURATION_FILE="$cf_dir"/"$cf_file"
191 local matcher="XXX$(echo $ALL_TYPES | sed -e 's,\W,XXX,g')XXX"
193 echo Checking type $t
194 echo $matcher | grep XXX${t}XXX &> /dev/null
195 if [ "$?" != 0 ] ; then
204 function init_serial () {
205 local console=$1; shift
206 if [ "$console" == "$GRAPHIC_CONSOLE" ] ; then
209 echo "Standard, graphic, non-serial mode"
212 console_dev=$(echo "$console" | awk -F: ' {print $1}')
213 console_baud=$(echo "$console" | awk -F: ' {print $2}')
214 [ -z "$console_baud" ] && console_baud="115200"
215 local console_parity=$(echo "$console" | awk -F: ' {print $3}')
216 [ -z "$console_parity" ] && console_parity="n"
217 local console_bits=$(echo "$console" | awk -F: ' {print $4}')
218 [ -z "$console_bits" ] && console_bits="8"
219 console_spec="console=${console_dev},${console_baud}${console_parity}${console_bits}"
220 local tty_nb=$(echo $console_dev | sed -e 's,[a-zA-Z],,g')
221 console_serial_line="SERIAL ${tty_nb} ${console_baud}"
223 echo "console_serial_line=${console_serial_line}"
224 echo "console_spec=${console_spec}"
228 #################### run once : build the overlay image
229 function build_overlay () {
231 BUILDTMP=$(mktemp -d ${BUILDTMP}/bootcd.XXXXXX)
232 push_cleanup rm -fr "${BUILDTMP}"
233 mkdir "${BUILDTMP}/isofs"
234 for i in "$ISOREF"/isofs/{bootcd.img,kernel}; do
235 ln -s "$i" "${BUILDTMP}/isofs"
237 # the syslinux that comes with f12 has this file in a new location
238 cp "/usr/lib/syslinux/isolinux.bin" "${BUILDTMP}/isofs" \
239 || cp "/usr/share/syslinux/isolinux.bin" "${BUILDTMP}/isofs"
240 ISOFS="${BUILDTMP}/isofs"
242 # Root of the ISO and USB images
243 echo "* Populating root filesystem..."
244 OVERLAY="${BUILDTMP}/overlay"
245 install -d -m 755 $OVERLAY
246 push_cleanup rm -fr $OVERLAY
248 # Create version files
249 echo "* Creating version files"
251 # Boot Manager compares pl_version in both places to make sure that
252 # the right CD is mounted. We used to boot from an initrd and mount
253 # the CD on /usr. Now we just run everything out of the initrd.
254 for file in $OVERLAY/pl_version $OVERLAY/usr/isolinux/pl_version ; do
255 mkdir -p $(dirname $file)
256 echo "$FULL_VERSION_STRING" >$file
259 # Install boot server configuration files
260 echo "* Installing boot server configuration files"
262 # We always intended to bring up and support backup boot servers,
263 # but never got around to it. Just install the same parameters for
265 for dir in $OVERLAY/usr/boot $OVERLAY/usr/boot/backup ; do
266 install -D -m 644 $PLC_BOOT_CA_SSL_CRT $dir/cacert.pem
267 install -D -m 644 $PLC_ROOT_GPG_KEY_PUB $dir/pubring.gpg
268 echo "$PLC_BOOT_HOST" >$dir/boot_server
269 echo "$PLC_BOOT_SSL_PORT" >$dir/boot_server_port
270 echo "/boot/" >$dir/boot_server_path
273 # Install old-style boot server configuration files
274 # as opposed to what a former comment suggested,
275 # this is still required, somewhere in the bootmanager apparently
276 install -D -m 644 $PLC_BOOT_CA_SSL_CRT $OVERLAY/usr/bootme/cacert/$PLC_BOOT_HOST/cacert.pem
277 echo "$FULL_VERSION_STRING" >$OVERLAY/usr/bootme/ID
278 echo "$PLC_BOOT_HOST" >$OVERLAY/usr/bootme/BOOTSERVER
279 echo "$PLC_BOOT_HOST" >$OVERLAY/usr/bootme/BOOTSERVER_IP
280 echo "$PLC_BOOT_SSL_PORT" >$OVERLAY/usr/bootme/BOOTPORT
282 # Generate /etc/issue
283 echo "* Generating /etc/issue"
285 if [ "$PLC_WWW_PORT" = "443" ] ; then
286 PLC_WWW_URL="https://$PLC_WWW_HOST/"
287 elif [ "$PLC_WWW_PORT" != "80" ] ; then
288 PLC_WWW_URL="http://$PLC_WWW_HOST:$PLC_WWW_PORT/"
290 PLC_WWW_URL="http://$PLC_WWW_HOST/"
293 mkdir -p $OVERLAY/etc
294 cat >$OVERLAY/etc/issue <<EOF
300 This machine is a node in the $PLC_NAME distributed network. It has
301 not fully booted yet. If you have cancelled the boot process at the
302 request of $PLC_NAME Support, please follow the instructions provided
303 to you. Otherwise, please contact $PLC_MAIL_SUPPORT_ADDRESS.
305 Console login at this point is restricted to root. Provide the root
306 password of the default $PLC_NAME Central administrator account at the
307 time that this CD was created.
312 echo "* Setting root password"
314 if [ -z "$ROOT_PASSWORD" ] ; then
315 # Generate an encrypted password with crypt() if not defined
316 # in a static configuration.
317 ROOT_PASSWORD=$(python <<EOF
318 import crypt, random, string
319 salt = [random.choice(string.letters + string.digits + "./") for i in range(0,8)]
320 print crypt.crypt('$PLC_ROOT_PASSWORD', '\$1\$' + "".join(salt) + '\$')
325 # build/passwd copied out by prep.sh
326 sed -e "s@^root:[^:]*:\(.*\)@root:$ROOT_PASSWORD:\1@" ${VARIANT}/passwd >$OVERLAY/etc/passwd
328 # Install node configuration file (e.g., if node has no floppy disk or USB slot)
329 if [ -f "$NODE_CONFIGURATION_FILE" ] ; then
330 echo "* Installing node configuration file $NODE_CONFIGURATION_FILE -> /usr/boot/plnode.txt of the bootcd image"
331 install -D -m 644 $NODE_CONFIGURATION_FILE $OVERLAY/usr/boot/plnode.txt
332 NODE_ID=$(source $NODE_CONFIGURATION_FILE; echo $NODE_ID)
333 echo "* Building network configuration for $NODE_ID"
334 plnet -- --root $OVERLAY --files-only --program BootCD $NODE_ID
337 [ -n "$IS_SERIAL" ] && KERNEL_ARGS="$KERNEL_ARGS ${console_spec}"
339 # tmp: should be restricted to f15 nodes and above
340 # making sure the network interfaces are still numbered eth0 and above
341 KERNEL_ARGS="$KERNEL_ARGS biosdevname=0"
342 # making sure selinux is turned off - somehow this is needed with lxc/f14
343 KERNEL_ARGS="$KERNEL_ARGS selinux=0"
344 # cannot use this mecahnism to set systemd default target because this applies to kexec boots as well
345 # # set default target for systemd
346 # KERNEL_ARGS="$KERNEL_ARGS systemd.unit=pl_boot.target"
347 # output more systemd-related messages on the console
348 KERNEL_ARGS="$KERNEL_ARGS systemd.log_target=console"
349 # this slows down system init but is very helpful when e.g. trying to run on a new distro
350 [ -n "$DEBUG_SYSTEMD" ] && KERNEL_ARGS="$KERNEL_ARGS systemd.log_level=debug systemd.journald.forward_to_console=1"
351 [ -n "$KERNEL_ARGS" ] && echo "$KERNEL_ARGS" > $OVERLAY/kargs.txt
353 # Pack overlay files into a compressed archive
354 echo "* Compressing overlay image"
355 (cd $OVERLAY && find . | cpio --quiet -c -o) | gzip -9 >$ISOFS/overlay.img
360 if [ -n "$CUSTOM_DIR" ]; then
361 echo "* Compressing custom image"
362 (cd "$CUSTOM_DIR" && find . | cpio --quiet -c -o) | gzip -9 >$ISOFS/custom.img
365 # Calculate ramdisk size (total uncompressed size of both archives)
366 ramdisk_size=$(gzip -l $ISOFS/bootcd.img $ISOFS/overlay.img ${CUSTOM_DIR:+$ISOFS/custom.img} | tail -1 | awk '{ print $2; }') # bytes
367 ramdisk_size=$((($ramdisk_size + 1023) / 1024)) # kilobytes
369 echo "$FULL_VERSION_STRING" >$ISOFS/pl_version
374 #################### plain ISO
375 function build_iso() {
376 local iso="$1" ; shift
379 # Write isolinux configuration
380 cat >$ISOFS/isolinux.cfg <<EOF
381 ${console_serial_line}
383 APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img${custom:+,custom.img} root=/dev/ram0 rw ${KERNEL_ARGS}
390 echo "* Creating ISO image"
391 mkisofs -o "$iso" $MKISOFS_OPTS $ISOFS
394 #################### USB with partitions
395 function build_usb_partition() {
396 echo -n "* Creating USB image with partitions..."
397 local usb="$1" ; shift
400 local size=$(($(du -Lsk $ISOFS | awk '{ print $1; }') + $FREE_SPACE))
401 size=$(( $size / 1024 ))
405 local cylinders=$(( ($size*1024*2)/($heads*$sectors) ))
406 local offset=$(( $sectors*512 ))
408 if [ -f /usr/lib/syslinux/mkdiskimage ] ; then
409 /usr/lib/syslinux/mkdiskimage -M -4 "$usb" $size $heads $sectors
411 mkdiskimage -M -4 "$usb" $size $heads $sectors
414 cat >${BUILDTMP}/mtools.conf<<EOF
424 # environment variable for mtools
425 export MTOOLSRC="${BUILDTMP}/mtools.conf"
427 ### COPIED FROM build_usb() below!!!!
428 echo -n " populating USB image... "
429 mcopy -bsQ -i "$usb" "$ISOFS"/* z:/
431 # Use syslinux instead of isolinux to make the image bootable
432 tmp="${BUILDTMP}/syslinux.cfg"
434 ${console_serial_line}
436 APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img${custom:+,custom.img} root=/dev/ram0 rw ${KERNEL_ARGS}
441 mdel -i "$usb" z:/isolinux.cfg 2>/dev/null || :
442 mcopy -i "$usb" "$tmp" z:/syslinux.cfg
447 echo "making USB image bootable."
448 syslinux -o $offset "$usb"
452 #################### plain USB
453 function build_usb() {
454 echo -n "* Creating USB image... "
455 local usb="$1" ; shift
459 mkfs.vfat -C "$usb" $(($(du -Lsk $ISOFS | awk '{ print $1; }') + $FREE_SPACE))
461 cat >${BUILDTMP}/mtools.conf<<EOF
464 # environment variable for mtools
465 export MTOOLSRC="${BUILDTMP}/mtools.conf"
468 echo -n " populating USB image... "
469 mcopy -bsQ -i "$usb" "$ISOFS"/* ::/
471 # Use syslinux instead of isolinux to make the image bootable
472 tmp="${BUILDTMP}/syslinux.cfg"
474 ${console_serial_line}
476 APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img${custom:+,custom.img} root=/dev/ram0 rw ${KERNEL_ARGS}
481 mdel -i "$usb" ::/isolinux.cfg 2>/dev/null || :
482 mcopy -i "$usb" "$tmp" ::/syslinux.cfg
487 echo "making USB image bootable."
491 #################### utility to setup CRAMFS related support
492 function prepare_cramfs() {
493 [ -n "$CRAMFS_PREPARED" ] && return 0
496 echo "* Setting up CRAMFS-based images"
497 local tmp="${BUILDTMP}/cramfs-tree"
499 push_cleanup rm -rf $tmp
501 gzip -d -c $ISOFS/bootcd.img | cpio -diu
502 gzip -d -c $ISOFS/overlay.img | cpio -diu
503 [ -n "$custom" ] && \
504 gzip -d -c $ISOFS/custom.img | cpio -diu
506 # clean out unnecessary rpm lib
507 echo "* clearing var/lib/rpm/*"
510 # bootcd requires this directory
511 mkdir -p mnt/confdevice
513 # relocate various directory to /tmp
515 ln -fs /tmp/root root
516 ln -fs /sbin/init linuxrc
517 ln -fs /tmp/resolv.conf etc/resolv.conf
518 ln -fs /tmp/etc/mtab etc/mtab
520 # have pl_rsysinit copy over appropriate etc & var directories into /tmp/etc/
522 echo "* renaming dirs in ./etc"
524 for dir in `find * -type d -prune | grep -v rc.d`; do
526 ln -fs /tmp/etc/${dir} ${dir}
530 echo "* renaming dirs in ./var"
531 # rename all top-level directories and put in a symlink to /tmp/var
533 for dir in `find * -type d -prune`; do
535 ln -fs /tmp/var/${dir} ${dir}
539 # overwrite fstab to mount / as cramfs and /tmp as tmpfs
540 echo "* Overwriting etc/fstab to use cramfs and tmpfs"
542 cat >./etc/fstab <<EOF
543 /dev/ram0 / cramfs ro 0 0
544 none /dev/pts devpts gid=5,mode=620 0 0
545 none /proc proc defaults 0 0
546 none /sys sysfs defaults 0 0
552 #for i in 0 1 2 3 4 5 6 7 8; do rm -f ram${i} ; done
553 #for i in 0 1 2 3 4 5 6 7 8; do mknod ram${i} b 1 ${i} ; done
558 # update etc/inittab to start with pl_rsysinit
559 for file in etc/inittab etc/event.d/rcS etc/init/rcS.conf; do
560 [ -f $file ] && sed -i 's,pl_sysinit,pl_rsysinit,' $file
563 # modify inittab to have a serial console
564 # xxx this might well be broken with f12 and above xxx
565 if [ -n "$serial" ] ; then
566 echo "T0:23:respawn:/sbin/agetty -L $console_dev $console_baud vt100" >> etc/inittab
567 # and let root log in
568 echo "$console_dev" >> etc/securetty
571 # calculate the size of /tmp based on the size of /etc & /var + 8MB slack
572 etcsize=$(du -s ./etc | awk '{ print $1 }')
573 varsize=$(du -s ./var | awk '{ print $1 }')
574 let msize=($varsize+$etcsize+8192)/1024
576 # make dhclient happy
577 for i in $(seq 0 9); do ln -fs /tmp/etc/dhclient-eth${i}.conf etc/dhclient-eth${i}.conf ; done
578 ln -fs /tmp/etc/resolv.conf etc/resolv.conf
579 ln -fs /tmp/etc/resolv.conf.predhclient etc/resolv.conf.predhclient
581 # generate pl_rsysinit
582 cat > etc/rc.d/init.d/pl_rsysinit <<EOF
584 # generated by $COMMAND
585 echo -n "pl_rsysinit: preparing /etc and /var for pl_sysinit..."
586 mount -t tmpfs -orw,size=${msize}M,mode=1777 tmpfs /tmp
589 touch /tmp/etc/resolv.conf
594 echo "tmpfs /tmp tmpfs rw,size=${msize}M,mode=1777 1 1" > /tmp/etc/mtab
596 # copy over directory contents of all _o directories from /etc and /var
597 # /tmp/etc and /tmp/var
599 for odir in \$(cd /etc && ls -d *_o); do dir=\$(echo \$odir | sed 's,\_o$,,'); (mkdir -p /tmp/etc/\$dir && cd \$odir && find . | cpio -p -d -u /tmp/etc/\$dir); done
602 for odir in \$(cd /var && ls -d *_o); do dir=\$(echo \$odir | sed 's,\_o$,,'); (mkdir -p /tmp/var/\$dir && cd \$odir && find . | cpio -p -d -u /tmp/var/\$dir); done
607 # hand over to pl_sysinit
608 echo "pl_rsysinit: handing over to pl_sysinit"
609 /etc/init.d/pl_sysinit
611 chmod +x etc/rc.d/init.d/pl_rsysinit
615 # create the cramfs image
616 echo "* Creating cramfs image"
617 mkfs.cramfs $tmp/ ${BUILDTMP}/cramfs.img
618 cramfs_size=$(($(du -sk ${BUILDTMP}/cramfs.img | awk '{ print $1; }') + 1))
623 #################### Create ISO CRAMFS image
624 function build_iso_cramfs() {
625 local iso="$1" ; shift
628 prepare_cramfs "$custom"
629 echo "* Creating ISO CRAMFS-based image"
631 local tmp="${BUILDTMP}/cramfs-iso"
633 push_cleanup rm -rf $tmp
634 (cd $ISOFS && find . | grep -v "\.img$" | cpio -p -d -u $tmp/)
635 cat >$tmp/isolinux.cfg <<EOF
636 ${console_serial_line}
638 APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro ${KERNEL_ARGS}
644 cp ${BUILDTMP}/cramfs.img $tmp
653 #################### Create USB CRAMFS based image
654 function build_usb_cramfs() {
655 local usb="$1" ; shift
658 prepare_cramfs "$custom"
659 echo "* Creating USB CRAMFS based image"
661 let vfat_size=${cramfs_size}+$FREE_SPACE
663 # Make VFAT filesystem for USB
664 mkfs.vfat -C "$usb" $vfat_size
667 echo "* Populating USB with overlay images and cramfs"
668 mcopy -bsQ -i "$usb" $ISOFS/kernel $ISOFS/pl_version ::/
669 mcopy -bsQ -i "$usb" ${BUILDTMP}/cramfs.img ::/
671 # Use syslinux instead of isolinux to make the image bootable
672 tmp="${BUILDTMP}/syslinux.cfg"
674 ${console_serial_line}
676 APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro ${KERNEL_ARGS}
682 mcopy -bsQ -i "$usb" "$tmp" ::/syslinux.cfg
685 echo "* Making USB CRAMFS based image bootable"
689 #################### map on all types provided on the command-line and invoke one of the above functions
690 function build_types () {
692 [ -z "$OUTPUT_BASE" ] && OUTPUT_BASE="$PLC_NAME-BootCD-$BOOTCD_VERSION"
694 # alter output filename to reflect serial settings
695 if [ -n "$IS_SERIAL" ] ; then
696 if [ "$CONSOLE_INFO" == "$SERIAL_CONSOLE" ] ; then
699 serial="-serial-$(echo $CONSOLE_INFO | sed -e 's,:,,g')"
705 function type_to_name() {
708 s/usb_partition$/-partition.usb/;
710 s/usb_cramfs$/-cramfs.usb/;
711 s/iso_cramfs$/-cramfs.iso/;
718 tname=`type_to_name $t`
719 # if -o is specified (as it has no default)
720 if [ -n "$OUTPUT_NAME" ] ; then
723 output="${OUTPUT_BASE}${serial}${tname}"
726 echo "*** Dealing with type=$arg"
727 echo '*' build_$t "$output" "$CUSTOM_DIR"
728 [ -n "$DRY_RUN" ] || build_$t "$output" "$CUSTOM_DIR"
735 parse_command_line "$@"
739 echo "* Building images for $FULL_VERSION_STRING"
740 # Do not tolerate errors
742 trap "do_cleanup" ERR INT EXIT
744 init_serial $CONSOLE_INFO