summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/control.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/control.sh b/lib/control.sh
index 22ed8a5..ddd7cc9 100644
--- a/lib/control.sh
+++ b/lib/control.sh
@@ -256,15 +256,16 @@ ob_set_binary_substvar()
## variable substitutions is \fI${var}\fP, and substitutions can be
## nested.
## @operand string req The string in which to substitute variables.
-## @operand package req The binary package for which to substitute variables.
+## @operand package opt The binary package for which to substitute variables.
## @return Returns 0 on success or 1 on possible recursion.
## @stderr Prints a warning on possible recursion.
## @pure yes This function has no side effects.
ob_substvars()
{
local string="${1}"
- local package="${2}"
- shift 2 || _ob_abort
+ shift 1 || _ob_abort
+ local check_bin=
+ local package=
local depth=
local lhs=
local name=
@@ -272,6 +273,13 @@ ob_substvars()
local old_rhs=
local value=
+ check_bin=false
+ if [ ${#} -eq 1 ]; then
+ package="${1}"
+ shift 1
+ check_bin=true
+ fi
+
# Logic inspired by that of dpkg's Dpkg::Substvars::substvars()
# subroutine.
@@ -318,7 +326,7 @@ ob_substvars()
if eval "[ x\"\${_OB_SUBSTVAR_SRC_${name}:+set}\" = x'set' ]"
then
name="_OB_SUBSTVAR_SRC_${name}"
- elif [ -n "${package}" ] && eval "[ x\"\${_OB_SUBSTVAR_BIN_$(: \
+ elif ${check_bin} && eval "[ x\"\${_OB_SUBSTVAR_BIN_$(: \
)${package}__${name}:+set}\" = x'set' ]"; then
name="_OB_SUBSTVAR_BIN_${package}__${name}"
else