Skip to content

Commit

Permalink
Store logfiles also when FAI's dirinstall fails
Browse files Browse the repository at this point in the history
With the ongoing bsdmainutils transition grml32-small_sid failed
to build and we don't have any log files for debugging in our jenkins
builds. Ensure to store logfiles also when the fai dirinstall run
failed.
  • Loading branch information
mika committed Jul 10, 2020
1 parent b090c76 commit 5c3e795
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions grml-live
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,24 @@ umount_all() {
}
# }}}

# store logfiles {{{
store_logfiles() {
# move fai logs into grml_logs directory
mkdir -p "$LOG_OUTPUT"/fai/
cp -r "$CHROOT_OUTPUT"/var/log/fai/"$HOSTNAME"/last/* "$LOG_OUTPUT"/fai/
rm -rf "$CHROOT_OUTPUT"/var/log/fai

# store copy of autogenerated configuration file
cp ${GRML_FAI_CONFIG}/nfsroot.conf "$LOG_OUTPUT"/fai/

# copy fai package list
cp "$CHROOT_OUTPUT"/var/log/install_packages.list "$LOG_OUTPUT"/fai/
# fixup owners
chown root:adm "$LOG_OUTPUT"/fai/*
chmod 664 "$LOG_OUTPUT"/fai/*
}
# }}}

# clean exit {{{
bailout() {
rm -f /var/run/fai/fai_softupdate_is_running \
Expand Down Expand Up @@ -745,9 +763,10 @@ else
RC="$PIPESTATUS" # notice: bash-only

if [ "$RC" != 0 ] ; then
log "Error: critical error while executing fai [exit code ${RC}]. Exiting."
eerror "Error: critical error while executing fai [exit code ${RC}]. Exiting." ; eend 1
bailout 1
store_logfiles # ensure to have logfiles available even if building failed
log "Error: critical error while executing fai [exit code ${RC}]. Exiting."
eerror "Error: critical error while executing fai [exit code ${RC}]. Exiting." ; eend 1
bailout 1
fi

# provide inform fai about the ISO we build, needs to be provided
Expand All @@ -759,19 +778,7 @@ else

FORCE_ISO_REBUILD=true

# move fai logs into grml_logs directory
mkdir -p "$LOG_OUTPUT"/fai/
cp -r "$CHROOT_OUTPUT"/var/log/fai/"$HOSTNAME"/last/* "$LOG_OUTPUT"/fai/
rm -rf "$CHROOT_OUTPUT"/var/log/fai

# store copy of autogenerated configuration file
cp ${GRML_FAI_CONFIG}/nfsroot.conf "$LOG_OUTPUT"/fai/

# copy fai package list
cp "$CHROOT_OUTPUT"/var/log/install_packages.list "$LOG_OUTPUT"/fai/
# fixup owners
chown root:adm "$LOG_OUTPUT"/fai/*
chmod 664 "$LOG_OUTPUT"/fai/*
store_logfiles

umount_all

Expand Down

0 comments on commit 5c3e795

Please sign in to comment.