# Maintainer: EndeavourOS-Team <info@endeavouros.com>

pkgname=reflector-simple
pkgdesc="Simple GUI wrapper for 'reflector'."
pkgver=2026.1
pkgrel=1
arch=('any')
license=('GPL')
depends=(
  reflector
  eos-bash-shared
  yad
)
optdepends=(
    'reflector-bash-completion: useful for plain reflector usage'
    'whois: optional alternative for finding country code'
    'geoip: optional alternative for finding country code'
    'bind: optional alternative for finding country code'
)
backup=(
  etc/$pkgname.conf
  etc/${pkgname}-tool.conf
)

#url=https://github.com/endeavouros-team/PKGBUILDS
url=https://github.com/endeavouros-team/PKGBUILDS/tree/master/$pkgname
_url="https://raw.githubusercontent.com/endeavouros-team/PKGBUILDS/master/$pkgname"

source=(
  $_url/$pkgname
  $_url/$pkgname.desktop
  $_url/$pkgname.conf
  $_url/${pkgname}-tool.conf
  $_url/mirrorlist-rank-info
  $_url/eos-latest-arch-mirrorlist
)
sha512sums=('1236fca90898544f70586a151ed3e6f6ac333f61bd93b0313bd40d6ad52ab8ffcfe14f0c11aa8d9452bc4cc128ad62480df8665aa20abb024fe0fc39048ee7fc'
            '3435d083e8df72f17a291cca4c3cc62ac7824d1f528e746bf689f8962159fbdd97b6a57d45b3b379a2191e2e49536b77040b13d704a58753fbed00017f4403d0'
            'bbcf6fe4a12499567fe0f00ffbe3366f664ddea8a7f95f70afd9d829cc1abc35bdbd90f7046997bd434104386c9dc1de566fe69a7497f3e6f1c92998322f4d0b'
            '8b101caac9f38238d30f293176a09f1bb483ec1cdc474ef126ec087a8b548b50eee5c35617f0616dd1618e4dce72e14b70270f47658577e20e04a133405510aa'
            'c56090338b01f6eb251e3250d69d32c2b96c8393ebe921896de3ad1bd5c622c01ae637a09c6d0d0aa40e71d55be608a8d77066be05929d586723e79e0f24002c'
            '1b48d63ef98e51cd56ad3ffda5f27228eb0de5e5ddfdd15b58980b588748cbdd11bf6419e59188defccbdef1c33ab1aaaea8d4af327df470e5c641686912c413')

package() {
  cd $srcdir

  # sed -i $pkgname -e "s|local VERSION_INFO=.*$|local VERSION_INFO=${pkgver}-$pkgrel|"

  install -d $pkgdir/usr/bin
  install -d $pkgdir/etc
  install -d $pkgdir/usr/share/applications

  install -Dm755 $pkgname                     $pkgdir/usr/bin/$pkgname
  install -Dm755 eos-latest-arch-mirrorlist   $pkgdir/usr/bin/eos-latest-arch-mirrorlist
  install -Dm755 mirrorlist-rank-info         $pkgdir/usr/bin/mirrorlist-rank-info
  
  install -Dm644 $pkgname.conf           $pkgdir/etc/$pkgname.conf
  install -Dm644 ${pkgname}-tool.conf    $pkgdir/etc/${pkgname}-tool.conf
  install -Dm644 $pkgname.desktop        $pkgdir/usr/share/applications/$pkgname.desktop
}
