summaryrefslogtreecommitdiffstats
path: root/remote/setup_target
diff options
context:
space:
mode:
authorSimon Rettberg2013-09-10 13:50:53 +0200
committerJonathan Bauer2013-09-30 13:22:05 +0200
commit31dc912057bb24e2077e62d8d0d72f9a35ba1daf (patch)
tree427c7d3f6ad9737fc897a000f5edc8b7ff0c17b9 /remote/setup_target
parent[vmchooser] Fix config variable naming (diff)
downloadtm-scripts-31dc912057bb24e2077e62d8d0d72f9a35ba1daf.tar.gz
tm-scripts-31dc912057bb24e2077e62d8d0d72f9a35ba1daf.tar.xz
tm-scripts-31dc912057bb24e2077e62d8d0d72f9a35ba1daf.zip
[setup_target] Check config files for invalid variable names
Diffstat (limited to 'remote/setup_target')
-rwxr-xr-xremote/setup_target14
1 files changed, 13 insertions, 1 deletions
diff --git a/remote/setup_target b/remote/setup_target
index b783729f..04af2158 100755
--- a/remote/setup_target
+++ b/remote/setup_target
@@ -74,6 +74,7 @@ read_config () {
# sanity checks
[ ! -e "${MODULE_CONFIG}" ] && perror "Config for '$MODULE' not found."
+ validate_config "$MODULE_CONFIG"
# source the config file
. "${MODULE_CONFIG}" || perror "Sourcing '${MODULE_CONFIG}' failed."
# sanity checks - no distribution specific things in the global config
@@ -85,13 +86,24 @@ read_config () {
for FILE in $SYS_VERSIONS; do
if [ -e "${MODULE_CONFIG}.${FILE}" ]; then
# a specific tool.conf seems to exist, use it to override/extend certain vars
- . "${MODULE_CONFIG}.${FILE}" || perror "Sourcing '${MODULE_CONFIG}.${PACKET_MANAGER}' failed."
+ validate_config "${MODULE_CONFIG}.${FILE}"
+ . "${MODULE_CONFIG}.${FILE}" || perror "Sourcing '${MODULE_CONFIG}.${FILE}' failed."
pinfo "Sourced distribution specific ${MODULE_CONFIG}.${FILE}"
break
fi
done
}
+validate_config () {
+ local INVALID=$(grep -h -E -o '^\s*\w+=' "$1" | grep -v -E '^\s*REQUIRED_')
+ [ -z "$INVALID" ] && return 0
+ local i
+ for i in $INVALID; do
+ pwarning "Invalid variable $i"
+ done
+ perror "$1 contains invalid variables. All variables must start with REQUIRED_"
+}
+
#
# generic function to read the build script of the current $MODULE
#