From 2222e9f8dfe6e149262f629571b3432718351d3f Mon Sep 17 00:00:00 2001 From: Andres P Date: Tue, 22 Jun 2010 22:12:51 -0430 Subject: rankmirrors: fix bogus variable assignment $replacedurl was being built from an expansion of itself. But at the time it happened, it was empty. Fixes FS#19911 Signed-off-by: Andres P Signed-off-by: Allan McRae --- scripts/rankmirrors.sh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts/rankmirrors.sh.in') diff --git a/scripts/rankmirrors.sh.in b/scripts/rankmirrors.sh.in index 9b4e973a..201cc4be 100644 --- a/scripts/rankmirrors.sh.in +++ b/scripts/rankmirrors.sh.in @@ -70,15 +70,15 @@ ARCH="$(uname -m)" getfetchurl() { local strippedurl="${1%/}" - local replacedurl="${replacedurl//'$arch'/$ARCH}" + local replacedurl="${strippedurl//'$arch'/$ARCH}" if [[ ! $TARGETREPO ]]; then - replacedurl="${strippedurl//'$repo'/core}" + replacedurl="${replacedurl//'$repo'/core}" local tmp="${replacedurl%/*}" tmp="${tmp%/*}" local reponame="${tmp##*/}" else - replacedurl="${strippedurl//'$repo'/$TARGETREPO}" + replacedurl="${replacedurl//'$repo'/$TARGETREPO}" local reponame="$TARGETREPO" fi -- cgit v1.2.3 From 226c137245192444085d03a7f841b35afe99791c Mon Sep 17 00:00:00 2001 From: Andres P Date: Tue, 22 Jun 2010 22:12:50 -0430 Subject: rankmirrors: fix bogus pacman configuration parsing Valid pacman configuration files do not have to start with a hash for that line to be a comment, neither do directives need to be in column 0. Signed-off-by: Andres P Signed-off-by: Allan McRae --- scripts/rankmirrors.sh.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/rankmirrors.sh.in') diff --git a/scripts/rankmirrors.sh.in b/scripts/rankmirrors.sh.in index 201cc4be..fcb42fa4 100644 --- a/scripts/rankmirrors.sh.in +++ b/scripts/rankmirrors.sh.in @@ -184,9 +184,9 @@ fi timesarray=() for line in "${linearray[@]}"; do - if [[ $line =~ ^# ]]; then + if [[ $line =~ ^[[:space:]]*# ]]; then [[ $TIMESONLY ]] || echo $line - elif [[ $line =~ ^Server ]]; then + elif [[ $line =~ ^[[:space:]]*Server ]]; then # Getting values and times and such server="${line#*= }" -- cgit v1.2.3 From 708f186f98a0c2094225aa94ac8a139ac3a9163e Mon Sep 17 00:00:00 2001 From: Andres P Date: Tue, 22 Jun 2010 22:12:49 -0430 Subject: rankmirrors: pipe errors to stderr If this is to be scripted with AIF or another tool, it needs to respect stderr. Signed-off-by: Andres P Signed-off-by: Allan McRae --- scripts/rankmirrors.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/rankmirrors.sh.in') diff --git a/scripts/rankmirrors.sh.in b/scripts/rankmirrors.sh.in index fcb42fa4..b0dc1ab7 100644 --- a/scripts/rankmirrors.sh.in +++ b/scripts/rankmirrors.sh.in @@ -49,7 +49,7 @@ version() { } err() { - echo "$1" + echo "$1" >&2 exit 1 } -- cgit v1.2.3