pacrank: Now testing if pacnew file exists (thanks pacman 5.0 *sarcasm*)
This commit is contained in:
parent
4095d48c20
commit
639a93f95b
1 changed files with 5 additions and 0 deletions
|
@ -10,5 +10,10 @@ country=$1
|
||||||
INPUT=/etc/pacman.d/mirrorlist.pacnew
|
INPUT=/etc/pacman.d/mirrorlist.pacnew
|
||||||
OUTPUT=/etc/pacman.d/mirrorlist
|
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
|
cat $INPUT | awk -v "COUNTRY=$country" 'BEGIN { c="" } /^##/ { c=substr($0,4); } /^#Server/ { if(c==COUNTRY) { print substr($0,2); } }' | rankmirrors - | sudo tee $OUTPUT
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue