X-Git-Url: https://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=grml-live;h=ca23f83c0b83e64ed41c36378a9f1beb6df50373;hp=910ce2e30572bd694cfb973ab95c9c7e5954b02c;hb=4152229391fd4af0ab4b88408a3efff2e7f52f37;hpb=4a69794ace57fce6df38354f1b9f73ff0bc5804b diff --git a/grml-live b/grml-live index 910ce2e..ca23f83 100755 --- a/grml-live +++ b/grml-live @@ -160,13 +160,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: @@ -215,26 +208,39 @@ extend_string_end() { echo -ne "\n" } -# Copy addonfile $1 from the TEMPLATE_DIRECTORY/compat (if exists), -# or from $2 (the system path), or warn about the missing file. +# Copy addonfile $1 from either +# * the chroot (via $2, the system path), +# * or from TEMPLATE_DIRECTORY/compat (if exists), +# * or from the host system (again, using $2), +# or warn about the missing file. +# # This is because: +# * We assume that the chroot always has a "good" version of +# the file. Also it makes sources handling easier. # * On unstable, we Recommend the Debian packages containing # these files. The user can override them by putting his -# "better" version into TEMPLATE_DIRECTORY/compat. +# "better" version into the chroot. # * On stable, the Debian packages are probably not available, # or outdated, so we look in TEMPLATE_DIRECTORY/compat first, where # our grml-live-compat package installs current file versions. copy_addon_file() { - if [ ! -d "${BUILD_OUTPUT}/boot/$3/" ]; then - mkdir -p "${BUILD_OUTPUT}/boot/$3" + DEST="${BUILD_OUTPUT}/boot/$3" + if [ ! -d "${DEST}/" ]; then + mkdir -p "${DEST}" + fi + if [ -e "$CHROOT_OUTPUT/$2/$1" ]; then + log "Copying $1 from chroot" + cp "$CHROOT_OUTPUT/$2/$1" "${DEST}/" + return $? fi if [ -e "${TEMPLATE_DIRECTORY}/compat/$3/$1" ]; then - cp "${TEMPLATE_DIRECTORY}/compat/$3/$1" "${BUILD_OUTPUT}/boot/$3/" + log "Copying $1 from grml-live-compat" + cp "${TEMPLATE_DIRECTORY}/compat/$3/$1" "${DEST}/" return $? fi if [ -e "$2/$1" ]; then log "Copying $1 from system" - cp "$2/$1" "${BUILD_OUTPUT}/boot/$3/" + cp "$2/$1" "${DEST}/" return $? fi @@ -247,10 +253,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 # }}} @@ -390,6 +394,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 @@ -426,6 +438,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" @@ -607,11 +622,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