From 639a93f95b066c16e993f6501688bee145baab73 Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Thu, 18 Feb 2016 11:49:56 +0100 Subject: [PATCH] pacrank: Now testing if pacnew file exists (thanks pacman 5.0 *sarcasm*) --- scripts/.config/scripts/pacrank.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/.config/scripts/pacrank.sh b/scripts/.config/scripts/pacrank.sh index 22300d6..d313d85 100755 --- a/scripts/.config/scripts/pacrank.sh +++ b/scripts/.config/scripts/pacrank.sh @@ -10,5 +10,10 @@ country=$1 INPUT=/etc/pacman.d/mirrorlist.pacnew OUTPUT=/etc/pacman.d/mirrorlist +if [ ! -f "$INPUT" ]; then + echo "$INPUT is missing." + exit 1 +fi + cat $INPUT | awk -v "COUNTRY=$country" 'BEGIN { c="" } /^##/ { c=substr($0,4); } /^#Server/ { if(c==COUNTRY) { print substr($0,2); } }' | rankmirrors - | sudo tee $OUTPUT