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 Dec 16 12:39:04 CET 2007 [mika]
8 ################################################################################
10 # read configuration files, set some misc variables {{{
18 GRML_LIVE_VERSION='0.0.13'
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
47 if [ -r /etc/grml/lsb-functions ] ; then
48 . /etc/grml/lsb-functions
50 einfo() { echo " [*] $*" ;}
51 eerror() { echo " [!] $*">&2 ;}
52 ewarn() { echo " [x] $*" ;}
56 # source main configuration file:
57 LIVE_CONF=/etc/grml/grml-live.conf
65 [ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
66 rm -f /var/run/fai/fai_softupdate_is_running \
67 /var/run/fai/FAI_INSTALLATION_IN_PROGRESS
68 [ -n "$1" ] && EXIT="$1" || EXIT="1"
69 [ -n "$2" ] && eerror "$2">&2
70 log "------------------------------------------------------------------------------"
73 # trap bailout 1 2 3 6 9 14 15
77 # check for important variables {{{
78 [ -n "$GRML_FAI_CONFIG" ] || GRML_FAI_CONFIG=/etc/grml/fai
79 [ -n "$HOSTNAME" ] || HOSTNAME=grml
80 [ -n "$USERNAME" ] || USERNAME=grml
81 [ -n "$CLASSES" ] || CLASSES="GRML,I386"
82 [ -n "$BOOT_METHOD" ] || BOOT_METHOD='isolinux'
83 [ -n "$OUTPUT" ] || bailout 1 "${PN}: \$OUTPUT not specified. Please adjust $LIVE_CONF. Exiting."
85 [ -n "$VERSION" ] || VERSION="0.0.1"
86 [ -n "$RELEASENAME" ] || RELEASENAME="grml-live rocks"
87 [ -n "$GRML_NAME" ] || GRML_NAME='grml'
90 if [ -z "$LOGFILE" ] ; then
91 LOGFILE=/var/log/grml-live.log
94 chown root:adm $LOGFILE
97 NFSROOT_CONF=/etc/grml/fai/make-fai-nfsroot.conf
101 # some important functions {{{
104 # usage: log "string to log"
105 log() { echo "$*" >> $LOGFILE ; }
107 # cut string at character number int = $1
108 # usage: cut_string 5 "1234567890" will output "12345"
110 [ -n "$2" ] || return 1
111 echo "$2" | head -c "$1"; echo -ne "\n"
114 # prepend int = $1 spaces before string = $2
115 # usage: extend_string_begin 5 "123" will output " 123"
116 extend_string_begin() {
117 [ -n "$2" ] || return 1
118 local COUNT="$(echo $2 | wc -c)"
119 local FILL="$(expr $COUNT - $1)"
120 while [ "$FILL" -gt 1 ] ; do
122 local FILL=$(expr $FILL - 1)
124 while [ "$FILL" -lt 1 ] ; do
126 local FILL=$(expr $FILL + 1)
128 echo "$2" | head -c "$1"; echo -ne "\n"
131 # append int = $1 spaces to string = $2
132 # usage: extend_string_begin 5 "123" will output "123 "
133 extend_string_end() {
134 [ -n "$2" ] || return 1
135 echo -n "$2" | head -c "$1"
136 local COUNT="$(echo $2 | wc -c)"
137 local FILL="$(expr $COUNT - $1)"
138 while [ "$FILL" -gt 1 ] ; do
140 local FILL=$(expr $FILL - 1)
142 while [ "$FILL" -lt 1 ] ; do
144 local FILL=$(expr $FILL + 1)
150 # usage information {{{
154 $PN - build process script for generating a (grml based) Linux Live-ISO
156 Usage: $PN [-a <architecture>] [-c <classe[s]>] [-g <grml_name>] \\
157 [-i <iso_name> ] [-o <output_directory>] [-s <suite>] \\
158 [-t <template_directory>] [-s <suite>] \\
159 [-v <version_number>] [-bFVhu]
164 $PN -c GRMLBASE,GRML_SMALL,I386 -o /grml/
165 $PN -c GRMLBASE,GRML_MEDIUM,I386 -o /dev/shm/grml
166 $PN -c GRMLBASE,GRML_SMALL,I386 -g grml-small -v 1.0
167 $PN -c GRMLBASE,GRML_FULL,I386 -i grml_0.0-1.iso -v 0.0-1
168 $PN -c GRMLBASE,GRML_FULL,I386 -s sid -V -r 'grml-live rocks'
170 More details: man grml-live
171 /usr/share/doc/grml-live/grml-live.html
173 Please send your bug reports, feedback,.. to the grml-team.
174 http://grml.org/bugs/
179 # command line parsing {{{
181 while getopts "a:C:c:g:i:o:r:s:t:v:bFhuVz" opt; do
185 c) CLASSES="$OPTARG" ;;
186 C) CONFIG="$OPTARG" ;;
187 g) GRML_NAME="$OPTARG" ;;
188 i) ISO_NAME="$OPTARG" ;;
190 CHROOT_OUTPUT="$OUTPUT/grml_chroot"
191 BUILD_OUTPUT="$OUTPUT/grml_cd"
192 ISO_OUTPUT="$OUTPUT/grml_isos"
194 r) RELEASENAME="$OPTARG" ;;
195 s) SUITE="$OPTARG" ;;
196 t) TEMPLATE_DIRECTORY="$OPTARG";;
197 v) VERSION="$OPTARG" ;;
199 h) usage ; bailout 0 ;;
202 z) SQUASHFS_ZLIB="-nolzma" ;;
203 ?) echo "invalid option -$OPTARG" >&2; bailout 1 ;;
206 shift $(($OPTIND - 1)) # set ARGV to the first not parsed commandline parameter
209 # some misc checks before executing FAI {{{
210 [ -n "$CLASSES" ] || bailout 1 "Error: \$CLASSES unset, please set it in $LIVE_CONF or
211 specify it on the command line using the -c option."
212 [ -n "$OUTPUT" ] || bailout 1 "Error: \$OUTPUT unset, please set it in $LIVE_CONF or
213 specify it on the command line using the -o option."
216 # read local (non-packaged) configuration {{{
217 LOCAL_CONFIG=/etc/grml/grml-live.local
218 if [ -r "$LOCAL_CONFIG" ] ; then
219 log "Sourcing $LOCAL_CONFIG"
222 log "No $LOCAL_CONFIG found, not sourcing it"
226 # clean/zero grml-live logfile:
227 if [ -n "$ZERO_LOGFILE" ] ; then
231 # clean/zero/remove old FAI directory:
232 if [ -n "$ZERO_FAI_LOGFILE" ] ; then
233 if [ -d /var/log/fai/"$HOSTNAME" ] ; then
234 rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last)"
235 rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last-dirinstall)"
236 rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last-softupdate)"
237 rm -f /var/log/fai/"$HOSTNAME"/last \
238 /var/log/fai/"$HOSTNAME"/last-dirinstall \
239 /var/log/fai/"$HOSTNAME"/last-softupdate
245 # ask user whether the setup is ok {{{
246 if [ -z "$FORCE" ] ; then
248 echo "${PN} [${GRML_LIVE_VERSION}]: check your configuration (or use -F to force execution):"
250 echo " FAI classes: $CLASSES"
251 [ -r "$LOCAL_CONFIG" ] && echo " local config: /etc/grml/grml-live.local"
252 [ -n "$CONFIG" ] && echo " configuration: $CONFIG"
253 echo " main directory: $OUTPUT"
254 [ -n "$CHROOT_OUTPUT" ] && echo " chroot target: $CHROOT_OUTPUT"
255 [ -n "$BUILD_OUTPUT" ] && echo " build target: $BUILD_OUTPUT"
256 [ -n "$ISO_OUTPUT" ] && echo " ISO target: $ISO_OUTPUT"
257 [ -n "$GRML_NAME" ] && echo " grml name: $GRML_NAME"
258 [ -n "$RELEASENAME" ] && echo " release name: $RELEASENAME"
259 [ -n "$VERSION" ] && echo " grml version: $VERSION"
260 [ -n "$SUITE" ] && echo " Debian suite: $SUITE"
261 [ -n "$ARCH" ] && echo " Architecture: $ARCH"
262 [ -n "$BOOT_METHOD" ] && echo " Boot method: $BOOT_METHOD"
263 [ -n "$TEMPLATE_DIRECTORY" ] && echo " Template files: $TEMPLATE_DIRECTORY"
264 [ -n "$FAI_ARGS" ] && echo " additional arguments for FAI: $FAI_ARGS"
265 [ -n "$LOGFILE" ] && echo " Logging to file: $LOGFILE"
266 [ -n "$VERBOSE" ] && echo " Using VERBOSE mode."
267 [ -n "$SQUASHFS_ZLIB" ] && echo " Using ZLIB (instead od LZMA) compression."
268 [ -n "$UPDATE" ] && echo " Executing UPDATE instead of fresh installation."
269 [ -n "$BUILD_ONLY" ] && echo " Executing BUILD_ONLY instead of fresh installation or UPDATE."
271 echo -n "Is this ok for you? [y/N] "
273 if ! [ "$a" = 'y' -o "$a" = 'Y' ] ; then
274 bailout 1 "Exiting as requested."
279 if [ -n "$CONFIG" ] ; then
280 if ! [ -f "$CONFIG" ] ; then
281 log "Sorry, $CONFIG could not be read. Exiting. [$(date)]"
282 eerror "Sorry, $CONFIG could not be read. Exiting."
285 log "Sourcing $CONFIG"
290 start_seconds=$(cut -d . -f 1 /proc/uptime)
291 log "------------------------------------------------------------------------------"
292 log "Starting grml-live [${GRML_LIVE_VERSION}] run on $(date)"
293 log "Executed grml-live command line:"
296 einfo "Logging actions to logfile $LOGFILE"
299 # on-the-fly configuration {{{
300 if [ -n "$MIRROR_DIRECTORY" ] ; then
301 if ! [ -d "$MIRROR_DIRECTORY/debian" ] ; then
302 log "Sorry, $MIRROR_DIRECTORY/debian does not seem to exist. Exiting. [$(date)]"
303 eerror "Sorry, $MIRROR_DIRECTORY/debian does not seem to exist. Exiting."
306 echo "$MIRROR_SOURCES" > /etc/grml/fai/apt/sources.list
307 if [ -n "$GRML_LIVE_SOURCES" ] ; then
308 echo "$GRML_LIVE_SOURCES" >> /etc/grml/fai/apt/sources.list
310 elif [ -n "$GRML_LIVE_SOURCES" ] ; then
311 echo "$GRML_LIVE_SOURCES" > /etc/grml/fai/apt/sources.list
314 if [ -n "$FAI_DEBOOTSTRAP" ] ; then
315 sed -i "s#^FAI_DEBOOTSTRAP=.*#FAI_DEBOOTSTRAP=\"$FAI_DEBOOTSTRAP\"#" $NFSROOT_CONF
318 # does this suck? YES!
319 if [ -n "$SUITE" ] ; then
321 for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do
322 if [ -n "$file" ] ; then
323 sed -i "s/SUITE=.*/SUITE=\"$SUITE\"/" $LIVE_CONF
324 DIST="\|\ etch\ \|\ stable\ \|\ lenny\ \|\ testing\ \|\ sid\ \|\ unstable\ "
325 sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" $file
329 sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" /etc/grml/fai/apt/sources.list
330 # notice: activate grml-live pool only if we are building against unstable:
331 if grep -qe unstable -qe sid /etc/grml/fai/apt/sources.list ; then
332 grep -q 'grml-live.*main' /etc/grml/fai/apt/sources.list || \
333 grep grml-stable /etc/grml/fai/apt/sources.list | \
334 sed 's/grml-stable/grml-live/' >> /etc/grml/fai/apt/sources.list
336 grep -q 'grml-live.*main' /etc/grml/fai/apt/sources.list && \
337 sed -i 's/.*grml-live.*/# removed grml-live repository/' /etc/grml/fai/apt/sources.list
340 for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do
341 if [ -n "$file" ] ; then
342 sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$file"
345 sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" $NFSROOT_CONF
349 [ -n "$ARCH" ] || ARCH="$(dpkg --print-architecture)"
350 if grep -q -- 'FAI_DEBOOTSTRAP_OPTS.*--arch' $NFSROOT_CONF ; then
351 sed -i "s/--arch [a-z0-9]* /--arch $ARCH /" $NFSROOT_CONF
353 sed -i "s|FAI_DEBOOTSTRAP_OPTS=\"\(.*\)|FAI_DEBOOTSTRAP_OPTS=\"--arch $ARCH \1|" $NFSROOT_CONF
357 # CHROOT_OUTPUT - execute FAI {{{
358 [ -n "$CHROOT_OUTPUT" ] || CHROOT_OUTPUT="$OUTPUT/grml_chroot"
360 if [ -n "$UPDATE" -o -n "$BUILD_ONLY" ] ; then
361 FAI_ACTION=softupdate
363 FAI_ACTION=dirinstall
366 if [ -n "$UPDATE" -o -n "$BUILD_ONLY" ] ; then
367 if ! [ -r "$CHROOT_OUTPUT/etc/grml_version" ] ; then
368 log "Error: does not look like you have a working chroot. Updating/building not possible."
369 eerror "Error: does not look like you have a working chroot. Updating/building not possible. (Drop -u/-b option?)"
375 if [ -d "$CHROOT_OUTPUT/bin" -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then
376 log "$CHROOT_OUTPUT exists already, skipping stage 'fai dirinstall'"
377 ewarn "$CHROOT_OUTPUT exists already, skipping stage 'fai dirinstall'" ; eend 0
379 mkdir -p "$CHROOT_OUTPUT" || bailout 5 "Problem with creating $CHROOT_OUTPUT for FAI"
381 if [ -n "${MIRROR_DIRECTORY}" ] ; then
382 mkdir -p "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
383 mount --bind "${MIRROR_DIRECTORY}" "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
386 log "Executed FAI command line:"
387 log "BUILD_ONLY=$BUILD_ONLY fai $VERBOSE -C $GRML_FAI_CONFIG -c$CLASSES -u $HOSTNAME $FAI_ACTION $CHROOT_OUTPUT $FAI_ARGS"
388 BUILD_ONLY="$BUILD_ONLY" fai $VERBOSE -C "$GRML_FAI_CONFIG" -c"$CLASSES" -u "$HOSTNAME" $FAI_ACTION "$CHROOT_OUTPUT" $FAI_ARGS | tee -a $LOGFILE
390 log "Setting /etc/grml_version to $GRML_NAME $VERSION Release Codename $RELEASENAME [$ISO_DATE]"
391 echo "$GRML_NAME $VERSION Release Codename $RELEASENAME [$ISO_DATE]" > $CHROOT_OUTPUT/etc/grml_version
392 chmod 644 $CHROOT_OUTPUT/etc/grml_version
394 # Remove all FAI logs from chroot if class RELEASE is used:
395 if [ -f $CHROOT_OUTPUT/etc/grml_fai_release ] ; then
396 rm -rf $CHROOT_OUTPUT/var/log/fai/*
399 umount $CHROOT_OUTPUT/proc 2>/dev/null || /bin/true
400 umount $CHROOT_OUTPUT/sys 2>/dev/null || /bin/true
401 [ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
403 # notice: 'fai dirinstall' does not seem to exit appropriate, so:
405 CHECKLOG=/var/log/fai/$HOSTNAME/last
406 if [ -r "$CHECKLOG/software.log" ] ; then
407 # 1 errors during executing of commands
408 # Unable to write mmap - msync (28 No space left on device)
409 # 'No candidate version found for' [/var/log/fai/current/software.log]
410 grep 'dpkg: error processing' $CHECKLOG/software.log >> $LOGFILE && ERROR=1
411 grep 'E: Method http has died unexpectedly!' $CHECKLOG/software.log >> $LOGFILE && ERROR=2
412 grep 'ERROR: chroot' $CHECKLOG/software.log >> $LOGFILE && ERROR=3
415 if [ -r "$CHECKLOG/shell.log" ] ; then
416 grep 'FAILED with exit code' $CHECKLOG/shell.log >> $LOGFILE && ERROR=2
419 if [ -n "$ERROR" ] ; then
420 log "There was an error [${ERROR}] during execution of stage 'fai dirinstall' [$(date)]"
421 eerror "There was an error during execution of stage 'fai dirinstall'"
422 echo " Check out $CHECKLOG for details. [exit ${ERROR}]"
426 log "Finished execution of stage 'fai dirinstall' [$(date)]"
427 einfo "Finished execution of stage 'fai dirinstall'"
432 # BUILD_OUTPUT - execute arch specific stuff and squashfs {{{
433 [ -n "$BUILD_OUTPUT" ] || BUILD_OUTPUT="$OUTPUT/grml_cd"
434 mkdir -p "$BUILD_OUTPUT" || bailout 6 "Problem with creating $BUILD_OUTPUT for stage ARCH"
437 if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
438 if [ -d "$BUILD_OUTPUT"/boot -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then
439 log "$BUILD_OUTPUT/boot exists already, skipping stage 'boot'"
440 ewarn "$BUILD_OUTPUT/boot exists already, skipping stage 'boot'" ; eend 0
443 [ -d "$BUILD_OUTPUT"/boot/isolinux ] || mkdir -p "$BUILD_OUTPUT"/boot/isolinux
444 cp /boot/memtest86+.bin "$BUILD_OUTPUT"/boot/isolinux/memtest
446 # if we don't have an initrd we a) can't boot and b) there was an error
447 # during build, so check for the file:
448 INITRD="$(ls $CHROOT_OUTPUT/boot/initrd* 2>/dev/null| grep -v '.bak$' | sort -r | head -1)"
449 if [ -n "$INITRD" ] ; then
450 cp $INITRD "$BUILD_OUTPUT"/boot/isolinux/initrd.gz
451 find $CHROOT_OUTPUT/boot/ -name initrd\*.bak -exec rm {} \;
453 log "No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting"
454 eerror "No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1
458 KERNEL_IMAGE="$(ls $CHROOT_OUTPUT/boot/vmlinuz* 2>/dev/null | sort -r | head -1)"
459 if [ -n "$KERNEL_IMAGE" ] ; then
460 cp "$KERNEL_IMAGE" "$BUILD_OUTPUT"/boot/isolinux/linux26
462 log "No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting"
463 eerror "No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1
467 [ -n "$TEMPLATE_DIRECTORY" ] || TEMPLATE_DIRECTORY='/usr/share/grml-live/templates'
468 if ! [ -d "${TEMPLATE_DIRECTORY}"/boot ] ; then
469 log "${TEMPLATE_DIRECTORY}/boot does not exist. Exiting."
470 eerror "${TEMPLATE_DIRECTORY}/boot does not exist. Exiting." ; eend 1
474 cp ${TEMPLATE_DIRECTORY}/boot/isolinux/* "$BUILD_OUTPUT"/boot/isolinux/
475 cp ${TEMPLATE_DIRECTORY}/boot/isolinux/* "$BUILD_OUTPUT"/boot/isolinux/
477 if ! [ -d "${BUILD_OUTPUT}/boot/grub" ] ; then
478 cp -a ${TEMPLATE_DIRECTORY}/boot/grub "$BUILD_OUTPUT"/boot/
481 if ! [ -d "${TEMPLATE_DIRECTORY}"/GRML ] ; then
482 log "${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting."
483 eerror "${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting." ; eend 1
487 [ -d "$BUILD_OUTPUT"/GRML ] || mkdir "$BUILD_OUTPUT"/GRML
488 cp -a ${TEMPLATE_DIRECTORY}/GRML/* "$BUILD_OUTPUT"/GRML/
490 # adjust boot splash information:
491 RELEASE_INFO="$GRML_NAME $VERSION - Release Codename $RELEASENAME"
492 RELEASE_INFO="$(cut_string 68 "$RELEASE_INFO")"
493 RELEASE_INFO="$(extend_string_end 68 "$RELEASE_INFO")"
495 sed -i "s/%RELEASE_INFO%/$GRML_NAME $VERSION - $RELEASENAME/" "$BUILD_OUTPUT"/GRML/grml-version
496 sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_OUTPUT"/GRML/grml-version
498 sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_OUTPUT"/boot/isolinux/boot.msg
499 sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_OUTPUT"/boot/isolinux/boot.msg
501 sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_OUTPUT"/boot/isolinux/boot-beep.msg
502 sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_OUTPUT"/boot/isolinux/boot-beep.msg
504 sed -i "s/%VERSION%/$VERSION/" "$BUILD_OUTPUT"/boot/grub/menu.lst
505 sed -i "s/%GRML_NAME%/$GRML_NAME/" "$BUILD_OUTPUT"/boot/grub/menu.lst
507 # autostart for Windows:
508 if [ -d "${TEMPLATE_DIRECTORY}/windows/autostart/" ] ; then
509 cp ${TEMPLATE_DIRECTORY}/windows/autostart/* "$BUILD_OUTPUT"/
513 if [ -n "$WINDOWS_BINARIES" ] ; then
514 if [ -f "$BUILD_OUTPUT"/windows/putty.exe ] ; then
515 log "$BUILD_OUTPUT/windows exists already, skipping stage 'WINDOWS_BINARIES'"
516 ewarn "$BUILD_OUTPUT/windows exists already, skipping stage 'WINDOWS_BINARIES'" ; eend 0
518 if ! [ -d "$BUILD_OUTPUT"/windows ] ; then
519 mkdir "$BUILD_OUTPUT"/windows
520 ( cd "$BUILD_OUTPUT"/windows
521 for file in pageant plink pscp psftp putty puttygen ; do
522 wget -O ${file}.exe ${WINDOWS_BINARIES}/${file}.exe
523 md5sum ${file}.exe > ${file}.exe.md5
527 log "Finished execution of stage 'WINDOWS_BINARIES' [$(date)]"
528 einfo "Finished execution of stage 'WINDOWS_BINARIES'" ; eend 0
530 einfo "Finished execution of stage 'boot'" ; eend 0
533 elif [ "$ARCH" = powerpc ] ; then
534 ewarn 'Warning: formorer, it is your turn. :)'>&2
537 eerror 'Error: Unsupported ARCH, sorry. Want to support it? Contribute!' ; eend 1
540 if [ -f "$BUILD_OUTPUT"/live/grml.squashfs -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then
541 log "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs'"
542 ewarn "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs'" ; eend 0
544 [ -d "$BUILD_OUTPUT"/live ] || mkdir "$BUILD_OUTPUT"/live
545 # make sure we don't leave (even an empty) base.tgz:
546 [ -f "$CHROOT_OUTPUT/base.tgz" ] && rm -f "$CHROOT_OUTPUT/base.tgz"
549 log "mksquashfs $CHROOT_OUTPUT/* $BUILD_OUTPUT/live/grml.squashfs -noappend -no-progress"
550 mksquashfs $CHROOT_OUTPUT/* $BUILD_OUTPUT/live/grml.squashfs -noappend -no-progress $SQUASHFS_OPTIONS $SQUASHFS_ZLIB
551 log "Finished execution of stage 'squashfs' [$(date)]"
552 einfo "Finished execution of stage 'squashfs'" ; eend 0
555 # create md5sum file:
556 ( cd $BUILD_OUTPUT/GRML &&
557 find .. -type f -not -name md5sums -not -name isolinux.bin -exec md5sum {} \; > md5sums )
560 # ISO_OUTPUT - mkisofs {{{
561 [ -n "$ISO_OUTPUT" ] || ISO_OUTPUT="$OUTPUT/grml_isos"
562 [ -n "$ISO_NAME" ] || ISO_NAME="${GRML_NAME}_${VERSION}.iso"
564 if [ "$BOOT_METHOD" = "isolinux" ] ; then
565 BOOT_FILE="boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat"
566 elif [ "$BOOT_METHOD" = "grub" ] ; then
567 BOOT_FILE="boot/grub/stage2_eltorito"
570 if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then
571 log "$ISO_OUTPUT exists already, skipping stage 'iso build'"
572 ewarn "$ISO_OUTPUT exists already, skipping stage 'iso build'" ; eend 0
574 mkdir -p "$ISO_OUTPUT" || bailout 6 "Problem with creating $ISO_OUTPUT for stage 'iso build'"
577 if cd "$BUILD_OUTPUT" ; then
578 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} ."
579 mkisofs -V "grml $VERSION" -publisher 'grml-live | grml.org' \
580 -l -r -J -no-emul-boot -boot-load-size 4 -boot-info-table \
582 -o "${ISO_OUTPUT}/${ISO_NAME}" . ; RC=$?
584 # generate md5sum of ISO if we are using class 'RELEASE':
585 case $CLASSES in *RELEASE*)
587 ( cd $ISO_OUTPUT && \
588 md5sum ${ISO_NAME} > ${ISO_NAME}.md5 && \
589 touch -r ${ISO_NAME} ${ISO_NAME}.md5 )
596 if [ "$RC" = 0 ] ; then
597 log "Finished execution of stage 'iso build' [$(date)]"
598 einfo "Finished execution of stage 'iso build'" ; eend 0
600 log "There was an error ($RC) executing stage 'iso build' [$(date)]"
601 eerror "There was an error executing stage 'iso build'" ; eend 1
608 [ -n "$start_seconds" ] && SECONDS="$[$(cut -d . -f 1 /proc/uptime)-$start_seconds]" || SECONDS="unknown"
609 einfo "Sucessfully finished execution of $PN [running ${SECONDS} seconds]" ; eend 0
610 log "Sucessfully finished execution of $PN [running ${SECONDS} seconds]"
614 ## END OF FILE #################################################################
615 # vim:foldmethod=marker ts=2 ft=sh ai expandtab tw=80 sw=3