Skip to content

Commit

Permalink
minifai: write logs into /grml-live/log/
Browse files Browse the repository at this point in the history
Somewhat easier to deal with, as grml-live ensures this will not
exist in the packed chroot.
  • Loading branch information
zeha committed Jan 7, 2025
1 parent 7a3cf36 commit c1afa18
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/scripts/GRMLBASE/01-packages
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ echo -n > "${LOGDIR}"/package_errors.log # ensure we start with an empty file
TMPSTDOUT=$(mktemp)
TMPSTDERR=$(mktemp)

PACKAGE_LIST=/var/log/grml-live-minifai/install_packages.list
PACKAGE_LIST=/grml-live/log/install_packages.list
# 1) catch packages that are not in state 'ii' (marked for installation
# and successfully instead) on stdout
# 2) catch error messages like 'dpkg-query: no packages found matching $package"
Expand Down
2 changes: 1 addition & 1 deletion config/scripts/GRMLBASE/98-clean-chroot
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ nuke(){
zero(){
while IFS= read -r -d '' file ; do
:> "$file"
done < <(find "$@" -type f -size +0 -not -name \*.ini -not -path '*/grml-live-minifai/*' -print0 2>/dev/null)
done < <(find "$@" -type f -size +0 -not -name \*.ini -print0 2>/dev/null)
}

echo "Removing possible leftovers from update-pciids runs"
Expand Down
11 changes: 6 additions & 5 deletions grml-live
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ umount_all() {
store_logfiles() {
# move minifai logs into grml_logs directory
mkdir -p "$LOG_OUTPUT"/fai/
cp -r "$CHROOT_OUTPUT"/var/log/grml-live-minifai/* "$LOG_OUTPUT"/fai/
rm -rf "$CHROOT_OUTPUT"/var/log/grml-live-minifai
cp -r "$CHROOT_OUTPUT"/grml-live/log/* "$LOG_OUTPUT"/fai/
rm -rf "$CHROOT_OUTPUT"/grml-live/log

# fixup owners
chown root:adm "$LOG_OUTPUT"/fai/*
Expand Down Expand Up @@ -725,8 +725,11 @@ else
"${FAI_PROGRAM}" "${GRML_FAI_CONFIG}" "${CLASSES}" "${FAI_ACTION}" "${CHROOT_OUTPUT}" "${CONFIGDUMP}" ${FAI_DEBOOTSTRAP} 2>&1 | tee -a "${LOGFILE}"
RC="${PIPESTATUS[0]}" # notice: bash-only

# Fetches logs from "${CHROOT_OUTPUT}"/grml-live/log.
# Also run this on failure.
store_logfiles

if [ "$RC" != 0 ] ; then
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
Expand All @@ -744,8 +747,6 @@ else

FORCE_ISO_REBUILD=true

store_logfiles

umount_all

log "Finished execution of stage 'fai $FAI_ACTION' [$(date)]"
Expand Down
2 changes: 1 addition & 1 deletion usr/lib/grml-live/minifai
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ def policy_rcd(chroot_dir: Path):


def create_logdir(chroot_dir: Path) -> Path:
log_dir = chroot_dir / "var" / "log" / "grml-live-minifai"
log_dir = chroot_dir / "grml-live" / "log"
if log_dir.exists():
print(f"I: Deleting log directory from previous run: {log_dir}")
shutil.rmtree(log_dir)
Expand Down

0 comments on commit c1afa18

Please sign in to comment.