X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=grml-live;h=3985cb2bb5d979c7415d0f71e8596c24f069597d;hb=c23c39452bb602f31b03b3a4a92e43e6eb06615f;hp=9c55ab6f5ce07be5517cfaa22b31f3f39edc307f;hpb=c98c8fdb7ce349dca24c1f6fdeabfcd03e620f22;p=grml-live.git diff --git a/grml-live b/grml-live index 9c55ab6..3985cb2 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: Mon Nov 05 09:24:45 CET 2007 [mika] +# Latest change: Sun Nov 25 18:29:07 CET 2007 [mika] ################################################################################ # read configuration files, set some misc variables {{{ @@ -15,7 +15,7 @@ export LC_ALL=C # exit on any error: set -e -GRML_LIVE_VERSION='0.0.7' +GRML_LIVE_VERSION='0.0.10' CMDLINE="$0 $@" ISO_DATE="$(date +%Y-%m-%d)" @@ -31,6 +31,7 @@ if [ -r /var/run/fai/FAI_INSTALLATION_IN_PROGRESS ] ; then exit 1 fi +# see #449236 if [ -r /var/run/fai/fai_softupdate_is_running ] ; then echo "/usr/sbin/fai softupdate already running or was aborted before.">&2 echo "You may remove /var/run/fai/fai_softupdate_is_running and try again.">&2 @@ -94,6 +95,14 @@ if [ -n "$ZERO_LOGFILE" ] ; then echo -n > $LOGFILE fi +if [ -n "$ZERO_FAI_LOGFILE" ] ; then + if [ -d /var/log/fai/"$HOSTNAME" ] ; then + rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink last)" + rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink last-softupdate)" + rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink last-dirinstall)" + fi +fi + NFSROOT_CONF=/etc/grml/fai/make-fai-nfsroot.conf # }}} @@ -178,10 +187,11 @@ http://grml.org/bugs/ # command line parsing {{{ -while getopts "a:c:g:i:o:r:s:t:v:FhuV" opt; do +while getopts "a:C:c:g:i:o:r:s:t:v:FhuV" opt; do case "$opt" in a) ARCH="$OPTARG" ;; c) CLASSES="$OPTARG" ;; + C) CONFIG="$OPTARG" ;; g) GRML_NAME="$OPTARG" ;; i) ISO_NAME="$OPTARG" ;; o) OUTPUT="$OPTARG" @@ -217,6 +227,7 @@ if [ -z "$FORCE" ] ; then echo echo " FAI classes: $CLASSES" echo " main directory: $OUTPUT" + [ -n "$CONFIG" ] && echo " configuration: $CONFIG" [ -n "$CHROOT_OUTPUT" ] && echo " chroot target: $CHROOT_OUTPUT" [ -n "$BUILD_OUTPUT" ] && echo " build target: $BUILD_OUTPUT" [ -n "$ISO_OUTPUT" ] && echo " ISO target: $ISO_OUTPUT" @@ -240,10 +251,31 @@ if [ -z "$FORCE" ] ; then echo fi +# read local (non-packaged) configuration: +LOCAL_CONFIG=/etc/grml/grml-live.local +if [ -r "$LOCAL_CONFIG" ] ; then + log "Sourcing $LOCAL_CONFIG" + . $LOCAL_CONFIG +else + LOCAL_CONFIG='' +fi + +if [ -n "$CONFIG" ] ; then + if ! [ -f "$CONFIG" ] ; then + log "Sorry, $CONFIG could not be read. Exiting. [$(date)]" + eerror "Sorry, $CONFIG could not be read. Exiting." + bailout 1 + else + log "Sourcing $CONFIG" + . $CONFIG + fi +fi + start_seconds=$(cut -d . -f 1 /proc/uptime) log "------------------------------------------------------------------------------" log "Starting grml-live [${GRML_LIVE_VERSION}] run on $(date)" -log "Executed command line: $CMDLINE" +log "Executed grml-live command line:" +log "$CMDLINE" einfo "Logging actions to logfile $LOGFILE" # }}} @@ -269,10 +301,15 @@ fi # does this suck? YES! if [ -n "$SUITE" ] ; then - sed -i "s/SUITE=.*/SUITE=\"$SUITE\"/" $LIVE_CONF - DIST="\|\ etch\ \|\ stable\ \|\ lenny\ \|\ testing\ \|\ sid\ \|\ unstable\ " - sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" $LIVE_CONF + for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do + if [ -n "$file" ] ; then + sed -i "s/SUITE=.*/SUITE=\"$SUITE\"/" $LIVE_CONF + DIST="\|\ etch\ \|\ stable\ \|\ lenny\ \|\ testing\ \|\ sid\ \|\ unstable\ " + sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" $file + fi + done + sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" /etc/grml/fai/apt/sources.list # notice: activate grml-live pool only if we are building against unstable: if grep -qe unstable -qe sid /etc/grml/fai/apt/sources.list ; then @@ -284,7 +321,11 @@ if [ -n "$SUITE" ] ; then sed -i 's/.*grml-live.*/# removed grml-live repository/' /etc/grml/fai/apt/sources.list fi - sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" $LIVE_CONF + for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do + if [ -n "$file" ] ; then + sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$file" + fi + done sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" $NFSROOT_CONF fi @@ -320,10 +361,14 @@ if [ -d "$CHROOT_OUTPUT/bin" -a -z "$UPDATE" ] ; then ewarn "$CHROOT_OUTPUT exists already, skipping stage 'fai dirinstall'" ; eend 0 else mkdir -p "$CHROOT_OUTPUT" || bailout 5 "Problem with creating $CHROOT_OUTPUT for FAI" + if [ -n "${MIRROR_DIRECTORY}" ] ; then mkdir -p "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}" mount --bind "${MIRROR_DIRECTORY}" "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}" fi + + log "Executed FAI command line:" + log "fai $VERBOSE -C $GRML_FAI_CONFIG -c$CLASSES -u $HOSTNAME $FAI_ACTION $CHROOT_OUTPUT $FAI_ARGS" fai $VERBOSE -C "$GRML_FAI_CONFIG" -c"$CLASSES" -u "$HOSTNAME" $FAI_ACTION "$CHROOT_OUTPUT" $FAI_ARGS | tee -a $LOGFILE log "Setting /etc/grml_version to $GRML_NAME $VERSION Release Codename $RELEASENAME [$ISO_DATE]" @@ -341,11 +386,7 @@ else # notice: 'fai dirinstall' does not seem to exit appropriate, so: ERROR='' - if [ -n "$UPDATE" ] ; then - CHECKLOG=/var/log/fai/current/ - else - CHECKLOG=/var/log/fai/dirinstall/$HOSTNAME/ - fi + CHECKLOG=/var/log/fai/$HOSTNAME/last if [ -r "$CHECKLOG/software.log" ] ; then # 1 errors during executing of commands # Unable to write mmap - msync (28 No space left on device)