16551cf376ba1dbe46c292bb1f64f7ae53f58dad
[grml-live.git] / grml-live
1 #!/bin/bash
2 # Filename:      grml-live
3 # Purpose:       build process script for generating a (grml based) Linux Live-ISO
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2 or any later version.
7 # Latest change: Wed Oct 24 10:11:02 CEST 2007 [mika]
8 ################################################################################
9
10 # read configuration files, set some misc variables {{{
11
12 export LANG=C
13 export LC_ALL=C
14
15 # exit on any error:
16 set -e
17
18 GRML_LIVE_VERSION='0.0.7'
19
20 # we need root permissions for the build-process:
21 if [ "$(id -u 2>/dev/null)" != 0 ] ; then
22    echo "Error: please run this script with uid 0 (root)." >&2
23    exit 1
24 fi
25
26 if [ -r /var/run/fai/FAI_INSTALLATION_IN_PROGRESS ] ; then
27    echo "/usr/sbin/fai already running or was aborted before.">&2
28    echo "You may remove /var/run/fai/FAI_INSTALLATION_IN_PROGRESS and try again.">&2
29    exit 1
30 fi
31
32 # make sure they are not set by default
33 VERBOSE=''
34 FORCE=''
35
36 if [ -r /etc/grml/lsb-functions ] ; then
37    . /etc/grml/lsb-functions
38 else
39    einfo()  { echo "  [*] $*" ;}
40    eerror() { echo "  [!] $*">&2 ;}
41    ewarn()  { echo "  [x] $*" ;}
42    eend()   { return 0 ;}
43 fi
44
45 # source main configuration file:
46 LIVE_CONF=/etc/grml/grml-live.conf
47 . $LIVE_CONF
48
49 PN=$(basename $0)
50 # }}}
51
52 # clean exit {{{
53 bailout() {
54   [ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
55   [ -n "$1" ] && EXIT="$1" || EXIT="1"
56   [ -n "$2" ] && eerror "$2">&2
57   exit "$EXIT"
58 }
59 trap bailout 1 2 3 15
60 # }}}
61
62 # check for important variables {{{
63 [ -n "$GRML_FAI_CONFIG" ] || GRML_FAI_CONFIG=/etc/grml/fai
64 [ -n "$HOSTNAME" ] || HOSTNAME=grml
65 [ -n "$USERNAME" ] || USERNAME=grml
66 [ -n "$CLASSES" ]  || CLASSES="GRML,I386"
67 [ -n "$BOOT_METHOD" ] || BOOT_METHOD='isolinux'
68 [ -n "$OUTPUT" ] || bailout 1 "${PN}: \$OUTPUT not specified. Please adjust $LIVE_CONF. Exiting."
69
70 [ -n "$VERSION" ]  || VERSION="0.0.1"
71 [ -n "$RELEASENAME" ] || RELEASENAME="grml-live rocks"
72 [ -n "$GRML_NAME" ] || GRML_NAME='grml'
73
74 [ -d /var/log/fai/dirinstall/"${HOSTNAME}" ] || mkdir -p /var/log/fai/dirinstall/${HOSTNAME}
75 if [ -d /var/log/fai/dirinstall/"${HOSTNAME}" ] ; then
76    LOGFILE=/var/log/fai/dirinstall/${HOSTNAME}/grml-live.log
77 else
78    LOGFILE="$LOGDIR/grml-live.log"
79 fi
80
81 NFSROOT_CONF=/etc/grml/fai/make-fai-nfsroot.conf
82
83 # }}}
84
85 # some important functions {{{
86
87 # log output:
88 # usage: log "string to log"
89 log() { echo "$*" >> $LOGFILE ; }
90
91 # cut string at character number int = $1
92 # usage: cut_string 5 "1234567890" will output "12345"
93 cut_string() {
94   [ -n "$2" ] || return 1
95   echo "$2" | head -c "$1"; echo -ne "\n"
96 }
97
98 # prepend int = $1 spaces before string = $2
99 # usage: extend_string_begin 5 "123" will output "  123"
100 extend_string_begin() {
101   [ -n "$2" ] || return 1
102   local COUNT="$(echo $2 | wc -c)"
103   local FILL="$(expr $COUNT - $1)"
104   while [ "$FILL" -gt 1 ] ; do
105     echo -n " "
106     local FILL=$(expr $FILL - 1)
107   done
108   while [ "$FILL" -lt 1 ] ; do
109     echo -n " "
110     local FILL=$(expr $FILL + 1)
111   done
112   echo "$2" | head -c "$1"; echo -ne "\n"
113 }
114
115 # append int = $1 spaces to string = $2
116 # usage: extend_string_begin 5 "123" will output "123  "
117 extend_string_end() {
118   [ -n "$2" ] || return 1
119   echo -n "$2" | head -c "$1"
120   local COUNT="$(echo $2 | wc -c)"
121   local FILL="$(expr $COUNT - $1)"
122   while [ "$FILL" -gt 1 ] ; do
123     echo -n " "
124     local FILL=$(expr $FILL - 1)
125   done
126   while [ "$FILL" -lt 1 ] ; do
127     echo -n " "
128     local FILL=$(expr $FILL + 1)
129   done
130   echo -ne "\n"
131 }
132 # }}}
133
134 # usage information {{{
135 usage()
136 {
137   echo "
138 $PN - build process script for generating a (grml based) Linux Live-ISO
139
140 Usage: $PN [-a <architecture>] [-c <classe[s]>] [-g <grml_name>] \\
141                  [-i <iso_name> ] [-o <output_directory>] [-s <suite>] \\
142                  [-t <template_directory>] [-s <suite>] \\
143                  [-v <version_number>] [-FVh]
144
145 Usage examples:
146
147     $PN
148     $PN -c GRMLBASE,GRML_SMALL,I386 -o /grml/
149     $PN -c GRMLBASE,GRML_MEDIUM,I386 -o /dev/shm/grml
150     $PN -c GRMLBASE,GRML_SMALL,I386 -g grml-small -v 1.0
151     $PN -c GRMLBASE,GRML_FULL,I386 -i grml_0.0-1.iso -v 0.0-1
152     $PN -c GRMLBASE,GRML_FULL,I386 -s sid -V -r 'grml-live rocks'
153
154 More details: man grml-live
155               /usr/share/doc/grml-live/grml-live.html
156
157 Please send your bug reports, feedback,.. to the grml-team.
158 http://grml.org/bugs/
159 "
160 }
161 # }}}
162
163 # command line parsing {{{
164
165 while getopts "a:c:g:i:o:r:s:t:v:FhV" opt; do
166   case "$opt" in
167     a) ARCH="$OPTARG" ;;
168     c) CLASSES="$OPTARG" ;;
169     g) GRML_NAME="$OPTARG" ;;
170     i) ISO_NAME="$OPTARG" ;;
171     o) OUTPUT="$OPTARG"
172        CHROOT_OUTPUT="$OUTPUT/grml_chroot"
173        BUILD_OUTPUT="$OUTPUT/grml_cd"
174        ISO_OUTPUT="$OUTPUT/grml_isos"
175        ;;
176     r) RELEASENAME="$OPTARG" ;;
177     s) SUITE="$OPTARG" ;;
178     t) TEMPLATE_DIRECTORY="$OPTARG";;
179     v) VERSION="$OPTARG" ;;
180     F) FORCE=1 ;;
181     h) usage ; bailout 0 ;;
182     V) VERBOSE="-v" ;;
183     ?) echo "invalid option -$OPTARG" >&2; bailout 1 ;;
184   esac
185 done
186 shift $(($OPTIND - 1))  # set ARGV to the first not parsed commandline parameter
187
188 echo "Executing grml-live $GRML_LIVE_VERSION using the commandline:" >> $LOGFILE
189 echo "$(basename $0) $@" >> $LOGFILE
190 # }}}
191
192 # some misc checks before executing FAI {{{
193 [ -n "$CLASSES" ] || bailout 1 "Error: \$CLASSES unset, please set it in $LIVE_CONF or
194 specify it on the command line using the -c option."
195 [ -n "$OUTPUT" ] || bailout 1 "Error: \$OUTPUT unset, please set it in $LIVE_CONF or
196 specify it on the command line using the -o option."
197 # }}}
198
199 # ask user whether the setup is ok {{{
200 if [ -z "$FORCE" ] ; then
201    echo
202    echo "${PN} [${GRML_LIVE_VERSION}]: check your configuration (or use -F to force execution):"
203    echo
204    echo "  FAI classes:       $CLASSES"
205    echo "  main directory:    $OUTPUT"
206    [ -n "$CHROOT_OUTPUT" ] && echo "  chroot target:     $CHROOT_OUTPUT"
207    [ -n "$BUILD_OUTPUT" ]  && echo "  build target:      $BUILD_OUTPUT"
208    [ -n "$ISO_OUTPUT" ]    && echo "  ISO target:        $ISO_OUTPUT"
209    [ -n "$GRML_NAME" ]     && echo "  grml name:         $GRML_NAME"
210    [ -n "$RELEASENAME" ]   && echo "  release name:      $RELEASENAME"
211    [ -n "$VERSION" ]       && echo "  grml version:      $VERSION"
212    [ -n "$SUITE" ]         && echo "  Debian suite:      $SUITE"
213    [ -n "$ARCH" ]          && echo "  Architecture:      $ARCH"
214    [ -n "$BOOT_METHOD" ]   && echo "  Boot method:       $BOOT_METHOD"
215    [ -n "$TEMPLATE_DIRECTORY" ] && echo "  Template files:    $TEMPLATE_DIRECTORY"
216    [ -n "$FAI_ARGS" ]      && echo "  additional arguments for FAI: $FAI_ARGS"
217    [ -n "$VERBOSE" ]       && echo "  Using VERBOSE mode."
218    echo
219    echo -n "Is this ok for you? [y/N] "
220    read a
221    if ! [ "$a" = 'y' -o "$a" = 'Y' ] ; then
222       bailout 1 "Exiting as requested."
223    fi
224    echo
225
226 fi
227
228 start_seconds=$(cut -d . -f 1 /proc/uptime)
229 log "------------------------------------------------------------------------------"
230 log "Starting grml-live run [$(date)]"
231 log "Executed command line: $0 $*"
232 # }}}
233
234 # on-the-fly configuration {{{
235 if [ -n "$MIRROR_DIRECTORY" ] ; then
236    if ! [ -d "$MIRROR_DIRECTORY/debian" ] ; then
237       log "Sorry, $MIRROR_DIRECTORY/debian does not seem to exist. Exiting. [$(date)]"
238       eerror "Sorry, $MIRROR_DIRECTORY/debian does not seem to exist. Exiting."
239       bailout 1
240    fi
241    echo "$MIRROR_SOURCES" > /etc/grml/fai/apt/sources.list
242    if [ -n "$GRML_LIVE_SOURCES" ] ; then
243       echo "$GRML_LIVE_SOURCES" >> /etc/grml/fai/apt/sources.list
244    fi
245 elif [ -n "$GRML_LIVE_SOURCES" ] ; then
246    echo "$GRML_LIVE_SOURCES" > /etc/grml/fai/apt/sources.list
247 fi
248
249 if [ -n "$FAI_DEBOOTSTRAP" ] ; then
250    sed -i "s#^FAI_DEBOOTSTRAP=.*#FAI_DEBOOTSTRAP=\"$FAI_DEBOOTSTRAP\"#" $NFSROOT_CONF
251 fi
252
253 # does this suck? YES!
254 if [ -n "$SUITE" ] ; then
255    sed -i "s/SUITE=.*/SUITE=\"$SUITE\"/" $LIVE_CONF
256
257    DIST="\|\ etch\ \|\ stable\ \|\ lenny\ \|\ testing\ \|\ sid\ \|\ unstable\ "
258    sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" $LIVE_CONF
259    sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" /etc/grml/fai/apt/sources.list
260
261    sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" $LIVE_CONF
262    sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" $NFSROOT_CONF
263 fi
264
265 # set $ARCH
266 [ -n "$ARCH" ] || ARCH="$(dpkg --print-architecture)"
267 if grep -q -- 'FAI_DEBOOTSTRAP_OPTS.*--arch' $NFSROOT_CONF ; then
268    sed -i "s/--arch [a-z0-9]* /--arch $ARCH /" $NFSROOT_CONF
269 else
270    sed -i "s|FAI_DEBOOTSTRAP_OPTS=\"\(.*\)|FAI_DEBOOTSTRAP_OPTS=\"--arch $ARCH \1|" $NFSROOT_CONF
271 fi
272 # }}}
273
274 # CHROOT_OUTPUT - execute FAI {{{
275 [ -n "$CHROOT_OUTPUT" ] || CHROOT_OUTPUT="$OUTPUT/grml_chroot"
276
277 if [ -d "$CHROOT_OUTPUT/bin" ] ; then
278    log "$CHROOT_OUTPUT exists already, skipping stage 'fai dirinstall'"
279    ewarn "$CHROOT_OUTPUT exists already, skipping stage 'fai dirinstall'" ; eend 0
280 else
281    mkdir -p "$CHROOT_OUTPUT" || bailout 5 "Problem with creating $CHROOT_OUTPUT for FAI"
282    if [ -n "${MIRROR_DIRECTORY}" ] ; then
283       mkdir -p "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
284       mount --bind "${MIRROR_DIRECTORY}" "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
285    fi
286    fai $VERBOSE -C "$GRML_FAI_CONFIG" -c"$CLASSES" -u "$HOSTNAME" dirinstall "$CHROOT_OUTPUT" $FAI_ARGS | tee -a $LOGFILE
287    umount $CHROOT_OUTPUT/proc 2>/dev/null || /bin/true
288    umount $CHROOT_OUTPUT/sys  2>/dev/null || /bin/true
289    [ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
290
291    # notice: 'fai dirinstall' does not seem to exit appropriate, so:
292    ERROR=''
293    if [ -r "/var/log/fai/dirinstall/$HOSTNAME/software.log" ] ; then
294       # 1 errors during executing of commands
295       # Unable to write mmap - msync (28 No space left on device)
296       grep 'dpkg: error processing' /var/log/fai/dirinstall/$HOSTNAME/software.log >> $LOGFILE && ERROR=1
297       grep 'E: Method http has died unexpectedly!' /var/log/fai/dirinstall/$HOSTNAME/software.log >> $LOGFILE && ERROR=2
298       grep 'ERROR: chroot' /var/log/fai/dirinstall/$HOSTNAME/software.log >> $LOGFILE && ERROR=3
299    fi
300
301    if [ -r "/var/log/fai/dirinstall/$HOSTNAME/shell.log" ] ; then
302       grep 'FAILED with exit code' /var/log/fai/dirinstall/$HOSTNAME/shell.log >> $LOGFILE && ERROR=2
303    fi
304
305    if [ -n "$ERROR" ] ; then
306       log "There was an error [${ERROR}] during execution of stage 'fai dirinstall' [$(date)]"
307       eerror "There was an error during execution of stage 'fai dirinstall'"
308       echo "   Check out /var/log/fai/dirinstall/$HOSTNAME/ for details. [exit ${ERROR}]"
309       eend 1
310       bailout 1
311    else
312       log "Finished execution of stage 'fai dirinstall' [$(date)]"
313       einfo "Finished execution of stage 'fai dirinstall'"
314    fi
315 fi
316 # }}}
317
318 # BUILD_OUTPUT - execute arch specific stuff and squashfs {{{
319 [ -n "$BUILD_OUTPUT" ] || BUILD_OUTPUT="$OUTPUT/grml_cd"
320 mkdir -p "$BUILD_OUTPUT" || bailout 6 "Problem with creating $BUILD_OUTPUT for stage ARCH"
321
322 # i386:
323 if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
324    if [ -d "$BUILD_OUTPUT"/boot ] ; then
325       log "$BUILD_OUTPUT/boot exists already, skipping stage 'boot'"
326       ewarn "$BUILD_OUTPUT/boot exists already, skipping stage 'boot'" ; eend 0
327    else
328       # booting stuff:
329       mkdir -p "$BUILD_OUTPUT"/boot/isolinux
330       cp /boot/memtest86+.bin "$BUILD_OUTPUT"/boot/isolinux/memtest
331
332       # if we don't have an initrd we a) can't boot and b) there was an error
333       # during build, so check for the file:
334       if [ -f "$CHROOT_OUTPUT"/boot/initrd* ] ; then
335          cp "$CHROOT_OUTPUT"/boot/initrd*  "$BUILD_OUTPUT"/boot/isolinux/initrd.gz
336       else
337          log "No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting"
338          eerror "No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1
339          bailout 10
340       fi
341
342       cp "$CHROOT_OUTPUT"/boot/vmlinuz*                    "$BUILD_OUTPUT"/boot/isolinux/linux26
343       cp /usr/lib/syslinux/chain.c32                       "$BUILD_OUTPUT"/boot/isolinux/
344       cp /usr/lib/syslinux/isolinux.bin                    "$BUILD_OUTPUT"/boot/isolinux/
345       cp /usr/lib/syslinux/memdisk                         "$BUILD_OUTPUT"/boot/isolinux/
346       cp /usr/lib/syslinux/menu.c32                        "$BUILD_OUTPUT"/boot/isolinux/
347
348       [ -n "$TEMPLATE_DIRECTORY" ] || TEMPLATE_DIRECTORY='/usr/share/grml-live/templates'
349       if ! [ -d "${TEMPLATE_DIRECTORY}"/boot ] ; then
350          log "${TEMPLATE_DIRECTORY}/boot does not exist. Exiting."
351          eerror "${TEMPLATE_DIRECTORY}/boot does not exist. Exiting." ; eend 1
352          bailout 8
353       fi
354       cp ${TEMPLATE_DIRECTORY}/boot/isolinux/*               "$BUILD_OUTPUT"/boot/isolinux/
355       cp ${TEMPLATE_DIRECTORY}/boot/isolinux/*               "$BUILD_OUTPUT"/boot/isolinux/
356       cp -a ${TEMPLATE_DIRECTORY}/boot/grub                  "$BUILD_OUTPUT"/boot/
357
358       if ! [ -d "${TEMPLATE_DIRECTORY}"/GRML ] ; then
359          log "${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting."
360          eerror "${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting." ; eend 1
361          bailout 9
362       fi
363       [ -d "$BUILD_OUTPUT"/GRML ] || mkdir "$BUILD_OUTPUT"/GRML
364       cp -a ${TEMPLATE_DIRECTORY}/GRML/* "$BUILD_OUTPUT"/GRML/
365
366       # adjust boot splash information:
367       ISO_DATE="$(date +%Y-%m-%d)"
368       RELEASE_INFO="$GRML_NAME $VERSION - Release Codename $RELEASENAME"
369       RELEASE_INFO="$(cut_string 68 "$RELEASE_INFO")"
370       RELEASE_INFO="$(extend_string_end 68 "$RELEASE_INFO")"
371
372       sed -i "s/%RELEASE_INFO%/$GRML_NAME $VERSION - $RELEASENAME/" "$BUILD_OUTPUT"/GRML/grml-version
373       sed -i "s/%DATE%/$ISO_DATE/"             "$BUILD_OUTPUT"/GRML/grml-version
374
375       sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_OUTPUT"/boot/isolinux/boot.msg
376       sed -i "s/%DATE%/$ISO_DATE/"             "$BUILD_OUTPUT"/boot/isolinux/boot.msg
377
378       sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_OUTPUT"/boot/isolinux/boot-beep.msg
379       sed -i "s/%DATE%/$ISO_DATE/"             "$BUILD_OUTPUT"/boot/isolinux/boot-beep.msg
380
381       sed -i "s/%VERSION%/$VERSION/"           "$BUILD_OUTPUT"/boot/grub/menu.lst
382       sed -i "s/%GRML_NAME%/$GRML_NAME/"       "$BUILD_OUTPUT"/boot/grub/menu.lst
383
384       # autostart for Windows:
385       if [ -d "${TEMPLATE_DIRECTORY}/windows/autostart/" ] ; then
386          cp ${TEMPLATE_DIRECTORY}/windows/autostart/* "$BUILD_OUTPUT"/
387       fi
388       # windows-binaries:
389       if [ -n "$WINDOWS_BINARIES" ] ; then
390          if [ -f "$BUILD_OUTPUT"/windows/putty.exe ] ; then
391             log "$BUILD_OUTPUT/windows exists already, skipping stage 'WINDOWS_BINARIES'"
392             ewarn "$BUILD_OUTPUT/windows exists already, skipping stage 'WINDOWS_BINARIES'" ; eend 0
393          else
394             mkdir "$BUILD_OUTPUT"/windows
395             ( cd "$BUILD_OUTPUT"/windows
396               for file in pageant plink pscp psftp putty puttygen ; do
397                  wget -O ${file}.exe ${WINDOWS_BINARIES}/${file}.exe
398               done )
399          fi
400       log "Finished execution of stage 'WINDOWS_BINARIES' [$(date)]"
401       einfo "Finished execution of stage 'WINDOWS_BINARIES'" ; eend 0
402       fi
403    einfo "Finished execution of stage 'boot'" ; eend 0
404    fi
405 # ppc:
406 elif [ "$ARCH" = powerpc ] ; then
407     ewarn 'Warning: formorer, it is your turn. :)'>&2
408 # unsuported:
409 else
410    eerror 'Error: Unsupported ARCH, sorry. Want to support it? Contribute!' ; eend 1
411 fi
412
413 if [ -f "$BUILD_OUTPUT"/live/grml.squashfs ] ; then
414    log "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs'"
415    ewarn "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs'" ; eend 0
416 else
417    mkdir "$BUILD_OUTPUT"/live
418    mksquashfs $CHROOT_OUTPUT/* $BUILD_OUTPUT/live/grml.squashfs -noappend
419    log "Finished execution of stage 'squashfs' [$(date)]"
420    einfo "Finished execution of stage 'squashfs'" ; eend 0
421 fi
422
423 # create md5sum file:
424 ( cd $BUILD_OUTPUT/GRML &&
425 find .. -type f -not -name md5sums -not -name isolinux.bin -exec md5sum {} \; > md5sums )
426 # }}}
427
428 # ISO_OUTPUT - mkisofs {{{
429 [ -n "$ISO_OUTPUT" ] || ISO_OUTPUT="$OUTPUT/grml_isos"
430 [ -n "$ISO_NAME" ] || ISO_NAME="${GRML_NAME}_${VERSION}.iso"
431
432 if [ "$BOOT_METHOD" = "isolinux" ] ; then
433    BOOT_FILE="boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat"
434 elif [ "$BOOT_METHOD" = "grub" ] ; then
435    BOOT_FILE="boot/grub/stage2_eltorito"
436 fi
437
438 if [ -f "${ISO_OUTPUT}/${ISO_NAME}" ] ; then
439    log "$ISO_OUTPUT exists already, skipping stage 'iso build'"
440    ewarn "$ISO_OUTPUT exists already, skipping stage 'iso build'" ; eend 0
441 else
442    mkdir -p "$ISO_OUTPUT" || bailout 6 "Problem with creating $ISO_OUTPUT for stage 'iso build'"
443    CURRENT_DIR=$(pwd)
444    cd "$BUILD_OUTPUT" &&
445    mkisofs -V "grml $VERSION" -publisher 'grml-live | grml.org' \
446            -l -r -J -no-emul-boot -boot-load-size 4 -boot-info-table    \
447            -b $BOOT_FILE \
448            -o "${ISO_OUTPUT}/${ISO_NAME}" . ; RC=$?
449    cd $CURRENT_DIR
450    if [ "$RC" = 0 ] ; then
451       log "Finished execution of stage 'iso build' [$(date)]"
452       einfo "Finished execution of stage 'iso build'" ; eend 0
453    else
454       log "There was an error ($RC) executing stage 'iso build' [$(date)]"
455       eerror "There was an error executing stage 'iso build'" ; eend 1
456       bailout $RC
457    fi
458 fi
459 # }}}
460
461 # finalize {{{
462 [ -n "$start_seconds" ] && SECONDS="$[$(cut -d . -f 1 /proc/uptime)-$start_seconds]" || SECONDS="unknown"
463 einfo "Sucessfully finished execution of $PN [running ${SECONDS} seconds]" ; eend 0
464 log "Sucessfully finished execution of $PN [running ${SECONDS} seconds]"
465 log "------------------------------------------------------------------------------"
466 bailout 0
467 # }}}
468
469 ## END OF FILE #################################################################
470 # vim:foldmethod=marker ts=2 ft=sh ai expandtab tw=80 sw=3