# Maintainer (arch): Florian Pritz <bluewind@xinu.at>
# Contributor: Dan McGee <dan@archlinux.org>
# Contributor: Isaac David <isacdaavid@at@isacdaavid@dot@info>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Contributor: Esteban Carnevale <alfplayer@mailoo.org>
# Maintainer: Parabola Hackers <dev@lists.parabola.nu>
# Contributor: bill-auger <bill-auger@programmer.net>


# NOTE: building and publishing this package is a bit peculiar
#       modify '/mirrorlist.txt' on the tier-0 repo server:
#         1: update list of mirrors
#         2: update "Last Updated:" to YYYY-MM-DD
#       modify this PKGBUILD:
#         3: set 'pkgver' to YYYYMMDD
#         4: update 'sha256sums' (`makepkg -g`, `sha256sums`, `upgpkg`, etc)


pkgname=pacman-mirrorlist
pkgver=20240109
pkgrel=1.parabola1
pkgdesc="Parabola GNU/Linux-libre mirror list for use by pacman"
arch=(any)
url=https://wiki.parabola.nu/Repositories
license=(GPL)

backup=(etc/pacman.d/mirrorlist)
source=(mirrorlist-${pkgver}.txt::https://repo.parabola.nu/mirrorlist.txt)

sha256sums=('d82f8f4f60f555ac54d4f81bceed84ebc9c1ec02d22daae2eace1be20a41b9a4')


prepare()
{
  local dt=$( LC_ALL=C date -u +%Y-%m-%d )

  sed -i "s|\(Last Updated: \).*|\1${dt}|" "${srcdir}"/mirrorlist-${pkgver}.txt
}

package()
{
  mkdir -p "${pkgdir}"/etc/pacman.d
  install -m644 "${srcdir}"/mirrorlist-${pkgver}.txt "${pkgdir}"/etc/pacman.d/mirrorlist
}
