From 4812ce411ed1a55de53c4c611d616d9b5149b9b4 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Fri, 17 Nov 2023 23:22:52 -0500 Subject: [PATCH] syntax check before parsing config files --- chroot-script | 2 ++ grml-debootstrap | 2 ++ 2 files changed, 4 insertions(+) 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 -- 2.1.4