]> TLD Linux GIT Repositories - packages/openvpn.git/blob - openvpn.spec
- from PLD
[packages/openvpn.git] / openvpn.spec
1
2 # Conditional build:
3 %bcond_without  pkcs11          # build without PKCS#11 support
4
5 Summary:        VPN Daemon
6 Summary(pl.UTF-8):      Serwer VPN
7 Name:           openvpn
8 Version:        2.3.6
9 Release:        1
10 License:        GPL v2
11 Group:          Networking/Daemons
12 Source0:        http://swupdate.openvpn.net/community/releases/%{name}-%{version}.tar.gz
13 # Source0-md5:  6ca03fe0fd093e0d01601abee808835c
14 Source1:        %{name}.init
15 Source2:        %{name}.sysconfig
16 Source3:        %{name}.tmpfiles
17 Source4:        openvpn-service-generator
18 Source5:        openvpn.target
19 Source6:        openvpn@.service
20 Patch0:         %{name}-pam.patch
21 URL:            http://www.openvpn.net/
22 BuildRequires:  autoconf >= 2.59
23 BuildRequires:  automake
24 BuildRequires:  libselinux-devel
25 BuildRequires:  lzo-devel
26 BuildRequires:  openssl-devel >= 0.9.7d
27 BuildRequires:  pam-devel
28 %{?with_pkcs11:BuildRequires:   pkcs11-helper-devel}
29 BuildRequires:  rpmbuild(macros) >= 1.671
30 BuildRequires:  systemd-devel
31 Requires(post,preun):   /sbin/chkconfig
32 Requires(post,preun,postun):    systemd-units >= 38
33 Requires:       /sbin/ip
34 Requires:       rc-scripts >= 0.4.3.0
35 Requires:       systemd-units >= 38
36 Conflicts:      kernel < 2.4
37 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
38
39 %define         _localstatedir  /var
40
41 %description
42 OpenVPN is a robust and highly configurable VPN (Virtual Private
43 Network) daemon which can be used to securely link two or more private
44 networks using an encrypted tunnel over the internet.
45
46 %description -l pl.UTF-8
47 OpenVPN jest mocnym i silnie konfigurowalnym serwerem VPN (Wirtualne
48 Sieci Prywatne), który może być użyty do bezpiecznego łączenia dwóch
49 lub więcej prywatnych sieci używając zaszyfrowanego tunelu poprzez
50 internet.
51
52 %package devel
53 Summary:        Header files for OpenVPN plugins development
54 Summary(pl.UTF-8):      Pliki nagłówkowe do tworzenia wtyczek OpenVPN
55 Group:          Development/Libraries
56
57 %description devel
58 This is the package containing the header files for OpenVPN plugins
59 development.
60
61 %description devel -l pl.UTF-8
62 Ten pakiet zawiera pliki nagłówkowe do tworzenia wtyczek OpenVPN.
63
64 %prep
65 %setup -q
66 %patch0 -p1
67
68 sed -e 's,/''usr/lib/openvpn,%{_libdir}/%{name},' %{SOURCE3} > contrib/update-resolv-conf
69
70 %build
71 %{__aclocal} -I m4
72 %{__autoheader}
73 %{__autoconf}
74 %{__automake}
75
76 %configure \
77         %{!?with_pkcs11:--disable-pkcs11} \
78         --enable-password-save \
79         --enable-iproute2 \
80         --enable-selinux \
81         --enable-systemd \
82         IFCONFIG=/sbin/ifconfig \
83         IPROUTE=/sbin/ip \
84         ROUTE=/sbin/route \
85         NETSTAT=/bin/netstat
86
87 %{__make}
88
89 %install
90 rm -rf $RPM_BUILD_ROOT
91 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/openvpn,%{_sbindir},%{_mandir}/man8} \
92         $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig},/var/run/openvpn,%{_includedir}} \
93         $RPM_BUILD_ROOT{%{_libdir}/%{name}/plugins,%{systemdtmpfilesdir},%{systemdunitdir}} \
94         $RPM_BUILD_ROOT/lib/systemd/system-generators
95
96 %{__make} install \
97         DESTDIR=$RPM_BUILD_ROOT
98
99 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
100 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
101 install %{SOURCE3} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
102
103 install -p %{SOURCE4} $RPM_BUILD_ROOT/lib/systemd/system-generators/openvpn-service-generator
104 install -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}/openvpn.target
105 install -p %{SOURCE6} $RPM_BUILD_ROOT%{systemdunitdir}/openvpn@.service
106 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/openvpn.service
107
108 %{__rm} $RPM_BUILD_ROOT%{_libdir}/%{name}/plugins/*.la
109
110 %clean
111 rm -rf $RPM_BUILD_ROOT
112
113 %post
114 /sbin/chkconfig --add openvpn
115 %service openvpn restart "OpenVPN"
116 %systemd_post openvpn.target
117
118 %preun
119 if [ "$1" = "0" ]; then
120         %service openvpn stop
121         /sbin/chkconfig --del openvpn
122 fi
123 %systemd_preun openvpn.target
124
125 %postun
126 %systemd_reload
127
128 %triggerpostun -- openvpn < 2.3.2-2
129 [ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
130 [ ${RPM_ENABLE_SYSTEMD_SERVICE:-yes} = no ] && exit 0
131 [ "$(echo /etc/rc.d/rc[0-6].d/S[0-9][0-9]openvpn)" = "/etc/rc.d/rc[0-6].d/S[0-9][0-9]openvpn" ] && exit 0
132 export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
133 /bin/systemctl --quiet enable openvpn.target || :
134 exit 0
135
136 %files
137 %defattr(644,root,root,755)
138 %doc AUTHORS README* ChangeLog sample/sample-{config-files,keys,scripts} doc/management-notes.txt
139 %doc *.IPv6 src/plugins/*/README.*
140 %dir %{_sysconfdir}/openvpn
141 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
142 %attr(755,root,root) %{_sbindir}/openvpn
143 %attr(754,root,root) /etc/rc.d/init.d/%{name}
144 %attr(755,root,root) /lib/systemd/system-generators/%{name}-service-generator
145 %{systemdunitdir}/%{name}.service
146 %{systemdunitdir}/%{name}.target
147 %{systemdunitdir}/%{name}@.service
148 %dir %{_libdir}/%{name}
149 %dir %{_libdir}/%{name}/plugins
150 %attr(755,root,root) %{_libdir}/%{name}/plugins/*.so
151 %{_mandir}/man8/openvpn.8*
152 %dir /var/run/openvpn
153 /usr/lib/tmpfiles.d/%{name}.conf
154
155 %files devel
156 %defattr(644,root,root,755)
157 %doc doc/README.plugins sample/sample-plugins
158 %{_includedir}/openvpn-plugin.h