# Maintainer: Joey Yakimowich-Payne <jyapayne@pm.me>
#
# BlueRune's VPN example (examples/extensions/vpn.py) for every user: the program, the user
# unit that runs it in each BlueRune session, and its metainfo and icon for the Store
# (docs/extensions.md, "Packaging an extension"). The files beside this PKGBUILD that link
# into the tree are resolved when release/publish.sh --extras exports it.
pkgname=bluerune-extension-vpn
pkgver=1
pkgrel=1
pkgdesc="A VPN switch in BlueRune's quick settings, for NetworkManager's VPN and WireGuard connections"
arch=('any')
url='https://bluerune.dev/docs/extensions/'
license=('Apache-2.0 OR MIT')
install=bluerune-extension-vpn.install
# Extensions on the session bus came after 0.3.3; bluerune-session.target starts the unit.
depends=('bluerune>0.3.3' 'python' 'python-gobject' 'glib2' 'networkmanager' 'hicolor-icon-theme')
source=(
    vpn.py
    bluerune-extension-vpn.service
    org.bluerune.Extension.Vpn.metainfo.xml
    org.bluerune.Extension.Vpn.svg
    LICENSE-MIT
)
sha256sums=('192805bea2a7323d232a5bb10fb63edd8bae1be13e8ab34c3fba7c5718aa6eaf'
            'beb0f0d3930b487743e2dd621b2424db7dbc5110dc1d83e27661bb7f8700bc21'
            'ef82557bd9b7f4767e4089faf41214ad1e6230d0fc75e8c3ebdd1c1aa94edeac'
            '473a1372904136b4d08c8d1154f05b73efe28b6f56134b88c04c319a89fb7653'
            'de6686d0422e16d4c09e5af7bc8b56a0208562a7e57c6d434e8c50ec9b0e5b6d')

package() {
    install -Dm755 vpn.py "$pkgdir/usr/lib/bluerune/extensions/vpn/vpn"
    install -Dm644 -t "$pkgdir/usr/lib/systemd/user" bluerune-extension-vpn.service
    install -d "$pkgdir/usr/lib/systemd/user/bluerune-session.target.wants"
    ln -s ../bluerune-extension-vpn.service "$pkgdir/usr/lib/systemd/user/bluerune-session.target.wants/"
    install -Dm644 -t "$pkgdir/usr/share/metainfo" org.bluerune.Extension.Vpn.metainfo.xml
    install -Dm644 -t "$pkgdir/usr/share/icons/hicolor/scalable/apps" org.bluerune.Extension.Vpn.svg
    install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE-MIT
}
