ready to begin chapter 9

This commit is contained in:
phanes
2023-03-17 01:34:10 -04:00
parent 89a7e712ae
commit 1f5d82d752
7 changed files with 93 additions and 5 deletions

View File

@@ -0,0 +1,46 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
APPNAME="post-stage4-cleanup"
# the file to log to
LOGFILE="${APPNAME}.log"
# ISO 8601 variation
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
# the path where logs are written to
# note: LOGS_ROOT is sourced from environment
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
# print to stdout, print to log
logprint() {
mkdir -p "${LOG_DIR}"
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
| tee -a "${LOG_DIR}/${LOGFILE}"
}
# Tell the user we're alive...
logprint "Initializing the ${APPNAME} utility..."
logprint "Cleanup of /tmp"
rm -rf /tmp/*
assert_zero $?
logprint "Erasing libtool archive files"
find /usr/lib /usr/libexec -name \*.la -delete
assert_zero $?
logprint "Deleting temporary toolchain..."
find /usr -depth -name ${T_TRIPLET}\* | xargs rm -vrf
assert_zero $?
# TODO better integrate test user lifecycle
logprint "Execution of ${APPNAME} completed."