Skip to content

Commit

Permalink
syntax check before parsing config files
Browse files Browse the repository at this point in the history
  • Loading branch information
adrelanos committed Dec 7, 2023
1 parent 521689a commit 4812ce4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions chroot-script
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ set -o pipefail
trap "error_handler" ERR
# }}}

bash -n /etc/debootstrap/config
# shellcheck source=config
. /etc/debootstrap/config || exit 1
bash -n /etc/debootstrap/variables
# shellcheck source=tests/shellcheck-stub-debootstrap-variables
. /etc/debootstrap/variables || exit 1

Expand Down
2 changes: 2 additions & 0 deletions grml-debootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ stage() {

# source main configuration file {{{
if [ -r /etc/debootstrap/config ] ; then
bash -n /etc/debootstrap/config
# shellcheck disable=SC1091
. /etc/debootstrap/config
fi
Expand Down Expand Up @@ -657,6 +658,7 @@ fi
# source specified configuration file {{{
if [ -n "$CONFIGFILE" ] ; then
einfo "Reading specified config file $CONFIGFILE."
bash -n "$CONFIGFILE"
# shellcheck disable=SC1091 source=config
if ! . "$CONFIGFILE" ; then
eerror "Error reading config file $CONFIGFILE" ; bailout 1
Expand Down

0 comments on commit 4812ce4

Please sign in to comment.