mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-24 12:01:59 +01:00
Merge pull request #1434 from flatcar/krnowak/debug-output
Print debug output on any error
This commit is contained in:
commit
b7e13a2160
@ -67,14 +67,7 @@ create_prod_sysext() {
|
||||
sudo mv "${workdir}/sysext-build/${name}.raw" "${workdir}/sysext-build/${name}_pkginfo.raw" \
|
||||
"${workdir}/sysext-build/${name}"_*.txt "${output_dir}"
|
||||
|
||||
sudo mkdir -p "${install_root}"/usr/share/flatcar/sysext || {
|
||||
echo "DEBUG OUTPUT:"
|
||||
mount
|
||||
df -h
|
||||
sudo dmesg
|
||||
echo "END DEBUG OUTPUT"
|
||||
exit 1
|
||||
}
|
||||
sudo mkdir -p "${install_root}"/usr/share/flatcar/sysext
|
||||
sudo install -m 0644 -D "${output_dir}/${name}.raw" "${install_root}"/usr/share/flatcar/sysext/
|
||||
|
||||
sudo mkdir -p "${install_root}"/etc/extensions/
|
||||
|
||||
@ -83,6 +83,10 @@ FLAGS "$@" || exit 1
|
||||
|
||||
eval set -- "${FLAGS_ARGV}"
|
||||
|
||||
# Only now can we die on error. shflags functions leak non-zero error codes,
|
||||
# so will die prematurely if 'switch_to_strict_mode' is specified before now.
|
||||
switch_to_strict_mode -uo pipefail
|
||||
|
||||
# Validate command line parameters
|
||||
|
||||
SYSEXTNAME="${1:-}"
|
||||
@ -129,8 +133,6 @@ _get_sysext_arch() {
|
||||
fi
|
||||
}
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cleanup() {
|
||||
local dirs=(
|
||||
"${BUILD_DIR}/fs-root"
|
||||
|
||||
33
common.sh
33
common.sh
@ -164,9 +164,40 @@ die_notrace() {
|
||||
for line in "$@"; do
|
||||
error "${DIE_PREFIX}${line}"
|
||||
done
|
||||
if [[ ! -e "${SCRIPTS_DIR}/NO_DEBUG_OUTPUT_DELETE_ME" ]]; then
|
||||
error "${DIE_PREFIX}!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
error "${DIE_PREFIX}!! BEGIN DEBUG OUTPUT: !!"
|
||||
error "${DIE_PREFIX}!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
error
|
||||
error "${DIE_PREFIX}== MOUNT =="
|
||||
error "${DIE_PREFIX}==========="
|
||||
error_command_output "${DIE_PREFIX}" mount
|
||||
error
|
||||
error "${DIE_PREFIX}== DF =="
|
||||
error "${DIE_PREFIX}========"
|
||||
error_command_output "${DIE_PREFIX}" df -h
|
||||
error
|
||||
error "${DIE_PREFIX}== DMESG =="
|
||||
error "${DIE_PREFIX}==========="
|
||||
error_command_output "${DIE_PREFIX}" sudo dmesg
|
||||
error
|
||||
error "${DIE_PREFIX}!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
error "${DIE_PREFIX}!! END DEBUG OUTPUT: !!"
|
||||
error "${DIE_PREFIX}!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
touch "${SCRIPTS_DIR}/NO_DEBUG_OUTPUT_DELETE_ME"
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
error_command_output() {
|
||||
local prefix=${1}; shift
|
||||
# rest are a command to execute
|
||||
local REPLY
|
||||
while read -r; do
|
||||
error "${prefix}${REPLY}"
|
||||
done < <("${@}" 2>&1)
|
||||
}
|
||||
|
||||
# Simple version comparison routine
|
||||
# Note: not a true semver comparison and build revisions are ignored
|
||||
cmp_ver() {
|
||||
@ -296,6 +327,8 @@ BUILD_LIBRARY_DIR="${SCRIPTS_DIR}/build_library"
|
||||
REPO_CACHE_DIR="${REPO_ROOT}/.cache"
|
||||
REPO_MANIFESTS_DIR="${REPO_ROOT}/.repo/manifests"
|
||||
|
||||
rm -f "${SCRIPTS_DIR}/NO_DEBUG_OUTPUT_DELETE_ME" || :
|
||||
|
||||
# Source FLATCAR_VERSION_ID from manifest.
|
||||
if [[ -f "${REPO_MANIFESTS_DIR}/version.txt" ]]; then
|
||||
# The build id may be provided externally by the build system.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user