X-Git-Url: https://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=grml-live;h=f60a7455b077206b1bc22304adb25b2c8650d153;hp=e5d432b663827edec35fd9c2d20ed11eb67ac3e2;hb=2e56931d2a294b08b2d32d4f71015ee541c3951b;hpb=41956296400b629eb06aba866358d5f8c60993af diff --git a/grml-live b/grml-live index e5d432b..f60a745 100755 --- a/grml-live +++ b/grml-live @@ -4,7 +4,7 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2 or any later version. -# Latest change: Sat Oct 06 18:28:57 CEST 2007 [mika] +# Latest change: Wed Oct 17 22:59:03 CEST 2007 [mika] ################################################################################ # read configuration files, set some misc variables {{{ @@ -22,7 +22,7 @@ if [ "$(id -u 2>/dev/null)" != 0 ] ; then fi if [ -r /var/run/fai/FAI_INSTALLATION_IN_PROGRESS ] ; then - echo "/usr/sbin/fai already running or was aborted before."&>2 + echo "/usr/sbin/fai already running or was aborted before.">&2 echo "You may remove /var/run/fai/FAI_INSTALLATION_IN_PROGRESS and try again.">&2 exit 1 fi @@ -152,19 +152,20 @@ http://grml.org/bugs/ # command line parsing {{{ -while getopts "c:g:i:o:r:s:t:v:FhV" opt; do +while getopts "a:c:g:i:o:r:s:t:v:FhV" opt; do case "$opt" in + a) ARCH="$OPTARG" ;; c) CLASSES="$OPTARG" ;; g) GRML_NAME="$OPTARG" ;; i) ISO_NAME="$OPTARG" ;; - r) RELEASENAME="$OPTARG" ;; - s) SUITE="$OPTARG" ;; - t) TEMPLATE_DIRECTORY="$OPTARG";; o) OUTPUT="$OPTARG" CHROOT_OUTPUT="$OUTPUT/grml_chroot" BUILD_OUTPUT="$OUTPUT/grml_cd" ISO_OUTPUT="$OUTPUT/grml_isos" ;; + r) RELEASENAME="$OPTARG" ;; + s) SUITE="$OPTARG" ;; + t) TEMPLATE_DIRECTORY="$OPTARG";; v) VERSION="$OPTARG" ;; F) FORCE=1 ;; h) usage ; bailout 0 ;; @@ -174,6 +175,7 @@ while getopts "c:g:i:o:r:s:t:v:FhV" opt; do done shift $(($OPTIND - 1)) # set ARGV to the first not parsed commandline parameter +echo "Executing: $(basename $0) $*" >> $LOGFILE # }}} # some misc checks before executing FAI {{{ @@ -197,7 +199,9 @@ if [ -z "$FORCE" ] ; then [ -n "$RELEASENAME" ] && echo " release name: $RELEASENAME" [ -n "$VERSION" ] && echo " grml version: $VERSION" [ -n "$SUITE" ] && echo " Debian suite: $SUITE" + [ -n "$ARCH" ] && echo " Architecture: $ARCH" [ -n "$BOOT_METHOD" ] && echo " Boot method: $BOOT_METHOD" + [ -n "$TEMPLATE_DIRECTORY" ] && echo " Template files: $TEMPLATE_DIRECTORY" [ -n "$FAI_ARGS" ] && echo " additional arguments for FAI: $FAI_ARGS" [ -n "$VERBOSE" ] && echo " Using VERBOSE mode." echo @@ -241,9 +245,14 @@ if [ -n "$SUITE" ] ; then sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" $LIVE_CONF sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" /etc/grml/fai/apt/sources.list - DIST='\"etch\|=\"stable=\"lenny=\"testing=\"sid=\"unstable' - sed -i "s#FAI_DEBOOTSTRAP=$DIST#FAI_DEBOOTSTRAP=\"$SUITE#" $LIVE_CONF - sed -i "s#FAI_DEBOOTSTRAP=$DIST#FAI_DEBOOTSTRAP=\"$SUITE#" /etc/grml/fai/make-fai-nfsroot.conf + sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" $LIVE_CONF + sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" /etc/grml/fai/make-fai-nfsroot.conf +fi + +if [ "$(dpkg --print-architecture)" != "$ARCH" ] ; then + if ! grep -q -- 'FAI_DEBOOTSTRAP_OPTS.*--arch' /etc/grml/fai/make-fai-nfsroot.conf ; then + sed -i "s|FAI_DEBOOTSTRAP_OPTS=\"\(.*\)|FAI_DEBOOTSTRAP_OPTS=\"--arch $ARCH \1|" /etc/grml/fai/make-fai-nfsroot.conf + fi fi # }}} @@ -267,7 +276,10 @@ else # notice: 'fai dirinstall' does not seem to exit appropriate, so: ERROR='' if [ -r "/var/log/fai/dirinstall/$HOSTNAME/software.log" ] ; then + # 1 errors during executing of commands grep 'dpkg: error processing' /var/log/fai/dirinstall/$HOSTNAME/software.log >> $LOGFILE && ERROR=1 + grep 'E: Method http has died unexpectedly!' /var/log/fai/dirinstall/$HOSTNAME/software.log >> $LOGFILE && ERROR=2 + grep 'ERROR: chroot' /var/log/fai/dirinstall/$HOSTNAME/software.log >> $LOGFILE && ERROR=3 fi if [ -r "/var/log/fai/dirinstall/$HOSTNAME/shell.log" ] ; then @@ -275,10 +287,11 @@ else fi if [ -n "$ERROR" ] ; then - log "There was an error during execution of stage 'fai dirinstall' [$(date)]" + log "There was an error [${ERROR}] during execution of stage 'fai dirinstall' [$(date)]" eerror "There was an error during execution of stage 'fai dirinstall'" echo " Check out /var/log/fai/dirinstall/$HOSTNAME/ for details. [exit ${ERROR}]" - eend 1 ; exit 1 + eend 1 + bailout 1 else log "Finished execution of stage 'fai dirinstall' [$(date)]" einfo "Finished execution of stage 'fai dirinstall'" @@ -305,8 +318,7 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then # if we don't have an initrd we a) can't boot and b) there was an error # during build, so check for the file: if [ -f "$CHROOT_OUTPUT"/boot/initrd* ] ; then - # do not keep the initrd inside the chroot, let's save space instead: - mv "$CHROOT_OUTPUT"/boot/initrd* "$BUILD_OUTPUT"/boot/isolinux/initrd.gz + cp "$CHROOT_OUTPUT"/boot/initrd* "$BUILD_OUTPUT"/boot/isolinux/initrd.gz else log "No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting" eerror "No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1 @@ -319,6 +331,7 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then cp /usr/lib/syslinux/memdisk "$BUILD_OUTPUT"/boot/isolinux/ cp /usr/lib/syslinux/menu.c32 "$BUILD_OUTPUT"/boot/isolinux/ + [ -n "$TEMPLATE_DIRECTORY" ] || TEMPLATE_DIRECTORY='/usr/share/grml-live/templates' if ! [ -d "${TEMPLATE_DIRECTORY}"/boot ] ; then log "${TEMPLATE_DIRECTORY}/boot does not exist. Exiting." eerror "${TEMPLATE_DIRECTORY}/boot does not exist. Exiting." ; eend 1