Skip to content

Commit

Permalink
Add env vars sanity check back into updater.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
aartoni committed Nov 25, 2024
1 parent 1c58991 commit cdb4292
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,17 @@ _arkenfox_init() {
while IFS='=' read -r name code; do
# Trim trailing whitespace characters. Needed for zsh and yash.
code=${code%"${code##*[![:space:]]}"} # https://stackoverflow.com/a/3352015
# "When reporting the exit status with the special parameter '?',
# the shell shall report the full eight bits of exit status available."
# ―https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_02
# "exit [n]: If n is specified, but its value is not between 0 and 255
# inclusively, the exit status is undefined."
# ―https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_21
[ "$code" -ge 0 ] && [ "$code" -le 255 ] || {
printf '%s %s\n' 'Undefined exit status in the definition:' \
"$name=$code." >&2
return 70 # Internal software error.
}
(eval readonly "$name=$code" 2>/dev/null) &&
eval readonly "$name=$code" || {
eval [ "\"\$$name\"" = "$code" ] &&
Expand Down

0 comments on commit cdb4292

Please sign in to comment.