summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fc6c24b8c9454b49d879466a897c594c1e9e56b1 (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
# Maintainer: ddnomad <dd at ddworks dot io>

pkgname=protonvpn-cli
pkgver=1577101870
pkgrel=1
pkgdesc="Legacy version of ProtonVPN CLI client. Most people are better off installing protonvpn-cli-ng package instead."
arch=("any")
url="https://github.com/ProtonVPN/protonvpn-cli"
license=("MIT")
depends=("openresolv" "openvpn" "python" "dialog" "wget" "procps-ng")
makedepends=("git")
source=("git+https://github.com/ProtonVPN/protonvpn-cli.git")
md5sums=("SKIP")

_update_resolv_conf_src_dir="openvpn-update-resolv-conf"
_protonvpn_src_dir="protonvpn-cli"

package() {
    # Define paths
    _update_resolv_conf_src_dir="${srcdir}/${_update_resolv_conf_src_dir}"
    _protonvpn_src_dir="${srcdir}/${_protonvpn_src_dir}"

    # Install update-resolv-conf dependency if needed
    if ! test -f /etc/openvpn/update-resolv-conf; then
        mkdir -p "${_update_resolv_conf_src_dir}"

        git clone \
            https://github.com/masterkorp/openvpn-update-resolv-conf.git \
            "${_update_resolv_conf_src_dir}"

        _oldpath="$(pwd)"
        cd "${_update_resolv_conf_src_dir}"
        install -D -m655 update-resolv-conf.sh \
            "${pkgdir}/etc/openvpn/update-resolv-conf"
        cd "${_oldpath}"
    fi

    # Install protonvpn-cli package
    cd "${_protonvpn_src_dir}"
    install -Dm755 ./protonvpn-cli.sh "${pkgdir}/usr/bin/${pkgname}"
    ln -s "/usr/bin/${pkgname}" "${pkgdir}/usr/bin/pvpn"

    # Install the license
    install -Dm644 ./license.md "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}