From ac899f17f5bef28ce2796750c71c20b3b4557d79 Mon Sep 17 00:00:00 2001 From: Loïc Minier Date: Sat, 30 Jan 2010 23:09:20 +0100 Subject: Don't use sed to parse mirror-map --- pbuilder-apt-config | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'pbuilder-apt-config') diff --git a/pbuilder-apt-config b/pbuilder-apt-config index bbfe3d9..b17a554 100755 --- a/pbuilder-apt-config +++ b/pbuilder-apt-config @@ -66,11 +66,19 @@ get_archive_url() { fi if [ -n "$mirror_map" ]; then - url="$(sed -n "s/^[[:space:]]*//; s/[[:space:]]*\$//; /^#/ d; /^\$/ d; s#^$archive\\([[:space:]]\+\\|\$\\)##p" "$mirror_map")" - if [ -n "$url" ]; then - echo "$url" - return - fi + while read a url; do + case "$a" in + "$archive") + if [ -n "$url" ]; then + echo "$url" + return + fi + ;; + \#*|""|*) + : + ;; + esac + done <"$mirror_map" fi builtin_mirror_map "$archive" } -- cgit v1.2.3