From: Patrick Schleizer Date: Sat, 18 Nov 2023 04:22:52 +0000 (-0500) Subject: syntax check before parsing config files X-Git-Tag: v0.106~7^2~9 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=4812ce411ed1a55de53c4c611d616d9b5149b9b4 syntax check before parsing config files --- diff --git a/chroot-script b/chroot-script index ec2453a..7726ecd 100755 --- a/chroot-script +++ b/chroot-script @@ -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 diff --git a/grml-debootstrap b/grml-debootstrap index 759deae..5173dc1 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -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 @@ -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