1# OpenVPN spec file, used to drive rpmbuild
2
3# OPTIONS
4#
5# Disable LZO
6#   rpmbuild -tb [openvpn.x.tar.gz] --define 'without_lzo 1'
7#
8# Disable PAM plugin
9#   rpmbuild -tb [openvpn.x.tar.gz] --define 'without_pam 1'
10#
11# Allow passwords to be read from files
12#   rpmbuild -tb [openvpn.x.tar.gz] --define 'with_password_save 1'
13
14Summary:	OpenVPN is a robust and highly flexible VPN daemon by James Yonan.
15Name:		@PACKAGE@
16Version:	@VERSION@
17Release:	1
18URL:		http://openvpn.net/
19Source0:	http://prdownloads.sourceforge.net/openvpn/%{name}-%{version}.tar.gz
20
21License:	GPL
22Group:		Applications/Internet
23Vendor:		James Yonan <jim@yonan.net>
24Packager:	James Yonan <jim@yonan.net>
25BuildRoot:	%{_tmppath}/%{name}-%(id -un)
26
27#
28# Include dependencies manually
29#
30
31AutoReq: 0
32
33BuildRequires:	openssl-devel >= 0.9.7
34Requires:	openssl       >= 0.9.7
35
36%if "%{_vendor}" == "Mandrakesoft"
37%{!?without_lzo:BuildRequires:	liblzo1-devel >= 1.07}
38%{!?without_lzo:Requires:	liblzo1       >= 1.07}
39%else
40%if "%{_vendor}" == "MandrakeSoft"
41%{!?without_lzo:BuildRequires:	liblzo1-devel >= 1.07}
42%{!?without_lzo:Requires:	liblzo1       >= 1.07}
43%else
44%{!?without_lzo:BuildRequires:	lzo-devel >= 1.07}
45%{!?without_lzo:Requires:	lzo       >= 1.07}
46%endif
47%endif
48
49%{!?without_pam:BuildRequires:	pam-devel}
50%{!?without_pam:Requires:	pam}
51
52%{?with_pkcs11:BuildRequires:	pkcs11-helper-devel}
53%{?with_pkcs11:Requires:	pkcs11-helper}
54
55#
56# Description
57#
58
59%description
60OpenVPN is a robust and highly flexible VPN daemon by James Yonan.
61OpenVPN supports SSL/TLS security,
62ethernet bridging,
63TCP or UDP tunnel transport through proxies or NAT,
64support for dynamic IP addresses and DHCP,
65scalability to hundreds or thousands of users,
66and portability to most major OS platforms.
67
68%package devel
69Summary:	OpenVPN is a robust and highly flexible VPN daemon by James Yonan.
70Group:		Applications/Internet
71Requires:	%{name}
72%description devel
73Development support for OpenVPN.
74
75#
76# Define vendor type
77#
78
79%if "%{_vendor}" == "suse" || "%{_vendor}" == "pc"
80%define VENDOR SuSE
81%else
82%define VENDOR %_vendor
83%endif
84
85#
86# Other definitions
87#
88
89%define debug_package %{nil}
90
91#
92# Build OpenVPN binary
93#
94
95%prep
96%setup -q
97
98%build
99%configure \
100	--disable-dependency-tracking \
101	--docdir="%{_docdir}/%{name}-%{version}" \
102	%{?with_password_save:--enable-password-save} \
103	%{!?without_lzo:--enable-lzo} \
104	%{?with_pkcs11:--enable-pkcs11} \
105	%{?without_pam:--disable-plugin-auth-pam}
106%__make
107
108#
109# Installation section
110#
111
112%install
113[ %{buildroot} != "/" ] && rm -rf %{buildroot}
114%__make install DESTDIR="%{buildroot}"
115
116# Install init script
117%if "%{VENDOR}" == "SuSE"
118%__install -c -d -m 755 "%{buildroot}/etc/init.d"
119%__install -c -m 755 "distro/rpm/%{name}.init.d.suse" "%{buildroot}/etc/init.d/%{name}"
120%else
121%__install -c -d -m 755 "%{buildroot}/etc/rc.d/init.d"
122%__install -c -m 755 distro/rpm/%{name}.init.d.rhel "%{buildroot}/etc/rc.d/init.d/%{name}"
123%endif
124
125# Install /etc/openvpn
126%__install -c -d -m 755 "%{buildroot}/etc/%{name}"
127
128# Install extra %doc stuff
129cp -r AUTHORS ChangeLog NEWS contrib/ sample/ \
130	"%{buildroot}/%{_docdir}/%{name}-%{version}"
131
132#
133# Clean section
134#
135
136%clean
137[ %{buildroot} != "/" ] && rm -rf "%{buildroot}"
138
139#
140# On Linux 2.4, make the device node
141#
142
143%post
144case "`uname -r`" in
1452.4*)
146	/bin/mkdir /dev/net >/dev/null 2>&1
147	/bin/mknod /dev/net/tun c 10 200 >/dev/null 2>&1
148	;;
149esac
150
151#
152# Handle the init script
153#
154
155/sbin/chkconfig --add %{name}
156%if "%{VENDOR}" == "SuSE"
157/etc/init.d/openvpn restart
158%else
159/sbin/service %{name} condrestart
160%endif
161%preun
162if [ "$1" = 0 ]
163then
164	%if "%{VENDOR}" == "SuSE"
165	/etc/init.d/openvpn stop
166	%else
167	/sbin/service %{name} stop
168	%endif
169	/sbin/chkconfig --del %{name}
170fi
171
172#
173# Files section
174#
175# don't use %doc as old rpmbuild removes it[1].
176# [1] http://rpm.org/ticket/836
177
178%files
179%defattr(-,root,root)
180%{_mandir}
181%{_sbindir}/%{name}
182%{_libdir}/%{name}
183%{_docdir}/%{name}-%{version}
184%dir /etc/%{name}
185%if "%{VENDOR}" == "SuSE"
186/etc/init.d/%{name}
187%else
188/etc/rc.d/init.d/%{name}
189%endif
190
191%files devel
192%defattr(-,root,root)
193%{_includedir}/*
194
195%changelog
196* Thu Jul 30 2009 David Sommerseth <dazo@users.sourceforge.net>
197- Removed management/ directory from %doc
198
199* Thu Dec 14 2006 Alon Bar-Lev
200- Added with_pkcs11
201
202* Mon Aug 2 2005 James Yonan
203- Fixed build problem with --define 'without_pam 1'
204
205* Mon Apr 4 2005 James Yonan
206- Moved some files from /usr/share/openvpn to %doc for compatibility
207  with Dag Wieers' RPM repository
208
209* Sat Mar 12 2005 Tom Walsh
210- Added MandrakeSoft liblzo1 require
211
212* Fri Dec 10 2004 James Yonan
213- Added AutoReq: 0 for manual dependencies
214
215* Fri Dec 10 2004 James Yonan
216- Packaged the plugins
217
218* Sun Nov 7 2004 Umberto Nicoletti
219- SuSE support
220
221* Wed Aug 18 2004 Bishop Clark (LC957) <bishop@platypus.bc.ca>
222- restrict what we claim in /etc/ to avoid ownership conflicts
223
224* Sun Feb 23 2003 Matthias Andree <matthias.andree@gmx.de> 1.3.2.14-1.
225- Have the version number filled in by autoconf.
226
227* Wed Jul 10 2002 James Yonan <jim@yonan.net> 1.3.1-1
228- Fixed %preun to only remove service on final uninstall
229
230* Mon Jun 17 2002 bishop clark (LC957) <bishop@platypus.bc.ca> 1.2.2-1
231- Added condrestart to openvpn.spec & openvpn.init.
232
233* Wed May 22 2002 James Yonan <jim@yonan.net> 1.2.0-1
234- Added mknod for Linux 2.4.
235
236* Wed May 15 2002 Doug Keller <dsk@voidstar.dyndns.org> 1.1.1.16-2
237- Added init scripts
238- Added conf file support
239
240* Mon May 13 2002 bishop clark (LC957) <bishop@platypus.bc.ca> 1.1.1.14-1
241- Added new directories for config examples and such
242
243* Sun May 12 2002 bishop clark (LC957) <bishop@platypus.bc.ca> 1.1.1.13-1
244- Updated buildroot directive and cleanup command
245- added easy-rsa utilities
246
247* Mon Mar 25 2002 bishop clark (LC957) <bishop@platypus.bc.ca> 1.0-1
248- Initial build.
249