#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=pacman-mirrorlist
pkgver=20230410
pkgrel=01
pkgdesc="Arch Linux mirror list for use by pacman HTTPS ONLY"
url="https://www.archlinux.org/mirrorlist/"
backup=(etc/pacman.d/mirrorlist)
source=(https://raw.githubusercontent.com/archlinux/svntogit-packages/packages/pacman-mirrorlist/trunk/mirrorlist
	select)
# We have added a few of the mirrors from around the globe so pacman would work if none were selected
# NOTE on building this package:
# * Go to the trunk/ directory
# * Run bash -c ". PKGBUILD; updatelist"
# * Update the checksums, update pkgver
# * Build the package
## Jobo:   Or replace the local source with the latest in trunk :P

updatelist() {
  rm -f mirrorlist
  curl -o mirrorlist https://archlinux.org/mirrorlist/all/
}

package() {
  mkdir -p "$pkgdir/etc/pacman.d"
# this removes all the non-https mirrorsites out of the list leaving only the ones with https
  cat select >> mirrorlist-https
  grep -v "http:" mirrorlist >> mirrorlist-https
  install -m644 "$srcdir/mirrorlist-https" "$pkgdir/etc/pacman.d/mirrorlist"
  install -m644 "$srcdir/mirrorlist" "$pkgdir/etc/pacman.d/mirrorlist-arch"
}

#---- arch license gpg-key & sha256sums ----

arch=('any')

license=('GPL')

sha256sums=(8daf30bdc9390cc58ae42c1d82f91a735ad985727f223720652c4bd3ed5a0ca6 # mirrorlist
	SKIP) # select

##  9f7aeb155c01111accbdb7237a03b6543798854e8c81f485f4d84eede6c52106  pacman-mirrorlist-20230410-01-any.pkg.tar.lz


