summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 40caea5c7bed349fd18f6dcd28ad2155a5118849 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Maintainer: Nicolas Stinus <nicolas.stinus@gmail.com>

pkgname=openvpn-nordvpn
pkgver=0.1.41
pkgrel=1
pkgdesc="OpenVPN helper script for nordvpn.com"
arch=(any)
url="https://github.com/nstinus/nordvpn"
license=('MIT')
depends=('openvpn'
         'systemd'
         'openvpn-update-resolv-conf-git'
         'curl'
         'unzip'
         'sudo'
         'coreutils'
         'bc'
         'fping')
optdepends=('iputils: run ping and rank functions'
            'vpnfailsafe-git: use instead of update-resolv-conf if available'
            'python-pandas: run nordvpn infos command'
            'bash-completion: auto-complete commands'
            'jq: pick recommended server for "start" command')
makedepends=('coreutils' 'asciidoc' 'git')
provides=('nordvpn')
source=("git+https://github.com/nstinus/nordvpn.git#commit=${NORDVPN_COMMIT:-v0.1-41-gfbdfbfd}")
sha1sums=('SKIP')
install=${pkgname}.install

pkgver() {
    git --git-dir $(pwd)/nordvpn/.git describe --always --long --match "v?.?" \
        | sed 's/-/./' \
        | cut -d '-' -f 1 \
        | sed 's/v//'
}

build() {
    sed "s/@version@/$pkgver/g" nordvpn/doc/man.asciidoc > man.asciidoc \
        && a2x --doctype manpage --format manpage man.asciidoc \
        && gzip -f nordvpn.8
}

package() {
    install -D -m 644 nordvpn.8.gz $pkgdir/usr/share/man/man8/nordvpn.8.gz
    install -D -m 755 nordvpn/src/nordvpn $pkgdir/usr/bin/nordvpn
    install -D -m 644 nordvpn/src/servers.py $pkgdir/etc/openvpn/client/nordvpn/servers.py
    chmod 750 $pkgdir/etc/openvpn/client $pkgdir/etc/openvpn/client/nordvpn
    install -D -m 644 nordvpn/completion/bash $pkgdir/usr/share/bash-completion/completions/nordvpn
}