syntax check before parsing config files
authorPatrick Schleizer <adrelanos@whonix.org>
Sat, 18 Nov 2023 04:22:52 +0000 (23:22 -0500)
committerPatrick Schleizer <adrelanos@whonix.org>
Thu, 7 Dec 2023 18:51:55 +0000 (13:51 -0500)
chroot-script
grml-debootstrap

index ec2453a..7726ecd 100755 (executable)
@@ -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
 
index 759deae..5173dc1 100755 (executable)
@@ -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