[Piuparts-commits] [SCM] piuparts git repository branch, piatti, updated. 0.49-105-gac1319a

Andreas Beckmann anbe at debian.org
Fri Mar 1 15:33:04 UTC 2013


The following commit has been merged in the piatti branch:
commit c3c74b2a9b2a03355bea4d68daffe39795764579
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sun Feb 24 17:02:27 2013 +0100

    lib/read_config.sh: add some comments
    
    describe the sed expression a bit
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>

diff --git a/lib/read_config.sh b/lib/read_config.sh
index 02b9719..37a288a 100644
--- a/lib/read_config.sh
+++ b/lib/read_config.sh
@@ -30,7 +30,16 @@ get_config_value()
 	test -n "$1" && test "$1" = "$(echo "$1" | tr -c -d '[:alnum:]_')" || exit 1
 	section="$2"
 	key="$3"
+
+	# First select the [$section] block (\#^\[$section\]#) (use # as
+	# marker because $section may contain slashes) up to the start of the
+	# next section (/^\[/). The select the $key=value, this may be wrapped
+	# with indented lines and comment lines embedded. The $key=value is
+	# over once we hit the next key (or any line not starting with # or
+	# whitespace. Throw away comments (/^#/d), the following key, remove
+	# our $key= part, trim the value, remove empty lines, and print it.
 	value="$(sed -rn '\#^\['"$section"'\]#,/^\[/ {/^'"$key"'\s*=/,/^[^ \t#]/ {/^#/d; /^'"$key"'\s*=|^\s/!d; s/^'"$key"'\s*=\s*//; s/^\s*//; s/\s*$//; /^$/d; p}}' "$PIUPARTS_CONF")"
+
 	if [ -z "$value" ]; then
 		if [ -n "${4+set}" ]; then
 			value="$4"

-- 
piuparts git repository



More information about the Piuparts-commits mailing list