Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions build-scripts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ mount_procfs()
# fatal "exiting with default error code"
fatal()
{
echo "FATAL ERROR: $1" >&2
echo "$(basename "$0"): FATAL ERROR: $1" >&2
exit ${2-1}
}

Expand Down Expand Up @@ -601,7 +601,22 @@ rm_if_empty()
run_and_print_on_failure()
{
local temp_output_file
temp_output_file=$(mktemp)
if command -v mktemp >/dev/null; then
temp_output_file=$(mktemp)
else
# AIX 7.1 does not have mktemp
while true; do
# shellcheck disable=SC2021
# ^^ legacy/POSIX requires square brackets
temp_output_file="$(LC_CTYPE=C tr -dc "[A-Z][a-z][0-9]" </dev/urandom | dd count=1 bs=8 2>/dev/null)"
if [ -f "$temp_output_file" ]; then
continue
fi
break;
done
touch "$temp_output_file"
fi

local exit_code=0
if "$@" > "$temp_output_file" 2>&1; then
: # NOOP
Expand Down
Loading