summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorXorg2020-07-14 12:09:56 +0200
committerXorg2020-07-14 12:09:56 +0200
commit75dfe6a47b08fdfb74c649e1d541882a1dcd6814 (patch)
tree2b0514a0139a6393a0ef91204e4356be7aa6145e
parentf94b87d0b05369e2cd656d2357bdbbdd32954bae (diff)
downloadaur-75dfe6a47b08.tar.gz
Allow to disable country filter when 'All' is set
Feature request: https://aur.archlinux.org/packages/mirrorlist-rankmirrors-hook/#comment-754221
-rw-r--r--.SRCINFO8
-rw-r--r--PKGBUILD8
-rw-r--r--mirrorlist-rankmirrors.conf4
-rw-r--r--mirrorlist-rankmirrors.sh7
4 files changed, 17 insertions, 10 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 397d5b7a439..45507bbda5b 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = mirrorlist-rankmirrors-hook
pkgdesc = Pacman hook to automatically rank new mirrors
- pkgver = 1
- pkgrel = 2
+ pkgver = 2
+ pkgrel = 1
url = https://wiki.archlinux.org/index.php/Mirrors#Ranking_an_existing_mirror_list
install = mirrorlist-rankmirrors-hook.install
arch = any
@@ -14,8 +14,8 @@ pkgbase = mirrorlist-rankmirrors-hook
source = mirrorlist-rankmirrors.sh
source = mirrorlist-rankmirrors.conf
source = mirrorlist-rankmirrors.hook
- sha512sums = be000ecfe1964fbf2b15cdceede285a3de12f4caa9bfb58666453b58f592205d20666a2d43849390e2d03b9d03bd192447be0da4b221780c81423f10b4e73578
- sha512sums = 1ed343d832ef68e4ca839a73e0bb2abd13f95e13aab18398c1fe13450f46315686e40634c3c7dddfeed8eb83e1ca5d48c60c9f0615ab58a51005c753b945ae58
+ sha512sums = 6e2b2030ee1c0a67158f8b7327235a14adeff4d3670029c1d09c5a4574cf46251f57de057dcc3a0e75df0d196e2748bf66d03e422457e68412fb60a82d03383b
+ sha512sums = 8120a3785029a04f445f04b93240b84ce4b38ce1ed1000a7a56038f3dbf1378008a291818a3850d7f82db709f1804422e18ebeea05af91e99b9509522fa29652
sha512sums = 83a8ace99403296572e695ca992182195d5a983042773e00d506129d6e8cf38456f3d19b1e7e8b8c897c5d6ca8a465b627e8014108001d05005f3ad0b2d473e4
pkgname = mirrorlist-rankmirrors-hook
diff --git a/PKGBUILD b/PKGBUILD
index 2e43b3887b8..21fce6aef06 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,8 +2,8 @@
# Contributor: u8sand (https://gist.github.com/u8sand/c2ed7dfbf6e4e781f532daf5aab141cb)
pkgname='mirrorlist-rankmirrors-hook'
-pkgver=1
-pkgrel=2
+pkgver=2
+pkgrel=1
pkgdesc='Pacman hook to automatically rank new mirrors'
url="https://wiki.archlinux.org/index.php/Mirrors#Ranking_an_existing_mirror_list"
license=('unknow')
@@ -16,8 +16,8 @@ install="$pkgname.install"
source=('mirrorlist-rankmirrors.sh'
'mirrorlist-rankmirrors.conf'
'mirrorlist-rankmirrors.hook')
-sha512sums=('be000ecfe1964fbf2b15cdceede285a3de12f4caa9bfb58666453b58f592205d20666a2d43849390e2d03b9d03bd192447be0da4b221780c81423f10b4e73578'
- '1ed343d832ef68e4ca839a73e0bb2abd13f95e13aab18398c1fe13450f46315686e40634c3c7dddfeed8eb83e1ca5d48c60c9f0615ab58a51005c753b945ae58'
+sha512sums=('6e2b2030ee1c0a67158f8b7327235a14adeff4d3670029c1d09c5a4574cf46251f57de057dcc3a0e75df0d196e2748bf66d03e422457e68412fb60a82d03383b'
+ '8120a3785029a04f445f04b93240b84ce4b38ce1ed1000a7a56038f3dbf1378008a291818a3850d7f82db709f1804422e18ebeea05af91e99b9509522fa29652'
'83a8ace99403296572e695ca992182195d5a983042773e00d506129d6e8cf38456f3d19b1e7e8b8c897c5d6ca8a465b627e8014108001d05005f3ad0b2d473e4')
package() {
diff --git a/mirrorlist-rankmirrors.conf b/mirrorlist-rankmirrors.conf
index c3c818a3108..1a97672eda8 100644
--- a/mirrorlist-rankmirrors.conf
+++ b/mirrorlist-rankmirrors.conf
@@ -1,3 +1,5 @@
# You can use 'grep "##" /etc/pacman.d/mirrorlist.pacnew' to get a list of countries
-
COUNTRY=
+
+# If you want to disable the country filter, use the special value 'All' (warning: ranking will take times)
+#COUNTRY=All
diff --git a/mirrorlist-rankmirrors.sh b/mirrorlist-rankmirrors.sh
index 7f1db8e7b36..2b3f365f5fa 100644
--- a/mirrorlist-rankmirrors.sh
+++ b/mirrorlist-rankmirrors.sh
@@ -27,7 +27,12 @@ if grep -q "# Server list generated by rankmirrors" "$file"; then
exit 0
fi
-awk '/^## '"$COUNTRY"'/{f=1}f==0{next}/^$/{exit}{print substr($0, 2)}' "$file" > "$TMP_FILE"
+if [ "$COUNTRY" = "All" ]; then
+ sed 's/#Server/Server/g' "$file" > "$TMP_FILE"
+else
+ awk '/^## '"$COUNTRY"'/{f=1}f==0{next}/^$/{exit}{print substr($0, 2)}' "$file" > "$TMP_FILE"
+fi
+
if [ -s "$TMP_FILE" ]; then
echo "==> rankmirrors $file"
rankmirrors "$TMP_FILE" | tee "$MIRRORLIST" && rm "$TMP_FILE"