summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b6e3980d939c24fbecc75439d46152c2e8305cad (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64


# Mantainer: Alessio <alessio@linux.com>
# Contributor: Jingbei Li <i@jingbei.li>

pkgname=pritunl-git
_pkgname=pritunl
pkgver=1.32.3602.80
pkgrel=1
pkgdesc="Enterprise VPN Server"
arch=("x86_64")
license=("custom")
url="https://github.com/${_pkgname}/${_pkgname}"
_depends=(
	pritunl-dns
	pritunl-web
	python3
	net-tools
	iproute2
	openvpn
)
makedepends=(
	git
	python-setuptools
	python-virtualenv
	python-pip
)
optdepends=(mongodb)
provides=("${_pkgname}")
conflicts=("${_pkgname}")
install=${_pkgname}.install
source=("git+$url")
sha256sums=('SKIP')
options=("emptydirs")
backup=("etc/${_pkgname}.conf")

pkgver() {
	cd $_pkgname
	git describe --always --tags | sed -e 's/-/./g' -e 's/v//g'
}

_build() {
	export virtualenv="${pkgdir}/opt/${_pkgname}"
	export mirror="-i https://pypi.tuna.tsinghua.edu.cn/simple"

	cd "$srcdir/$_pkgname"
	virtualenv "$virtualenv"
	${virtualenv}/bin/python setup.py build
	${virtualenv}/bin/python setup.py install --root="${pkgdir}" --prefix="/opt/${_pkgname}"
	${virtualenv}/bin/pip install $mirror -U -r requirements.txt --root="${pkgdir}" --prefix="/opt/${_pkgname}"
}

package() {
	depends=(${_depends[@]})

	_build

	mkdir -p "${pkgdir}/usr/bin"
	ln -s "/opt/${_pkgname}/bin/${_pkgname}" "${pkgdir}/usr/bin"

	msg2 "Replacing \$pkgdir"
	sed -e "s|${pkgdir}||g" -i $(grep "${virtualenv}" ${pkgdir} -rIl 2>/dev/null)

}