# This is an example PKGBUILD file. Use this as a start to creating your own,
# and remove these comments. For more information, see 'man PKGBUILD'.
# NOTE: Please fill out the license field for your package! If it is unknown,
# then please put 'unknown'.

# Maintainer: TorGuard Support <support@torguard.com>
pkgname=torguard
pkgver=4.8.17_build.242.1+gcefc4e9
pkgrel=1
pkgdesc="TorGuard VPN Software
 Stay private online with TorGuard's anonymous VPN software and connect to 37+ countries worldwide."
arch=('x86_64')
url="www.torguard.com"
depends=('iproute2' 'psmisc' 'libxkbcommon-x11')
license=(custom)
source=("torguard-v4.8.17-build.242.1+gcefc4e9-amd64-arch.tar")
md5sums=('cca87d9ccab440c9e7cc5b3d7af09df6')
install=torguard.install

package() {
        cp -r "$srcdir"/*/* "$pkgdir"
        find "$pkgdir"/opt/torguard/ -type f -exec chmod 644 {} \;
        find "$pkgdir"/opt/torguard/ -name torguard -exec chmod 755 {} \;
        find "$pkgdir"/opt/torguard/ -name torguard-wrapper -exec chmod 755 {} \;
        find "$pkgdir"/opt/torguard/ -name ss-local -exec chmod 755 {} \;
        find "$pkgdir"/opt/torguard/ -name openvpn -exec chmod 755 {} \;
        find "$pkgdir"/opt/torguard/ -name openconnect -exec chmod 755 {} \;
        find "$pkgdir"/opt/torguard/ -name vpnc-script -exec chmod 755 {} \;
        find "$pkgdir"/opt/torguard/ -name stunnel_5_42 -exec chmod 755 {} \;
        find "$pkgdir"/opt/torguard/ -name stunnel_5_57 -exec chmod 755 {} \;
        find "$pkgdir"/opt/torguard/bin/ -name torguard-startup.desktop -exec chmod 664 {} \;
        find "$pkgdir"/etc/sudoers.d/ -name torguard -exec chmod 440 {} \;

        install -d "$pkgdir"/usr/bin/
        ln -s /opt/torguard/bin/torguard-wrapper "$pkgdir"/usr/bin/torguard
}
