X-Git-Url: http://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=grml-live;h=ca23f83c0b83e64ed41c36378a9f1beb6df50373;hp=e983f429181e6549f110f058731fe0ad9defe8b0;hb=082aac8a2fb271ad75b18ca2c5d19112c33b54de;hpb=c45c99538dae4b2e3a2d50d21f4f7e0092bcf514 diff --git a/grml-live b/grml-live index e983f42..ca23f83 100755 --- a/grml-live +++ b/grml-live @@ -24,7 +24,7 @@ fi # set -e # global variables -GRML_LIVE_VERSION='0.15.1' +GRML_LIVE_VERSION='0.16.1' PN="$(basename $0)" CMDLINE="$0 $@" ADDONS_LIST_FILE='/boot/isolinux/addons_list.cfg' @@ -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 - echo "Copying $1 from system" - cp "$2/$1" "${BUILD_OUTPUT}/boot/$3/" + log "Copying $1 from system" + 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 @@ -755,8 +774,8 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then if [ -d "$TEMPLATE_DIRECTORY"/boot/addons/bsd4grml ] ; then cp -a ${TEMPLATE_DIRECTORY}/boot/addons/bsd4grml "$BUILD_OUTPUT"/boot/addons/ else - log "bsd4grml addon not found, skipping therefore." - ewarn "bsd4grml addon not found, skipping therefore." ; eend 0 + log "Missing addon file: bsd4grml" + ewarn "Missing addon file: bsd4grml" ; eend 0 fi fi @@ -771,18 +790,21 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then if [ -e ${TEMPLATE_DIRECTORY}/compat/grub/linux.mod ]; then cp "${TEMPLATE_DIRECTORY}"/compat/grub/* "${BUILD_OUTPUT}"/boot/grub/ else - if ! [ -x /usr/bin/grub-mkimage ] ; then + if ! which "grub-mkimage" >/dev/null 2>&1 ; then log "grub-mkimage not found, skipping Grub step therefore." ; eend 0 ewarn "grub-mkimage not found, skipping Grub step therefore." - ewarn "Either install grub-common >= 1.98+20100804-14 or grub-pc." ; eend 0 + ewarn "Please install grub-pc-bin or grub-common >= 1.98+20100804-14." ; eend 0 + elif ! grub-mkimage --help | grep -q -- --format ; then + log "grub-mkimage does not support --format=i386-pc, skipping Grub step therefore." ; eend 0 + ewarn "grub-mkimage does not support --format=i386-pc, skipping Grub step therefore." + ewarn "Please install grub-common >= 1.98+20100804-14 or grub-pc-bin." ; eend 0 else - # copy system grub files if grml-live-compat is not - # installed. + # copy system grub files if grml-live-compat is not installed cp -a /usr/lib/grub/*-pc/*.mod "${BUILD_OUTPUT}"/boot/grub/ cp -a /usr/lib/grub/*-pc/*.o "${BUILD_OUTPUT}"/boot/grub/ cp -a /usr/lib/grub/*-pc/*.lst "${BUILD_OUTPUT}"/boot/grub/ cp -a /usr/share/grub/ascii.pf2 "${BUILD_OUTPUT}"/boot/grub/ - /usr/bin/grub-mkimage -d /usr/lib/grub/*-pc -o \ + grub-mkimage -d /usr/lib/grub/*-pc -o \ "${BUILD_OUTPUT}/boot/grub/core.img" biosdisk iso9660 --format=i386-pc fi fi