summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c114d230f40ae5cc54b7d3151efa436192e389df (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
65
66
67
68
# Maintainer: Shervin Khastoo <me@shervin.org>

pkgname=openvpn-xor-patched
pkgver=2.3.12
pkgrel=2
pkgdesc="OpenVPN obfuscated with xor-patch which can bypass internet censoring"
arch=(i686 x86_64)
url="https://github.com/clayface/openvpn_xorpatch"
depends=('openssl' 'lzo' 'lz4' 'pam' 'libsystemd')
optdepends=('easy-rsa: for easy key management')
conflicts=('openvpn' 'openvpn-dev')
provides=('openvpn=2.3.12' 'openvpn-dev')
license=('custom')
source=(https://github.com/OpenVPN/openvpn/archive/v${pkgver}.tar.gz openvpn@.service git://github.com/clayface/openvpn_xorpatch.git)
sha256sums=('698c50519fcb7dfa8880c760e3d9be9c3d145689c9eb243ac5d5c6fd19317bbc'
            '47a4ee993f8aaa7370e9a84384fcfc993fd76aa4db11c46629b156d0c5fad49a'
            'SKIP')

prepare() {
    cp openvpn_xorpatch/openvpn_xor.patch openvpn-2.3.12/
    
    cd openvpn-2.3.12/
    
    # Xor Patch
    patch -Np1 -i openvpn_xor.patch
}

build() {
	cd openvpn-2.3.12/

	# Build openvpn
	autoreconf -vi
	CFLAGS="${CFLAGS} -DPLUGIN_LIBDIR=\\\"/usr/lib/openvpn\\\"" ./configure \
		--prefix=/usr \
		--enable-iproute2 \
		--enable-password-save \
		--enable-systemd \
		--mandir=/usr/share/man \
		--sbindir=/usr/bin
        make
}

package() {
	cd openvpn-2.3.12/

	# Install openvpn
	make DESTDIR=${pkgdir} install
	install -d -m0755 ${pkgdir}/etc/openvpn

	# Install examples
	install -d -m0755 ${pkgdir}/usr/share/openvpn
	cp -r sample/sample-config-files ${pkgdir}/usr/share/openvpn/examples
	find ${pkgdir}/usr/share/openvpn -type f -exec chmod 644 {} \;
	find ${pkgdir}/usr/share/openvpn -type d -exec chmod 755 {} \;

	# Install license
	install -d -m0755 ${pkgdir}/usr/share/licenses/${pkgname}
	ln -sf /usr/share/doc/openvpn/{COPYING,COPYRIGHT.GPL} ${pkgdir}/usr/share/licenses/${pkgname}/

	# Install contrib
	install -d -m0755 ${pkgdir}/usr/share/openvpn/contrib
	cp -r contrib ${pkgdir}/usr/share/openvpn

	# Install systemd unit files
	cd ..
	install -D -m0644 openvpn@.service ${pkgdir}/usr/lib/systemd/system/openvpn@.service
}