#!/usr/bin/env bash

# Description:
#   Quick snippet of reflector.
#
# Note:
#   Write the arguments (with '--' prefix) of reflector to /etc/xdg/reflector/reflector.conf
#   and enable reflector.timer to update mirrorlist automaticly (once a week)

[ -z "$COUNTRY" ] && COUNTRY="Germany,Austria"

sudo cp -vf /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak || exit 1

sudo reflector --verbose --country "$COUNTRY" --latest 20 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
