Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2012-07-22 13:25:46 (GMT)
committer Daniel Drake <dsd@laptop.org>2012-08-08 02:47:44 (GMT)
commitac534ba156774f42e3d9130c778f3d1c5face1dc (patch)
tree078986bec2b322b365591a52deefbd8fd28709b1 /lib
parenta9fbe78634bac1e6054b794517f2cc6bc993b8a1 (diff)
Centralize option parsing for options that can be specified multiple times
Use common code for parsing environment for interesting options. Cleaner, and fixes handling of variables with newlines included in various places.
Diffstat (limited to 'lib')
-rw-r--r--lib/shlib.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/shlib.sh b/lib/shlib.sh
index c984039..34982b0 100644
--- a/lib/shlib.sh
+++ b/lib/shlib.sh
@@ -17,6 +17,20 @@ read_config() {
echo ${!vname}
}
+find_option_values() {
+ local out=$1
+ local module=$2
+ local option=$3
+ local prefix=CFG_${module}__${option}
+
+ while IFS= read -r -d '' line; do
+ local name=${line%%=*}
+ local value=${line#*=}
+ [[ $name == $prefix || $name == ${prefix}_* ]] || continue
+ eval "$out+=('$value')"
+ done < <(env --null)
+}
+
read_buildnr() {
local buildnr_path=$intermediatesdir/buildnr
if [[ -e $buildnr_path ]]; then