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 # turn this on to get systemd's full log on console (slows things down)
21 DEFAULT_TYPES="usb iso"
22 # Leave 4 MB of free space
23 GRAPHIC_CONSOLE="graphic"
24 SERIAL_CONSOLE="ttyS0:115200:n:8"
25 CONSOLE_INFO=$GRAPHIC_CONSOLE
26 MKISOFS_OPTS="-R -J -r -f -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table"
29 # command-line settable args
30 NODE_CONFIGURATION_FILE=
40 FULL_VERSION_STRING=""
48 console_serial_line=""
51 #################### compute all supported types
52 # removing support for serial in the type
53 # this is because kargs.txt goes in the overlay, that is computed only once
54 # so we cannot handle serial and graphic modes within the same invokation of this script
57 for x in iso usb usb_partition; do for c in "" "_cramfs" ; do
64 ALL_TYPES="$ALL_TYPES $t" ;;
68 #################### cleanup utilities
69 declare -a _CLEANUPS=()
70 function do_cleanup() {
71 cd / ; for i in "${_CLEANUPS[@]}"; do $i ; done
73 function push_cleanup() {
74 _CLEANUPS=( "${_CLEANUPS[@]}" "$*" )
76 function pop_cleanup() {
77 unset _CLEANUPS[$((${#_CLEANUPS[@]} - 1))]
80 #################### initialization
81 function init_and_check () {
83 # Change to our source directory
84 local srcdir=$(cd $DIRNAME && pwd -P)
88 ISOREF=$PWD/${VARIANT}
90 # The reference image is expected to have been built by prep.sh (see .spec)
91 # we disable the initial logic that called prep.sh if that was not the case
92 # this is because prep.sh needs to know pldistro
93 if [ ! -f $ISOREF/isofs/bootcd.img -o ! -f $ISOREF/version.txt ] ; then
94 echo "Could not find isofs and version.txt in $ISOREF"
95 if [ "$VARIANT" == "build" ] ; then
96 echo "You have to run prep.sh prior to calling $COMMAND"
98 echo "You need to create your variant image, see kvariant.sh"
104 # build/version.txt written by prep.sh
105 BOOTCD_VERSION=$(cat ${VARIANT}/version.txt)
107 if [ -f /etc/planetlab/plc_config ] ; then
108 # Source PLC configuration
109 . /etc/planetlab/plc_config
112 # use /var/tmp that should be large enough on both chroot- or vserver-based myplc
115 FULL_VERSION_STRING="${PLC_NAME} BootCD ${BOOTCD_VERSION}"
120 # the custom-dir feature is designed to let a myplc try/ship a patched bootcd
121 # without the need for a full devel environment
122 # for example, you would create /root/custom-bootcd/etc/rc.d/init.d/pl_hwinit
123 # and run this script with -C /root/custom-bootcd
124 # this creates a third .img image of the custom dir, that 'hides' the files from
125 # bootcd.img in the resulting unionfs
126 # it seems that this feature has not been used nor tested in a long time, use with care
129 echo "Usage: $COMMAND [OPTION]..."
130 echo " -f plnode.txt Node to customize CD for (default: none)"
131 echo " -t 'types' Build the specified images (default: $DEFAULT_TYPES)"
132 echo " NOTE: mentioning 'serial' as part of the type is not supported anymore"
133 echo " -a Build all known types as listed below"
134 echo " -s console-info Enable a serial line as console and also bring up getty on that line"
135 echo " console-info: tty:baud-rate:parity:bits"
136 echo " or 'default' shortcut for $SERIAL_CONSOLE"
137 echo " -S equivalent to -s default"
138 echo " -O output-base The prefix of the generated files (default: PLC_NAME-BootCD-VERSION)"
139 echo " useful when multiple types are provided"
140 echo " can be a full path"
141 echo " -o output-name The full name of the generated file"
142 echo " -C custom-dir Custom directory"
143 echo " -V variant Use a variant - see kvariant.sh"
144 echo " -n Dry run - mostly for debug/test purposes"
145 echo " -k Add additional parameters to the kargs.txt file"
146 echo " -h This message"
147 echo "All known types: $ALL_TYPES"
152 function parse_command_line () {
157 while getopts "f:t:as:SO:o:C:V:k:nh" opt ; do
159 f) NODE_CONFIGURATION_FILE=$OPTARG ;;
160 t) TYPES="$TYPES $OPTARG" ;;
161 a) TYPES="$ALL_TYPES" ;;
162 s) CONSOLE_INFO="$OPTARG" ;;
163 S) CONSOLE_INFO=$SERIAL_CONSOLE ;;
164 O) OUTPUT_BASE="$OPTARG" ;;
165 o) OUTPUT_NAME="$OPTARG" ;;
166 C) CUSTOM_DIR="$OPTARG" ;;
167 V) VARIANT="$OPTARG" ;;
168 k) KERNEL_ARGS="$KERNEL_ARGS $OPTARG" ;;
174 # use defaults if not set
175 [ -z "$TYPES" ] && TYPES="$DEFAULT_TYPES"
176 [ -z "$VARIANT" ] && VARIANT="build"
177 [ "$CONSOLE_INFO" == "default" ] && CONSOLE_INFO=$SERIAL_CONSOLE
179 if [ -n "$NODE_CONFIGURATION_FILE" ] ; then
180 # check existence of NODE_CONFIGURATION_FILE and normalize as we will change directory
181 if [ ! -f "$NODE_CONFIGURATION_FILE" ] ; then
182 echo "Node configuration file $NODE_CONFIGURATION_FILE not found - exiting"
185 cf_dir="$(dirname $NODE_CONFIGURATION_FILE)"
186 cf_dir="$(cd $cf_dir; pwd -P)"
187 cf_file="$(basename $NODE_CONFIGURATION_FILE)"
188 NODE_CONFIGURATION_FILE="$cf_dir"/"$cf_file"
192 local matcher="XXX$(echo $ALL_TYPES | sed -e 's,\W,XXX,g')XXX"
194 echo Checking type $t
195 echo $matcher | grep XXX${t}XXX &> /dev/null
196 if [ "$?" != 0 ] ; then
205 function init_serial () {
206 local console=$1; shift
207 if [ "$console" == "$GRAPHIC_CONSOLE" ] ; then
210 echo "Standard, graphic, non-serial mode"
213 console_dev=$(echo "$console" | awk -F: ' {print $1}')
214 console_baud=$(echo "$console" | awk -F: ' {print $2}')
215 [ -z "$console_baud" ] && console_baud="115200"
216 local console_parity=$(echo "$console" | awk -F: ' {print $3}')
217 [ -z "$console_parity" ] && console_parity="n"
218 local console_bits=$(echo "$console" | awk -F: ' {print $4}')
219 [ -z "$console_bits" ] && console_bits="8"
220 console_spec="console=${console_dev},${console_baud}${console_parity}${console_bits}"
221 local tty_nb=$(echo $console_dev | sed -e 's,[a-zA-Z],,g')
222 console_serial_line="SERIAL ${tty_nb} ${console_baud}"
224 echo "console_serial_line=${console_serial_line}"
225 echo "console_spec=${console_spec}"
229 #################### run once : build the overlay image
230 function build_overlay () {
232 BUILDTMP=$(mktemp -d ${BUILDTMP}/bootcd.XXXXXX)
233 push_cleanup rm -fr "${BUILDTMP}"
234 mkdir "${BUILDTMP}/isofs"
235 for i in "$ISOREF"/isofs/{bootcd.img,kernel}; do
236 ln -s "$i" "${BUILDTMP}/isofs"
238 # the syslinux that comes with f12 has this file in a new location
239 cp "/usr/lib/syslinux/isolinux.bin" "${BUILDTMP}/isofs" \
240 || cp "/usr/share/syslinux/isolinux.bin" "${BUILDTMP}/isofs"
241 ISOFS="${BUILDTMP}/isofs"
243 # Root of the ISO and USB images
244 echo "* Populating root filesystem..."
245 OVERLAY="${BUILDTMP}/overlay"
246 install -d -m 755 $OVERLAY
247 push_cleanup rm -fr $OVERLAY
249 # Create version files
250 echo "* Creating version files"
252 # Boot Manager compares pl_version in both places to make sure that
253 # the right CD is mounted. We used to boot from an initrd and mount
254 # the CD on /usr. Now we just run everything out of the initrd.
255 for file in $OVERLAY/pl_version $OVERLAY/usr/isolinux/pl_version ; do
256 mkdir -p $(dirname $file)
257 echo "$FULL_VERSION_STRING" >$file
260 # Install boot server configuration files
261 echo "* Installing boot server configuration files"
263 # We always intended to bring up and support backup boot servers,
264 # but never got around to it. Just install the same parameters for
266 for dir in $OVERLAY/usr/boot $OVERLAY/usr/boot/backup ; do
267 install -D -m 644 $PLC_BOOT_CA_SSL_CRT $dir/cacert.pem
268 install -D -m 644 $PLC_ROOT_GPG_KEY_PUB $dir/pubring.gpg
269 echo "$PLC_BOOT_HOST" >$dir/boot_server
270 echo "$PLC_BOOT_SSL_PORT" >$dir/boot_server_port
271 echo "/boot/" >$dir/boot_server_path
274 # Install old-style boot server configuration files
275 # as opposed to what a former comment suggested,
276 # this is still required, somewhere in the bootmanager apparently
277 install -D -m 644 $PLC_BOOT_CA_SSL_CRT $OVERLAY/usr/bootme/cacert/$PLC_BOOT_HOST/cacert.pem
278 echo "$FULL_VERSION_STRING" >$OVERLAY/usr/bootme/ID
279 echo "$PLC_BOOT_HOST" >$OVERLAY/usr/bootme/BOOTSERVER
280 echo "$PLC_BOOT_HOST" >$OVERLAY/usr/bootme/BOOTSERVER_IP
281 echo "$PLC_BOOT_SSL_PORT" >$OVERLAY/usr/bootme/BOOTPORT
283 # Generate /etc/issue
284 echo "* Generating /etc/issue"
286 if [ "$PLC_WWW_PORT" = "443" ] ; then
287 PLC_WWW_URL="https://$PLC_WWW_HOST/"
288 elif [ "$PLC_WWW_PORT" != "80" ] ; then
289 PLC_WWW_URL="http://$PLC_WWW_HOST:$PLC_WWW_PORT/"
291 PLC_WWW_URL="http://$PLC_WWW_HOST/"
294 mkdir -p $OVERLAY/etc
295 cat >$OVERLAY/etc/issue <<EOF
301 This machine is a node in the $PLC_NAME distributed network. It has
302 not fully booted yet. If you have cancelled the boot process at the
303 request of $PLC_NAME Support, please follow the instructions provided
304 to you. Otherwise, please contact $PLC_MAIL_SUPPORT_ADDRESS.
306 Console login at this point is restricted to root. Provide the root
307 password of the default $PLC_NAME Central administrator account at the
308 time that this CD was created.
313 echo "* Setting root password"
315 if [ -z "$ROOT_PASSWORD" ] ; then
316 # Generate an encrypted password with crypt() if not defined
317 # in a static configuration.
318 ROOT_PASSWORD=$(python <<EOF
319 import crypt, random, string
320 salt = [random.choice(string.letters + string.digits + "./") for i in range(0,8)]
321 print crypt.crypt('$PLC_ROOT_PASSWORD', '\$1\$' + "".join(salt) + '\$')
326 # build/passwd copied out by prep.sh
327 sed -e "s@^root:[^:]*:\(.*\)@root:$ROOT_PASSWORD:\1@" ${VARIANT}/passwd >$OVERLAY/etc/passwd
329 # Install node configuration file (e.g., if node has no floppy disk or USB slot)
330 if [ -f "$NODE_CONFIGURATION_FILE" ] ; then
331 echo "* Installing node configuration file $NODE_CONFIGURATION_FILE -> /usr/boot/plnode.txt of the bootcd image"
332 install -D -m 644 $NODE_CONFIGURATION_FILE $OVERLAY/usr/boot/plnode.txt
333 NODE_ID=$(source $NODE_CONFIGURATION_FILE; echo $NODE_ID)
334 echo "* Building network configuration for $NODE_ID"
335 plnet -- --root $OVERLAY --files-only --program BootCD $NODE_ID
338 [ -n "$IS_SERIAL" ] && KERNEL_ARGS="$KERNEL_ARGS ${console_spec}"
340 # tmp: should be restricted to f15 nodes and above
341 # making sure the network interfaces are still numbered eth0 and above
342 KERNEL_ARGS="$KERNEL_ARGS biosdevname=0"
343 # making sure selinux is turned off - somehow this is needed with lxc/f14
344 KERNEL_ARGS="$KERNEL_ARGS selinux=0"
345 # cannot use this mecahnism to set systemd default target because this applies to kexec boots as well
346 # # set default target for systemd
347 # KERNEL_ARGS="$KERNEL_ARGS systemd.unit=pl_boot.target"
348 # output more systemd-related messages on the console
349 KERNEL_ARGS="$KERNEL_ARGS systemd.log_target=console"
350 # this slows down system init but is very helpful when e.g. trying to run on a new distro
351 [ -n "$DEBUG_SYSTEMD" ] && KERNEL_ARGS="$KERNEL_ARGS systemd.log_level=debug systemd.journald.forward_to_console=1"
352 [ -n "$KERNEL_ARGS" ] && echo "$KERNEL_ARGS" > $OVERLAY/kargs.txt
354 # Pack overlay files into a compressed archive
355 echo "* Compressing overlay image"
356 (cd $OVERLAY && find . | cpio --quiet -c -o) | gzip -9 >$ISOFS/overlay.img
361 if [ -n "$CUSTOM_DIR" ]; then
362 echo "* Compressing custom image"
363 (cd "$CUSTOM_DIR" && find . | cpio --quiet -c -o) | gzip -9 >$ISOFS/custom.img
366 # Calculate ramdisk size (total uncompressed size of both archives)
367 ramdisk_size=$(gzip -l $ISOFS/bootcd.img $ISOFS/overlay.img ${CUSTOM_DIR:+$ISOFS/custom.img} | tail -1 | awk '{ print $2; }') # bytes
368 ramdisk_size=$((($ramdisk_size + 1023) / 1024)) # kilobytes
370 echo "$FULL_VERSION_STRING" >$ISOFS/pl_version
375 #################### plain ISO
376 function build_iso() {
377 local iso="$1" ; shift
380 # Write isolinux configuration
381 cat >$ISOFS/isolinux.cfg <<EOF
382 ${console_serial_line}
384 APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img${custom:+,custom.img} root=/dev/ram0 rw ${KERNEL_ARGS}
391 echo "* Creating ISO image"
392 mkisofs -o "$iso" $MKISOFS_OPTS $ISOFS
395 #################### USB with partitions
396 function build_usb_partition() {
397 echo -n "* Creating USB image with partitions..."
398 local usb="$1" ; shift
401 local size=$(($(du -Lsk $ISOFS | awk '{ print $1; }') + $FREE_SPACE))
402 size=$(( $size / 1024 ))
406 local cylinders=$(( ($size*1024*2)/($heads*$sectors) ))
407 local offset=$(( $sectors*512 ))
409 if [ -f /usr/lib/syslinux/mkdiskimage ] ; then
410 /usr/lib/syslinux/mkdiskimage -M -4 "$usb" $size $heads $sectors
412 mkdiskimage -M -4 "$usb" $size $heads $sectors
415 cat >${BUILDTMP}/mtools.conf<<EOF
425 # environment variable for mtools
426 export MTOOLSRC="${BUILDTMP}/mtools.conf"
428 ### COPIED FROM build_usb() below!!!!
429 echo -n " populating USB image... "
430 mcopy -bsQ -i "$usb" "$ISOFS"/* z:/
432 # Use syslinux instead of isolinux to make the image bootable
433 tmp="${BUILDTMP}/syslinux.cfg"
435 ${console_serial_line}
437 APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img${custom:+,custom.img} root=/dev/ram0 rw ${KERNEL_ARGS}
442 mdel -i "$usb" z:/isolinux.cfg 2>/dev/null || :
443 mcopy -i "$usb" "$tmp" z:/syslinux.cfg
448 echo "making USB image bootable."
449 syslinux -o $offset "$usb"
453 #################### plain USB
454 function build_usb() {
455 echo -n "* Creating USB image... "
456 local usb="$1" ; shift
460 mkfs.vfat -C "$usb" $(($(du -Lsk $ISOFS | awk '{ print $1; }') + $FREE_SPACE))
462 cat >${BUILDTMP}/mtools.conf<<EOF
465 # environment variable for mtools
466 export MTOOLSRC="${BUILDTMP}/mtools.conf"
469 echo -n " populating USB image... "
470 mcopy -bsQ -i "$usb" "$ISOFS"/* ::/
472 # Use syslinux instead of isolinux to make the image bootable
473 tmp="${BUILDTMP}/syslinux.cfg"
475 ${console_serial_line}
477 APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img${custom:+,custom.img} root=/dev/ram0 rw ${KERNEL_ARGS}
482 mdel -i "$usb" ::/isolinux.cfg 2>/dev/null || :
483 mcopy -i "$usb" "$tmp" ::/syslinux.cfg
488 echo "making USB image bootable."
492 #################### utility to setup CRAMFS related support
493 function prepare_cramfs() {
494 [ -n "$CRAMFS_PREPARED" ] && return 0
497 echo "* Setting up CRAMFS-based images"
498 local tmp="${BUILDTMP}/cramfs-tree"
500 push_cleanup rm -rf $tmp
502 gzip -d -c $ISOFS/bootcd.img | cpio -diu
503 gzip -d -c $ISOFS/overlay.img | cpio -diu
504 [ -n "$custom" ] && \
505 gzip -d -c $ISOFS/custom.img | cpio -diu
507 # clean out unnecessary rpm lib
508 echo "* clearing var/lib/rpm/*"
511 # bootcd requires this directory
512 mkdir -p mnt/confdevice
514 # relocate various directory to /tmp
516 ln -fs /tmp/root root
517 ln -fs /sbin/init linuxrc
518 ln -fs /tmp/resolv.conf etc/resolv.conf
519 ln -fs /tmp/etc/mtab etc/mtab
521 # have pl_rsysinit copy over appropriate etc & var directories into /tmp/etc/
523 echo "* renaming dirs in ./etc"
525 for dir in `find * -type d -prune | grep -v rc.d`; do
527 ln -fs /tmp/etc/${dir} ${dir}
531 echo "* renaming dirs in ./var"
532 # rename all top-level directories and put in a symlink to /tmp/var
534 for dir in `find * -type d -prune`; do
536 ln -fs /tmp/var/${dir} ${dir}
540 # overwrite fstab to mount / as cramfs and /tmp as tmpfs
541 echo "* Overwriting etc/fstab to use cramfs and tmpfs"
543 cat >./etc/fstab <<EOF
544 /dev/ram0 / cramfs ro 0 0
545 none /dev/pts devpts gid=5,mode=620 0 0
546 none /proc proc defaults 0 0
547 none /sys sysfs defaults 0 0
553 #for i in 0 1 2 3 4 5 6 7 8; do rm -f ram${i} ; done
554 #for i in 0 1 2 3 4 5 6 7 8; do mknod ram${i} b 1 ${i} ; done
559 # update etc/inittab to start with pl_rsysinit
560 for file in etc/inittab etc/event.d/rcS etc/init/rcS.conf; do
561 [ -f $file ] && sed -i 's,pl_sysinit,pl_rsysinit,' $file
564 # modify inittab to have a serial console
565 # xxx this might well be broken with f12 and above xxx
566 if [ -n "$serial" ] ; then
567 echo "T0:23:respawn:/sbin/agetty -L $console_dev $console_baud vt100" >> etc/inittab
568 # and let root log in
569 echo "$console_dev" >> etc/securetty
572 # calculate the size of /tmp based on the size of /etc & /var + 8MB slack
573 etcsize=$(du -s ./etc | awk '{ print $1 }')
574 varsize=$(du -s ./var | awk '{ print $1 }')
575 let msize=($varsize+$etcsize+8192)/1024
577 # make dhclient happy
578 for i in $(seq 0 9); do ln -fs /tmp/etc/dhclient-eth${i}.conf etc/dhclient-eth${i}.conf ; done
579 ln -fs /tmp/etc/resolv.conf etc/resolv.conf
580 ln -fs /tmp/etc/resolv.conf.predhclient etc/resolv.conf.predhclient
582 # generate pl_rsysinit
583 cat > etc/rc.d/init.d/pl_rsysinit <<EOF
585 # generated by $COMMAND
586 echo -n "pl_rsysinit: preparing /etc and /var for pl_sysinit..."
587 mount -t tmpfs -orw,size=${msize}M,mode=1777 tmpfs /tmp
590 touch /tmp/etc/resolv.conf
595 echo "tmpfs /tmp tmpfs rw,size=${msize}M,mode=1777 1 1" > /tmp/etc/mtab
597 # copy over directory contents of all _o directories from /etc and /var
598 # /tmp/etc and /tmp/var
600 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
603 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
608 # hand over to pl_sysinit
609 echo "pl_rsysinit: handing over to pl_sysinit"
610 /etc/init.d/pl_sysinit
612 chmod +x etc/rc.d/init.d/pl_rsysinit
616 # create the cramfs image
617 echo "* Creating cramfs image"
618 mkfs.cramfs $tmp/ ${BUILDTMP}/cramfs.img
619 cramfs_size=$(($(du -sk ${BUILDTMP}/cramfs.img | awk '{ print $1; }') + 1))
624 #################### Create ISO CRAMFS image
625 function build_iso_cramfs() {
626 local iso="$1" ; shift
629 prepare_cramfs "$custom"
630 echo "* Creating ISO CRAMFS-based image"
632 local tmp="${BUILDTMP}/cramfs-iso"
634 push_cleanup rm -rf $tmp
635 (cd $ISOFS && find . | grep -v "\.img$" | cpio -p -d -u $tmp/)
636 cat >$tmp/isolinux.cfg <<EOF
637 ${console_serial_line}
639 APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro ${KERNEL_ARGS}
645 cp ${BUILDTMP}/cramfs.img $tmp
654 #################### Create USB CRAMFS based image
655 function build_usb_cramfs() {
656 local usb="$1" ; shift
659 prepare_cramfs "$custom"
660 echo "* Creating USB CRAMFS based image"
662 let vfat_size=${cramfs_size}+$FREE_SPACE
664 # Make VFAT filesystem for USB
665 mkfs.vfat -C "$usb" $vfat_size
668 echo "* Populating USB with overlay images and cramfs"
669 mcopy -bsQ -i "$usb" $ISOFS/kernel $ISOFS/pl_version ::/
670 mcopy -bsQ -i "$usb" ${BUILDTMP}/cramfs.img ::/
672 # Use syslinux instead of isolinux to make the image bootable
673 tmp="${BUILDTMP}/syslinux.cfg"
675 ${console_serial_line}
677 APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro ${KERNEL_ARGS}
683 mcopy -bsQ -i "$usb" "$tmp" ::/syslinux.cfg
686 echo "* Making USB CRAMFS based image bootable"
690 #################### map on all types provided on the command-line and invoke one of the above functions
691 function build_types () {
693 [ -z "$OUTPUT_BASE" ] && OUTPUT_BASE="$PLC_NAME-BootCD-$BOOTCD_VERSION"
695 # alter output filename to reflect serial settings
696 if [ -n "$IS_SERIAL" ] ; then
697 if [ "$CONSOLE_INFO" == "$SERIAL_CONSOLE" ] ; then
700 serial="-serial-$(echo $CONSOLE_INFO | sed -e 's,:,,g')"
706 function type_to_name() {
709 s/usb_partition$/-partition.usb/;
711 s/usb_cramfs$/-cramfs.usb/;
712 s/iso_cramfs$/-cramfs.iso/;
719 tname=`type_to_name $t`
720 # if -o is specified (as it has no default)
721 if [ -n "$OUTPUT_NAME" ] ; then
724 output="${OUTPUT_BASE}${serial}${tname}"
727 echo "*** Dealing with type=$arg"
728 echo '*' build_$t "$output" "$CUSTOM_DIR"
729 [ -n "$DRY_RUN" ] || build_$t "$output" "$CUSTOM_DIR"
736 parse_command_line "$@"
740 echo "* Building images for $FULL_VERSION_STRING"
741 # Do not tolerate errors
743 trap "do_cleanup" ERR INT EXIT
745 init_serial $CONSOLE_INFO