pacman-mirrors-install.script 652 Bytes
Newer Older
Philip Müller's avatar
Philip Müller committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/bin/bash

if [ -f /etc/pacman-mirrors.conf.pacsave ]; then
    echo "Your current config has been restored."
    echo "A new pacman-mirrors.conf is created as /etc/pacman-mirrors-new-$(date +%Y%m%d).conf"
    echo "Please verify you're not missing any changes"
    mv /etc/pacman-mirrors.conf /etc/pacman-mirrors-new-$(date +%Y%m%d).conf
    mv /etc/pacman-mirrors.conf.pacsave /etc/pacman-mirrors.conf
fi

if [ -f /etc/pacman.d/mirrorlist ]; then
    # fetch new data files
    pacman-mirrors --no-mirrorlist
else
    # create mirrorlist
    pacman-mirrors -f5
fi

echo "hint: use \`pacman-mirrors\` to generate and update your pacman mirrorlist."