#!/bin/bash

sudo sed -i -e "s/#Server/Server/g" /etc/pacman.d/mirrorlist.pacnew
sudo cp /etc/pacman.d/mirrorlist.pacnew /etc/pacman.d/mirrorlist
sudo reflector --save /etc/pacman.d/mirrorlist -c "CA,FI,FR,DE,IS,IE,IT,JP,KZ,LV,LU,NZ,NO,PL,PT,RU,SG,ES,SE,CH,TW,TH, " --protocol https,http,rsync --latest 50 --fastest 50 --sort rate

cp -vf "/etc/pacman.d/mirrorlist" "./airootfs/etc/pacman.d/"

notify-send -a "$(basename $(pwd)): Prepare" -t 999999999 "finished" "$(date '+%Y.%m.%d %H:%M:%S')"

echo "Ready"
