summaryrefslogtreecommitdiff
path: root/functions/packageslists.sh
diff options
context:
space:
mode:
authorChris Lamb <chris@chris-lamb.co.uk>2008-04-28 17:05:30 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 19:03:34 +0100
commita5134fe7285bc31f4e9235678a31e2ed5efd8f2c (patch)
treed1d82d3ddf16e615b1401fe43acfde2225bfefe6 /functions/packageslists.sh
parent261e5655b3a93deb75f9be4c4c5beffc8fd42e36 (diff)
downloadlive-build-a5134fe7285bc31f4e9235678a31e2ed5efd8f2c.zip
live-build-a5134fe7285bc31f4e9235678a31e2ed5efd8f2c.tar.gz
Allow needle and haystack parts of packagelist #if constructs to be lists
This allows us to write: #if SECTIONS contrib non-free contrib-package non-free-package #endif and #if DISTRIBUTION lenny sid new-package #endif
Diffstat (limited to 'functions/packageslists.sh')
-rwxr-xr-xfunctions/packageslists.sh22
1 files changed, 14 insertions, 8 deletions
diff --git a/functions/packageslists.sh b/functions/packageslists.sh
index 733e8f2..023b984 100755
--- a/functions/packageslists.sh
+++ b/functions/packageslists.sh
@@ -46,16 +46,22 @@ Expand_packagelist ()
echo "E: Nesting conditionals is not supported" >&2
exit 1
fi
-
_LH_NESTED=1
- _LH_VAR="$(echo "${_LH_LINE}" | cut -d' ' -f2)"
- _LH_VAL="$(echo "${_LH_LINE}" | cut -d' ' -f3-)"
- _LH_MATCH="$(echo ${_LH_VAL} |grep "\(^\| \)$(eval "echo \$LH_${_LH_VAR}")\($\| \)")" || true
- if [ -n "${_LH_VAR}" ] && [ -z "${_LH_MATCH}" ]
- then
- _LH_ENABLED=0
- fi
+ _LH_NEEDLE="$(echo "${_LH_LINE}" | cut -d' ' -f3-)"
+ _LH_HAYSTACK="$(eval "echo \$LH_$(echo "${_LH_LINE}" | cut -d' ' -f2)")"
+
+ _LH_ENABLED=0
+ for _LH_NEEDLE_PART in ${_LH_NEEDLE}
+ do
+ for _LH_HAYSTACK_PART in ${_LH_HAYSTACK}
+ do
+ if [ "${_LH_NEEDLE_PART}" = "${_LH_HAYSTACK_PART}" ]
+ then
+ _LH_ENABLED=1
+ fi
+ done
+ done
;;
\#endif*)