You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pacman-mirror-update 919B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. # Define tmpfile
  3. tmpfile=/tmp/mirrorlisttmp
  4. # Determine architecture type
  5. archtype=$(uname -m)
  6. # Get latest mirror list and save to tmpfile
  7. wget -O $tmpfile "http://www.archlinux.org/mirrorlist/?country=United+States&protocol=ftp&protocol=http&ip_version=4&use_mirror_status=on" >/dev/null 2>&1
  8. # Wrangle txt in saved file
  9. sed -i -e "s/^#Server/Server/g" -e "s/\$arch/"$archtype"/g" $tmpfile
  10. # Backup and replace current mirrorlist file
  11. if [[ ! -f /etc/pacman.d/mirrorlist.orig ]]; then
  12. mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig && echo "Successfully backed up original mirrorlist!"
  13. cp $tmpfile /etc/pacman.d/mirrorlist && echo "Successfully applied new mirrorlist!"
  14. else
  15. mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak && echo "Successfully backed up current mirrorlist!"
  16. cp $tmpfile /etc/pacman.d/mirrorlist && echo "Successfully applied new mirrorlist!"
  17. fi
  18. exit