do not fail with empty $APT_PROXY
[grml-live.git] / grml-live
index 351854d..36581d1 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -118,6 +118,12 @@ BUILD_DIRTY=''
 BOOTSTRAP_ONLY=''
 HOSTNAME=''
 
+# don't use colors/escape sequences
+if [ -r /lib/lsb/init-functions ] ; then
+  . /lib/lsb/init-functions
+  ! log_use_fancy_output && NOCOLORS=true
+fi
+
 if [ -r /etc/grml/lsb-functions ] ; then
    . /etc/grml/lsb-functions
 else
@@ -160,13 +166,6 @@ trap bailout 1 2 3 3 6 9 14 15
 trap umount_all EXIT
 # }}}
 
-# log file stuff {{{
-[ -n "$LOGFILE" ] || LOGFILE=/var/log/grml-live.log
-touch $LOGFILE
-chown root:adm $LOGFILE
-chmod 664 $LOGFILE
-# }}}
-
 # some important functions {{{
 
 # log output:
@@ -260,10 +259,8 @@ copy_addon_file() {
 # read local (non-packaged) configuration {{{
 LOCAL_CONFIG=/etc/grml/grml-live.local
 if [ -r "$LOCAL_CONFIG" ] ; then
-   log "Sourcing $LOCAL_CONFIG"
    . $LOCAL_CONFIG
 else
-   log "No $LOCAL_CONFIG found, not sourcing it"
    LOCAL_CONFIG=''
 fi
 # }}}
@@ -403,6 +400,14 @@ if [ -z "$FORCE" ] ; then
 fi
 # }}}
 
+# create log file {{{
+[ -n "$LOGFILE" ] || LOGFILE=${OUTPUT}/grml_logs/grml-live.log
+mkdir -p $(dirname "${LOGFILE}")
+touch $LOGFILE
+chown root:adm $LOGFILE
+chmod 664 $LOGFILE
+# }}}
+
 # clean/zero/remove logfiles {{{
 
 if [ -n "$PRESERVE_LOGFILE" ] ; then
@@ -439,6 +444,9 @@ fi
 start_seconds=$(cut -d . -f 1 /proc/uptime)
 log "------------------------------------------------------------------------------"
 log "Starting grml-live [${GRML_LIVE_VERSION}] run on $(date)"
+if [ -n "$LOCAL_CONFIG" ]; then
+  log "Using local config file: $LOCAL_CONFIG"
+fi
 log "Executed grml-live command line:"
 log "$CMDLINE"
 
@@ -620,11 +628,15 @@ else
          eend $?
       fi
 
+      # move fai logs into grml_logs directory
+      mkdir -p "$OUTPUT"/grml_logs/fai/
+      cp -r "$CHROOT_OUTPUT"/var/log/fai/"$HOSTNAME"/last/* "$OUTPUT"/grml_logs/fai/
+      chown root:adm "$OUTPUT"/grml_logs/fai/*
+      chmod 664 "$OUTPUT"/grml_logs/fai/*
+      rm -rf "$CHROOT_OUTPUT"/var/log/fai
+
       # Remove all FAI logs from chroot if class RELEASE is used:
-      if [ -f "$CHROOT_OUTPUT"/etc/grml_fai_release ] ; then
-         rm -rf "$CHROOT_OUTPUT"/var/log/fai/*
-         rm -f "$CHROOT_OUTPUT"/var/log/install_packages.list
-      fi
+      rm -f "$CHROOT_OUTPUT"/var/log/install_packages.list
 
       umount_all