[Piuparts-commits] [SCM] piuparts git repository branch, piatti, updated. 0.49-105-gac1319a
Andreas Beckmann
anbe at debian.org
Fri Mar 1 15:32:58 UTC 2013
The following commit has been merged in the piatti branch:
commit c9fa33bb8e5e832878f7344f803c47e1a3b60692
Author: Andreas Beckmann <anbe at debian.org>
Date: Wed Feb 20 20:30:13 2013 +0100
read_config.sh: allow empty values
Not passing a default value implies the piuparts.conf needs to have
a non-empty value for the requested key. But explicitly passing an
empty ('') default value allows an empty value.
Signed-off-by: Andreas Beckmann <anbe at debian.org>
diff --git a/lib/read_config.sh b/lib/read_config.sh
index 0962750..02b9719 100644
--- a/lib/read_config.sh
+++ b/lib/read_config.sh
@@ -31,10 +31,13 @@ get_config_value()
section="$2"
key="$3"
value="$(sed -rn '\#^\['"$section"'\]#,/^\[/ {/^'"$key"'\s*=/,/^[^ \t#]/ {/^#/d; /^'"$key"'\s*=|^\s/!d; s/^'"$key"'\s*=\s*//; s/^\s*//; s/\s*$//; /^$/d; p}}' "$PIUPARTS_CONF")"
- test -n "$value" || value="$4"
if [ -z "$value" ]; then
- echo "'$key' not set in section [$section] of $PIUPARTS_CONF, exiting." >&2
- exit 1
+ if [ -n "${4+set}" ]; then
+ value="$4"
+ else
+ echo "'$key' not set in section [$section] of $PIUPARTS_CONF, exiting." >&2
+ exit 1
+ fi
fi
eval "$1"='"$value"'
}
--
piuparts git repository
More information about the Piuparts-commits
mailing list