summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/control.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/control.sh b/lib/control.sh
index 0fdd715..248b422 100644
--- a/lib/control.sh
+++ b/lib/control.sh
@@ -244,6 +244,9 @@ ob_set_binary_substvar()
# Trim leading and trailing whitespace from value.
value="$(printf '%s' "${value}" | sed -n "${_OB_SUBSTVAR_TRIM_SED}")"
+ # Convert package name to clean form.
+ package="$(printf '%s' "${package}" | tr 'a-z' 'A-Z' | tr -dC 'A-Z0-9')"
+
# TODO: Maybe disallow variable names beginning with hyphens, and/or
# otherwise make this safer.
eval "_OB_SUBSTVAR_BIN_${package}__${name}=\"\${value}\""
@@ -322,6 +325,8 @@ ob_substvars()
# Perform the substitution.
name_tr="$(printf '%s' "${name}" | tr 'a-z-' 'A-Z_')"
+ package="$(printf '%s' "${package}" | tr 'a-z' 'A-Z' | \
+ tr -dC 'A-Z0-9')"
if eval "[ x\"\${_OB_SUBSTVAR_SRC_${name_tr}:+set}\" = x'set' ]"
then
name_tr="_OB_SUBSTVAR_SRC_${name_tr}"