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: Sun Nov 25 20:08:06 CET 2007 [mika]
8 ################################################################################
10 # read configuration files, set some misc variables {{{
18 GRML_LIVE_VERSION='0.0.10'
20 ISO_DATE="$(date +%Y-%m-%d)"
22 # we need root permissions for the build-process:
23 if [ "$(id -u 2>/dev/null)" != 0 ] ; then
24 echo "Error: please run this script with uid 0 (root)." >&2
28 if [ -r /var/run/fai/FAI_INSTALLATION_IN_PROGRESS ] ; then
29 echo "/usr/sbin/fai already running or was aborted before.">&2
30 echo "You may remove /var/run/fai/FAI_INSTALLATION_IN_PROGRESS and try again.">&2
35 if [ -r /var/run/fai/fai_softupdate_is_running ] ; then
36 echo "/usr/sbin/fai softupdate already running or was aborted before.">&2
37 echo "You may remove /var/run/fai/fai_softupdate_is_running and try again.">&2
41 # make sure they are not set by default
46 if [ -r /etc/grml/lsb-functions ] ; then
47 . /etc/grml/lsb-functions
49 einfo() { echo " [*] $*" ;}
50 eerror() { echo " [!] $*">&2 ;}
51 ewarn() { echo " [x] $*" ;}
55 # source main configuration file:
56 LIVE_CONF=/etc/grml/grml-live.conf
64 [ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
65 rm -f /var/run/fai/fai_softupdate_is_running /var/run/fai/FAI_INSTALLATION_IN_PROGRESS
66 [ -n "$1" ] && EXIT="$1" || EXIT="1"
67 [ -n "$2" ] && eerror "$2">&2
68 log "------------------------------------------------------------------------------"
71 # trap bailout 1 2 3 6 9 14 15
75 # check for important variables {{{
76 [ -n "$GRML_FAI_CONFIG" ] || GRML_FAI_CONFIG=/etc/grml/fai
77 [ -n "$HOSTNAME" ] || HOSTNAME=grml
78 [ -n "$USERNAME" ] || USERNAME=grml
79 [ -n "$CLASSES" ] || CLASSES="GRML,I386"
80 [ -n "$BOOT_METHOD" ] || BOOT_METHOD='isolinux'
81 [ -n "$OUTPUT" ] || bailout 1 "${PN}: \$OUTPUT not specified. Please adjust $LIVE_CONF. Exiting."
83 [ -n "$VERSION" ] || VERSION="0.0.1"
84 [ -n "$RELEASENAME" ] || RELEASENAME="grml-live rocks"
85 [ -n "$GRML_NAME" ] || GRML_NAME='grml'
88 if [ -z "$LOGFILE" ] ; then
89 LOGFILE=/var/log/grml-live.log
92 chown root:adm $LOGFILE
94 # clean/zero grml-live logfile:
95 if [ -n "$ZERO_LOGFILE" ] ; then
99 # clean/zero/remove old FAI directory:
100 if [ -n "$ZERO_FAI_LOGFILE" ] ; then
101 if [ -d /var/log/fai/"$HOSTNAME" ] ; then
102 rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last)"
106 NFSROOT_CONF=/etc/grml/fai/make-fai-nfsroot.conf
110 # some important functions {{{
113 # usage: log "string to log"
114 log() { echo "$*" >> $LOGFILE ; }
116 # cut string at character number int = $1
117 # usage: cut_string 5 "1234567890" will output "12345"
119 [ -n "$2" ] || return 1
120 echo "$2" | head -c "$1"; echo -ne "\n"
123 # prepend int = $1 spaces before string = $2
124 # usage: extend_string_begin 5 "123" will output " 123"
125 extend_string_begin() {
126 [ -n "$2" ] || return 1
127 local COUNT="$(echo $2 | wc -c)"
128 local FILL="$(expr $COUNT - $1)"
129 while [ "$FILL" -gt 1 ] ; do
131 local FILL=$(expr $FILL - 1)
133 while [ "$FILL" -lt 1 ] ; do
135 local FILL=$(expr $FILL + 1)
137 echo "$2" | head -c "$1"; echo -ne "\n"
140 # append int = $1 spaces to string = $2
141 # usage: extend_string_begin 5 "123" will output "123 "
142 extend_string_end() {
143 [ -n "$2" ] || return 1
144 echo -n "$2" | head -c "$1"
145 local COUNT="$(echo $2 | wc -c)"
146 local FILL="$(expr $COUNT - $1)"
147 while [ "$FILL" -gt 1 ] ; do
149 local FILL=$(expr $FILL - 1)
151 while [ "$FILL" -lt 1 ] ; do
153 local FILL=$(expr $FILL + 1)
159 # usage information {{{
163 $PN - build process script for generating a (grml based) Linux Live-ISO
165 Usage: $PN [-a <architecture>] [-c <classe[s]>] [-g <grml_name>] \\
166 [-i <iso_name> ] [-o <output_directory>] [-s <suite>] \\
167 [-t <template_directory>] [-s <suite>] \\
168 [-v <version_number>] [-FVhu]
173 $PN -c GRMLBASE,GRML_SMALL,I386 -o /grml/
174 $PN -c GRMLBASE,GRML_MEDIUM,I386 -o /dev/shm/grml
175 $PN -c GRMLBASE,GRML_SMALL,I386 -g grml-small -v 1.0
176 $PN -c GRMLBASE,GRML_FULL,I386 -i grml_0.0-1.iso -v 0.0-1
177 $PN -c GRMLBASE,GRML_FULL,I386 -s sid -V -r 'grml-live rocks'
179 More details: man grml-live
180 /usr/share/doc/grml-live/grml-live.html
182 Please send your bug reports, feedback,.. to the grml-team.
183 http://grml.org/bugs/
188 # command line parsing {{{
190 while getopts "a:C:c:g:i:o:r:s:t:v:FhuV" opt; do
193 c) CLASSES="$OPTARG" ;;
194 C) CONFIG="$OPTARG" ;;
195 g) GRML_NAME="$OPTARG" ;;
196 i) ISO_NAME="$OPTARG" ;;
198 CHROOT_OUTPUT="$OUTPUT/grml_chroot"
199 BUILD_OUTPUT="$OUTPUT/grml_cd"
200 ISO_OUTPUT="$OUTPUT/grml_isos"
202 r) RELEASENAME="$OPTARG" ;;
203 s) SUITE="$OPTARG" ;;
204 t) TEMPLATE_DIRECTORY="$OPTARG";;
205 v) VERSION="$OPTARG" ;;
207 h) usage ; bailout 0 ;;
210 ?) echo "invalid option -$OPTARG" >&2; bailout 1 ;;
213 shift $(($OPTIND - 1)) # set ARGV to the first not parsed commandline parameter
216 # some misc checks before executing FAI {{{
217 [ -n "$CLASSES" ] || bailout 1 "Error: \$CLASSES unset, please set it in $LIVE_CONF or
218 specify it on the command line using the -c option."
219 [ -n "$OUTPUT" ] || bailout 1 "Error: \$OUTPUT unset, please set it in $LIVE_CONF or
220 specify it on the command line using the -o option."
223 # ask user whether the setup is ok {{{
224 if [ -z "$FORCE" ] ; then
226 echo "${PN} [${GRML_LIVE_VERSION}]: check your configuration (or use -F to force execution):"
228 echo " FAI classes: $CLASSES"
229 echo " main directory: $OUTPUT"
230 [ -n "$CONFIG" ] && echo " configuration: $CONFIG"
231 [ -n "$CHROOT_OUTPUT" ] && echo " chroot target: $CHROOT_OUTPUT"
232 [ -n "$BUILD_OUTPUT" ] && echo " build target: $BUILD_OUTPUT"
233 [ -n "$ISO_OUTPUT" ] && echo " ISO target: $ISO_OUTPUT"
234 [ -n "$GRML_NAME" ] && echo " grml name: $GRML_NAME"
235 [ -n "$RELEASENAME" ] && echo " release name: $RELEASENAME"
236 [ -n "$VERSION" ] && echo " grml version: $VERSION"
237 [ -n "$SUITE" ] && echo " Debian suite: $SUITE"
238 [ -n "$ARCH" ] && echo " Architecture: $ARCH"
239 [ -n "$BOOT_METHOD" ] && echo " Boot method: $BOOT_METHOD"
240 [ -n "$TEMPLATE_DIRECTORY" ] && echo " Template files: $TEMPLATE_DIRECTORY"
241 [ -n "$FAI_ARGS" ] && echo " additional arguments for FAI: $FAI_ARGS"
242 [ -n "$LOGFILE" ] && echo " Logging to file: $LOGFILE"
243 [ -n "$VERBOSE" ] && echo " Using VERBOSE mode."
244 [ -n "$UPDATE" ] && echo " Executing UPDATE instead of fresh installation."
246 echo -n "Is this ok for you? [y/N] "
248 if ! [ "$a" = 'y' -o "$a" = 'Y' ] ; then
249 bailout 1 "Exiting as requested."
254 # read local (non-packaged) configuration:
255 LOCAL_CONFIG=/etc/grml/grml-live.local
256 if [ -r "$LOCAL_CONFIG" ] ; then
257 log "Sourcing $LOCAL_CONFIG"
263 if [ -n "$CONFIG" ] ; then
264 if ! [ -f "$CONFIG" ] ; then
265 log "Sorry, $CONFIG could not be read. Exiting. [$(date)]"
266 eerror "Sorry, $CONFIG could not be read. Exiting."
269 log "Sourcing $CONFIG"
274 start_seconds=$(cut -d . -f 1 /proc/uptime)
275 log "------------------------------------------------------------------------------"
276 log "Starting grml-live [${GRML_LIVE_VERSION}] run on $(date)"
277 log "Executed grml-live command line:"
280 einfo "Logging actions to logfile $LOGFILE"
283 # on-the-fly configuration {{{
284 if [ -n "$MIRROR_DIRECTORY" ] ; then
285 if ! [ -d "$MIRROR_DIRECTORY/debian" ] ; then
286 log "Sorry, $MIRROR_DIRECTORY/debian does not seem to exist. Exiting. [$(date)]"
287 eerror "Sorry, $MIRROR_DIRECTORY/debian does not seem to exist. Exiting."
290 echo "$MIRROR_SOURCES" > /etc/grml/fai/apt/sources.list
291 if [ -n "$GRML_LIVE_SOURCES" ] ; then
292 echo "$GRML_LIVE_SOURCES" >> /etc/grml/fai/apt/sources.list
294 elif [ -n "$GRML_LIVE_SOURCES" ] ; then
295 echo "$GRML_LIVE_SOURCES" > /etc/grml/fai/apt/sources.list
298 if [ -n "$FAI_DEBOOTSTRAP" ] ; then
299 sed -i "s#^FAI_DEBOOTSTRAP=.*#FAI_DEBOOTSTRAP=\"$FAI_DEBOOTSTRAP\"#" $NFSROOT_CONF
302 # does this suck? YES!
303 if [ -n "$SUITE" ] ; then
305 for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do
306 if [ -n "$file" ] ; then
307 sed -i "s/SUITE=.*/SUITE=\"$SUITE\"/" $LIVE_CONF
308 DIST="\|\ etch\ \|\ stable\ \|\ lenny\ \|\ testing\ \|\ sid\ \|\ unstable\ "
309 sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" $file
313 sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" /etc/grml/fai/apt/sources.list
314 # notice: activate grml-live pool only if we are building against unstable:
315 if grep -qe unstable -qe sid /etc/grml/fai/apt/sources.list ; then
316 grep -q 'grml-live.*main' /etc/grml/fai/apt/sources.list || \
317 grep grml-stable /etc/grml/fai/apt/sources.list | \
318 sed 's/grml-stable/grml-live/' >> /etc/grml/fai/apt/sources.list
320 grep -q 'grml-live.*main' /etc/grml/fai/apt/sources.list && \
321 sed -i 's/.*grml-live.*/# removed grml-live repository/' /etc/grml/fai/apt/sources.list
324 for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do
325 if [ -n "$file" ] ; then
326 sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$file"
329 sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" $NFSROOT_CONF
333 [ -n "$ARCH" ] || ARCH="$(dpkg --print-architecture)"
334 if grep -q -- 'FAI_DEBOOTSTRAP_OPTS.*--arch' $NFSROOT_CONF ; then
335 sed -i "s/--arch [a-z0-9]* /--arch $ARCH /" $NFSROOT_CONF
337 sed -i "s|FAI_DEBOOTSTRAP_OPTS=\"\(.*\)|FAI_DEBOOTSTRAP_OPTS=\"--arch $ARCH \1|" $NFSROOT_CONF
341 # CHROOT_OUTPUT - execute FAI {{{
342 [ -n "$CHROOT_OUTPUT" ] || CHROOT_OUTPUT="$OUTPUT/grml_chroot"
344 if [ -n "$UPDATE" ] ; then
345 FAI_ACTION=softupdate
347 FAI_ACTION=dirinstall
350 if [ -n "$UPDATE" ] ; then
351 if ! [ -r "$CHROOT_OUTPUT/etc/grml_version" ] ; then
352 log "Error: It does not look like you have a working chroot system. Updating not possible."
353 eerror "Error: It does not look like you have a working chroot system. Updating not possible."
359 if [ -d "$CHROOT_OUTPUT/bin" -a -z "$UPDATE" ] ; then
360 log "$CHROOT_OUTPUT exists already, skipping stage 'fai dirinstall'"
361 ewarn "$CHROOT_OUTPUT exists already, skipping stage 'fai dirinstall'" ; eend 0
363 mkdir -p "$CHROOT_OUTPUT" || bailout 5 "Problem with creating $CHROOT_OUTPUT for FAI"
365 if [ -n "${MIRROR_DIRECTORY}" ] ; then
366 mkdir -p "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
367 mount --bind "${MIRROR_DIRECTORY}" "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
370 log "Executed FAI command line:"
371 log "fai $VERBOSE -C $GRML_FAI_CONFIG -c$CLASSES -u $HOSTNAME $FAI_ACTION $CHROOT_OUTPUT $FAI_ARGS"
372 fai $VERBOSE -C "$GRML_FAI_CONFIG" -c"$CLASSES" -u "$HOSTNAME" $FAI_ACTION "$CHROOT_OUTPUT" $FAI_ARGS | tee -a $LOGFILE
374 log "Setting /etc/grml_version to $GRML_NAME $VERSION Release Codename $RELEASENAME [$ISO_DATE]"
375 echo "$GRML_NAME $VERSION Release Codename $RELEASENAME [$ISO_DATE]" > $CHROOT_OUTPUT/etc/grml_version
376 chmod 644 $CHROOT_OUTPUT/etc/grml_version
378 # Remove all FAI logs from chroot if class RELEASE is used:
379 if [ -f $CHROOT_OUTPUT/etc/grml_fai_release ] ; then
380 rm -rf $CHROOT_OUTPUT/var/log/fai/*
383 umount $CHROOT_OUTPUT/proc 2>/dev/null || /bin/true
384 umount $CHROOT_OUTPUT/sys 2>/dev/null || /bin/true
385 [ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
387 # notice: 'fai dirinstall' does not seem to exit appropriate, so:
389 CHECKLOG=/var/log/fai/$HOSTNAME/last
390 if [ -r "$CHECKLOG/software.log" ] ; then
391 # 1 errors during executing of commands
392 # Unable to write mmap - msync (28 No space left on device)
393 # 'No candidate version found for' [/var/log/fai/current/software.log]
394 grep 'dpkg: error processing' $CHECKLOG/software.log >> $LOGFILE && ERROR=1
395 grep 'E: Method http has died unexpectedly!' $CHECKLOG/software.log >> $LOGFILE && ERROR=2
396 grep 'ERROR: chroot' $CHECKLOG/software.log >> $LOGFILE && ERROR=3
399 if [ -r "$CHECKLOG/shell.log" ] ; then
400 grep 'FAILED with exit code' $CHECKLOG/shell.log >> $LOGFILE && ERROR=2
403 if [ -n "$ERROR" ] ; then
404 log "There was an error [${ERROR}] during execution of stage 'fai dirinstall' [$(date)]"
405 eerror "There was an error during execution of stage 'fai dirinstall'"
406 echo " Check out $CHECKLOG for details. [exit ${ERROR}]"
410 log "Finished execution of stage 'fai dirinstall' [$(date)]"
411 einfo "Finished execution of stage 'fai dirinstall'"
416 # BUILD_OUTPUT - execute arch specific stuff and squashfs {{{
417 [ -n "$BUILD_OUTPUT" ] || BUILD_OUTPUT="$OUTPUT/grml_cd"
418 mkdir -p "$BUILD_OUTPUT" || bailout 6 "Problem with creating $BUILD_OUTPUT for stage ARCH"
421 if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
422 if [ -d "$BUILD_OUTPUT"/boot -a -z "$UPDATE" ] ; then
423 log "$BUILD_OUTPUT/boot exists already, skipping stage 'boot'"
424 ewarn "$BUILD_OUTPUT/boot exists already, skipping stage 'boot'" ; eend 0
427 [ -d "$BUILD_OUTPUT"/boot/isolinux ] || mkdir -p "$BUILD_OUTPUT"/boot/isolinux
428 cp /boot/memtest86+.bin "$BUILD_OUTPUT"/boot/isolinux/memtest
430 # if we don't have an initrd we a) can't boot and b) there was an error
431 # during build, so check for the file:
432 INITRD="$(ls $CHROOT_OUTPUT/boot/initrd* 2>/dev/null| grep -v '.bak$' | sort -r | head -1)"
433 if [ -n "$INITRD" ] ; then
434 cp $INITRD "$BUILD_OUTPUT"/boot/isolinux/initrd.gz
435 find $CHROOT_OUTPUT/boot/ -name initrd\*.bak -exec rm {} \;
437 log "No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting"
438 eerror "No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1
442 KERNEL_IMAGE="$(ls $CHROOT_OUTPUT/boot/vmlinuz* 2>/dev/null | sort -r | head -1)"
443 if [ -n "$KERNEL_IMAGE" ] ; then
444 cp "$KERNEL_IMAGE" "$BUILD_OUTPUT"/boot/isolinux/linux26
446 log "No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting"
447 eerror "No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1
451 cp /usr/lib/syslinux/chain.c32 "$BUILD_OUTPUT"/boot/isolinux/
452 cp /usr/lib/syslinux/isolinux.bin "$BUILD_OUTPUT"/boot/isolinux/
453 cp /usr/lib/syslinux/memdisk "$BUILD_OUTPUT"/boot/isolinux/
454 cp /usr/lib/syslinux/menu.c32 "$BUILD_OUTPUT"/boot/isolinux/
456 [ -n "$TEMPLATE_DIRECTORY" ] || TEMPLATE_DIRECTORY='/usr/share/grml-live/templates'
457 if ! [ -d "${TEMPLATE_DIRECTORY}"/boot ] ; then
458 log "${TEMPLATE_DIRECTORY}/boot does not exist. Exiting."
459 eerror "${TEMPLATE_DIRECTORY}/boot does not exist. Exiting." ; eend 1
463 cp ${TEMPLATE_DIRECTORY}/boot/isolinux/* "$BUILD_OUTPUT"/boot/isolinux/
464 cp ${TEMPLATE_DIRECTORY}/boot/isolinux/* "$BUILD_OUTPUT"/boot/isolinux/
466 if ! [ -d "${BUILD_OUTPUT}/boot/grub" ] ; then
467 cp -a ${TEMPLATE_DIRECTORY}/boot/grub "$BUILD_OUTPUT"/boot/
470 if ! [ -d "${TEMPLATE_DIRECTORY}"/GRML ] ; then
471 log "${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting."
472 eerror "${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting." ; eend 1
476 [ -d "$BUILD_OUTPUT"/GRML ] || mkdir "$BUILD_OUTPUT"/GRML
477 cp -a ${TEMPLATE_DIRECTORY}/GRML/* "$BUILD_OUTPUT"/GRML/
479 # adjust boot splash information:
480 RELEASE_INFO="$GRML_NAME $VERSION - Release Codename $RELEASENAME"
481 RELEASE_INFO="$(cut_string 68 "$RELEASE_INFO")"
482 RELEASE_INFO="$(extend_string_end 68 "$RELEASE_INFO")"
484 sed -i "s/%RELEASE_INFO%/$GRML_NAME $VERSION - $RELEASENAME/" "$BUILD_OUTPUT"/GRML/grml-version
485 sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_OUTPUT"/GRML/grml-version
487 sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_OUTPUT"/boot/isolinux/boot.msg
488 sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_OUTPUT"/boot/isolinux/boot.msg
490 sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_OUTPUT"/boot/isolinux/boot-beep.msg
491 sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_OUTPUT"/boot/isolinux/boot-beep.msg
493 sed -i "s/%VERSION%/$VERSION/" "$BUILD_OUTPUT"/boot/grub/menu.lst
494 sed -i "s/%GRML_NAME%/$GRML_NAME/" "$BUILD_OUTPUT"/boot/grub/menu.lst
496 # autostart for Windows:
497 if [ -d "${TEMPLATE_DIRECTORY}/windows/autostart/" ] ; then
498 cp ${TEMPLATE_DIRECTORY}/windows/autostart/* "$BUILD_OUTPUT"/
502 if [ -n "$WINDOWS_BINARIES" ] ; then
503 if [ -f "$BUILD_OUTPUT"/windows/putty.exe ] ; then
504 log "$BUILD_OUTPUT/windows exists already, skipping stage 'WINDOWS_BINARIES'"
505 ewarn "$BUILD_OUTPUT/windows exists already, skipping stage 'WINDOWS_BINARIES'" ; eend 0
507 if ! [ -d "$BUILD_OUTPUT"/windows ] ; then
508 mkdir "$BUILD_OUTPUT"/windows
509 ( cd "$BUILD_OUTPUT"/windows
510 for file in pageant plink pscp psftp putty puttygen ; do
511 wget -O ${file}.exe ${WINDOWS_BINARIES}/${file}.exe
512 md5sum ${file}.exe > ${file}.exe.md5
516 log "Finished execution of stage 'WINDOWS_BINARIES' [$(date)]"
517 einfo "Finished execution of stage 'WINDOWS_BINARIES'" ; eend 0
519 einfo "Finished execution of stage 'boot'" ; eend 0
522 elif [ "$ARCH" = powerpc ] ; then
523 ewarn 'Warning: formorer, it is your turn. :)'>&2
526 eerror 'Error: Unsupported ARCH, sorry. Want to support it? Contribute!' ; eend 1
529 if [ -f "$BUILD_OUTPUT"/live/grml.squashfs -a -z "$UPDATE" ] ; then
530 log "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs'"
531 ewarn "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs'" ; eend 0
533 [ -d "$BUILD_OUTPUT"/live ] || mkdir "$BUILD_OUTPUT"/live
534 # make sure we don't leave (even an empty) base.tgz:
535 [ -f "$CHROOT_OUTPUT/base.tgz" ] && rm -f "$CHROOT_OUTPUT/base.tgz"
538 log "mksquashfs $CHROOT_OUTPUT/* $BUILD_OUTPUT/live/grml.squashfs -noappend"
539 mksquashfs $CHROOT_OUTPUT/* $BUILD_OUTPUT/live/grml.squashfs -noappend
540 log "Finished execution of stage 'squashfs' [$(date)]"
541 einfo "Finished execution of stage 'squashfs'" ; eend 0
544 # create md5sum file:
545 ( cd $BUILD_OUTPUT/GRML &&
546 find .. -type f -not -name md5sums -not -name isolinux.bin -exec md5sum {} \; > md5sums )
549 # ISO_OUTPUT - mkisofs {{{
550 [ -n "$ISO_OUTPUT" ] || ISO_OUTPUT="$OUTPUT/grml_isos"
551 [ -n "$ISO_NAME" ] || ISO_NAME="${GRML_NAME}_${VERSION}.iso"
553 if [ "$BOOT_METHOD" = "isolinux" ] ; then
554 BOOT_FILE="boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat"
555 elif [ "$BOOT_METHOD" = "grub" ] ; then
556 BOOT_FILE="boot/grub/stage2_eltorito"
559 if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" ] ; then
560 log "$ISO_OUTPUT exists already, skipping stage 'iso build'"
561 ewarn "$ISO_OUTPUT exists already, skipping stage 'iso build'" ; eend 0
563 mkdir -p "$ISO_OUTPUT" || bailout 6 "Problem with creating $ISO_OUTPUT for stage 'iso build'"
565 cd "$BUILD_OUTPUT" &&
566 log "mkisofs -V grml $VERSION -publisher 'grml-live | grml.org' -l -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b $BOOT_FILE -o ${ISO_OUTPUT}/${ISO_NAME} ."
567 mkisofs -V "grml $VERSION" -publisher 'grml-live | grml.org' \
568 -l -r -J -no-emul-boot -boot-load-size 4 -boot-info-table \
570 -o "${ISO_OUTPUT}/${ISO_NAME}" . ; RC=$?
572 if [ "$RC" = 0 ] ; then
573 log "Finished execution of stage 'iso build' [$(date)]"
574 einfo "Finished execution of stage 'iso build'" ; eend 0
576 log "There was an error ($RC) executing stage 'iso build' [$(date)]"
577 eerror "There was an error executing stage 'iso build'" ; eend 1
584 [ -n "$start_seconds" ] && SECONDS="$[$(cut -d . -f 1 /proc/uptime)-$start_seconds]" || SECONDS="unknown"
585 einfo "Sucessfully finished execution of $PN [running ${SECONDS} seconds]" ; eend 0
586 log "Sucessfully finished execution of $PN [running ${SECONDS} seconds]"
590 ## END OF FILE #################################################################
591 # vim:foldmethod=marker ts=2 ft=sh ai expandtab tw=80 sw=3