aboutsummaryrefslogtreecommitdiffstats
path: root/main/openvpn/APKBUILD
blob: 466628b6d873c231293e6dcdebf6cff30919a3a1 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=openvpn
pkgver=2.2.0
pkgrel=1
pkgdesc="A robust, and highly configurable VPN (Virtual Private Network)"
url="http://openvpn.sourceforge.net/"
arch="all"
license="custom"
subpackages="$pkgname-doc $pkgname-easy-rsa:easy_rsa"
depends="iproute2"
makedepends="openssl-dev lzo-dev"
install=
source="http://swupdate.openvpn.net/community/releases/$pkgname-$pkgver.tar.gz
	openvpn.initd
	openvpn.confd
	openvpn.up
	openvpn.down
	openvpn-2.2.0-ipv6-20110522-1.patch
	"

_builddir="$srcdir"/$pkgname-$pkgver

prepare() {
        local i
        cd "$_builddir"
        for i in $source; do
                case $i in
                *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
                esac
        done
}

build() { 
	cd "$_builddir"
	./configure --prefix=/usr \
		--mandir=/usr/share/man \
		--sysconfdir=/etc/openvpn \
		--enable-ssl \
		--enable-crypto \
		--disable-threads \
		--enable-iproute2

	make || return 1
	cd plugin/down-root
	make || return 1
	cd ../..
}

package() {
	cd "$_builddir"

	make DESTDIR="$pkgdir" install || return 1

	# install plugins
	install -d "$pkgdir"/usr/lib/$pkgname
	cp plugin/*/*.so "$pkgdir"/usr/lib/$pkgname

	# install examples
	mkdir -p "$pkgdir"/usr/share/doc/$pkgname/examples
	cp -a sample-config-files "$pkgdir"/usr/share/doc/$pkgname/examples
	install -D -m644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING

	# install init.d and conf.d
	install -Dm755 "$srcdir"/openvpn.initd "$pkgdir"/etc/init.d/openvpn
	install -Dm644 "$srcdir"/openvpn.confd "$pkgdir"/etc/conf.d/openvpn

	# install up and down scripts
	install -Dm755 "$srcdir"/openvpn.up "$pkgdir"/etc/openvpn/up.sh
	install -Dm755 "$srcdir"/openvpn.down "$pkgdir"/etc/openvpn/down.sh

}

easy_rsa() {
	pkgdesc="OpenVPN RSA key management"
	# easy rsa can by usefull on systems
	# which do not have openvpn installed
	depends="openssl"
        # install easy-rsa
	cd "$_builddir"
        sed -i -e 's/--directory/-d/g; s/--mode=/-m/g' easy-rsa/2.0/Makefile
        sed -i -e '1s|#!/bin/bash|#!/bin/sh|' easy-rsa/2.0/*
        make -C easy-rsa/2.0 DESTDIR="$subpkgdir" \
                PREFIX=usr/share/doc/openvpn/easy-rsa \
                install
}

doc() {
	default_doc
}

md5sums="4f440603eac45fec7be218b87d570834  openvpn-2.2.0.tar.gz
ec99092827faa7226e9f548c2cd1d20c  openvpn.initd
9eca88cac6294027ec1bb7be74185c3a  openvpn.confd
dc72fecd1a1bcef937603057cd6574b1  openvpn.up
dc3ff0bae442b9aedd947b8ffda1687a  openvpn.down
25172fa251672edc3f7a277b5d7f3f72  openvpn-2.2.0-ipv6-20110522-1.patch"