That's still an option, although I'd recommend updating your hook to use the new service as specified in the wiki. Also of note is that the timer will auto-update your mirrorlist at a set interval, whereas the hook will only update it when pacman-mirrorlist is upgraded.
I'd recommend updating your hook to use the new service
I already thought about that.
Also of note is that the timer will auto-update your mirrorlist at a set interval, whereas the hook will only update it when pacman-mirrorlist is upgraded.
I am aware of that. I always thought that the mirrors won't change much if there is no update of the package?
Thanks! This is exactly what I was looking for. The main point in favor of the hook was to remove the .pacnew file automatically. Didn't knew about the NoExtract option. Maybe this should also be added to the reflector wiki entry.
Maybe obvious but you never know... If you have reflector-timer installed you should remove it before updating, pacman won't do it for you and the update will fail otherwise.
I had been using Reflector for a long time but recently switched to a script presented in the Arch Forum which I modified a bit.I prefer it over Reflector because it's simpler.
My current version is:
#!/bin/sh
# Exit immediately if a command exits with a non-zero exit status.
set -e
# Colors
NR='\033[0m'
N3='\033[0;32m'
N1='\033[0;31m'
# Fail-check: make sure you have root permissions.
if [ ! -w /etc/pacman.d/mirrorlist ]; then
printf '%b\n' "$N1::$N3 Error:$N1 missing required root permissions.$NR"
exit 1
fi
echo -e "$N3 Download the mirrorlist status from the last 24 hours.$NR"
URL='https://www.archlinux.org/mirrors/status/json/'
echo
echo "--> Done!"
echo
echo -e "$N3 Return only secure mirrors from selected countries.$NR"
FILTER='.urls | [.[] | select(.protocol == "https")]
| [.[] | select(.country_code == "DE",
.country_code == "SE",
.country_code == "CZ",
.country_code == "NL",
.country_code == "DK",
.country_code == "CH")]
| [.[] | select(.completion_pct == 1.0)]
| [.[] | select(.score < 1.0)]
| .[] | "## \(.country)\nServer = \(.url)$repo/os/$arch"'
echo
echo -e "$N3 Fetch and filter the mirrors, then rank them by connection and opening speed.$NR"
curl -qs "$URL" | jq -r "$FILTER" | rankmirrors -v - > /tmp/mirrorlist
echo
echo "--> Done!"
echo
# Backup previous mirrorlist and move over the new one if /tmp/mirrorlist is NOT empty
if [ -s /tmp/mirrorlist ]
then
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.previous
mv /tmp/mirrorlist /etc/pacman.d/mirrorlist
echo -e "$N3 Ready - mirrorlist successfully updated $NR"
else
echo -e "$N1 Something went wrong: /tmp/mirrorlist is empty - keep PREVIOUS mirrorlist$NR"
fi
# Remove mirrorlist.pacnew created during pacman-mirrorlist upgrade.
[ -f /etc/pacman.d/mirrorlist.pacnew ] && rm /etc/pacman.d/mirrorlist.pacnew
exit 0
32 comments
That’s quite the warning for a service that is documented for unattended runs.
What is your takeaway from that comment? What mirrors should be considered untrustworthy?
I was under the impression that you didn't need to trust Arch mirrors (hence http is ok) because the maintainers sign their packages.
Nice one, cheers.
Nice, but I think I keep my custom Pacman hook which also removes the mirrorlist.pacnew file.
That's still an option, although I'd recommend updating your hook to use the new service as specified in the wiki. Also of note is that the timer will auto-update your mirrorlist at a set interval, whereas the hook will only update it when
pacman-mirrorlistis upgraded.I already thought about that.
I am aware of that. I always thought that the mirrors won't change much if there is no update of the package?
Alternatively you could use the
NoExtractoption in/etc/pacman.conf, so you don't have to deal with a.pacnewat all:Thanks! This is exactly what I was looking for. The main point in favor of the hook was to remove the .pacnew file automatically. Didn't knew about the
NoExtractoption. Maybe this should also be added to the reflector wiki entry.I don't know why, but I've had multiple occurrences this year of stale mirrors that don't get updates for weeks. My pacman hook does nothing for that.
Personally, I'm using both. Best of worlds.
Why is config file put in /etc/xdg/reflector and not simply /etc/reflector.conf? Just like pacman conf is in /etc/pacman.conf
Maybe obvious but you never know... If you have
reflector-timerinstalled you should remove it before updating, pacman won't do it for you and the update will fail otherwise.Thanks man, I was having this problem right now
That's very nice. Really slick work.
Thanks for sharing :-)
I had been using Reflector for a long time but recently switched to a script presented in the Arch Forum which I modified a bit.I prefer it over Reflector because it's simpler.
My current version is:
Nice
Great
Deleted before we saved it.
Deleted before we saved it.
Interesting project, but i was wondering if it really is helpful to update your mirror list automatically?
Are the speed differences worth it?
And also how am i supposed to trust a mirror before adding it if they are added automatically?