]> git.pld-linux.org Git - packages/freeswan.git/blob - freeswan.spec
- some cosmetics
[packages/freeswan.git] / freeswan.spec
1 # Conditional builds
2 # _without_x509
3 # _with_klips
4 # _with_smp
5 # _with_oldconfig
6
7 %define x509ver          x509patch-0.9.11
8
9 Summary:        Free IPSEC implemetation
10 Summary(pl):    Publicznie dostêpna implementacja IPSEC
11 Name:           freeswan
12 Version:        1.97
13 Release:        0.4
14 License:        GPL
15 Group:          Networking/Daemons
16 Source0:        ftp://ftp.xs4all.nl/pub/crypto/%{name}/%{name}-%{version}.tar.gz
17 Source1:        http://www.mif.pg.gda.pl/homepages/ankry/man-PLD/%{name}-pl-man-pages.tar.bz2
18 Source2:        http://www.strongsec.com/%{name}/%{x509ver}-%{name}-%{version}.tar.gz
19 Source3:        %{name}-kernel.config
20 Patch0:         %{name}-Makefile.patch
21 Patch1:         %{name}-manlink.patch
22 Patch2:         %{name}-config.patch
23 Patch3:         %{name}-init.patch
24 Patch4:         %{name}-keygen.patch
25 Patch5:         x509-config.patch
26 Patch6:         kernel-ipsec-bridge.patch
27 #Patch6:                %{name}-kernel-module.patch
28 #Patch7:                %{name}-make-module.patch
29 URL:            http://www.freeswan.org/
30 Prereq:         /sbin/chkconfig
31 Prereq:         rc-scripts
32 BuildRequires:  gmp-devel
33 BuildRequires:  kernel-source
34 BuildRequires:  kernel-headers
35 BuildRequires:  kernel-doc
36 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
37 Requires:       gmp
38
39 %define klips 1
40 %{?_without_klips:%define klips 0}
41 %define x509 1
42 %{?_without_x509:%define x509 0}
43
44 %description
45 The basic idea of IPSEC is to provide security functions
46 (authentication and encryption) at the IP (Internet Protocol) level.
47 It will be required in IP version 6 (better known as IPng, the next
48 generation) and is optional for the current IP, version 4.
49
50 FreeS/WAN is a freely-distributable implementation of IPSEC protocol.
51 FreeS/WAN utilities%{?!_without_x509: compiled with X.509 certificate support}.
52
53 %description -l pl
54 Podstawowa idea IPSEC to zapewnienie funkcji bezpieczeñstwa
55 (autentykacji i szyfrowania) na poziomie IP. Bêdzie wymagany do IP w
56 wersji 6 (znanego tak¿e jako IPng, IP nastêpnej generacji) i jest
57 opcjonalny dla aktualnego IP, w wersji 4.
58
59 FreeS/WAN jest darmow± implementacj± protoko³u IPSEC.
60
61 %if %{klips}
62 %package -n kernel-%{_kernel_ver}-ipsec
63 Summary: FreeS/WAN IPSec kernel module
64 Summary(pl): Modu³ IPSec do j±dra
65 Group: System Environment/Kernel
66 Requires: freeswan
67 %endif
68
69 %if %{klips}
70 %description -n kernel-%{_kernel_ver}-ipsec
71 FreeS/WAN IPSec Kernel Module (KLIPS)
72
73 %description -l pl 
74 Modu³ j±dra do IPSec
75 %endif
76
77
78 %prep
79 %setup  -q -a2
80
81 %if %{klips}
82 cp -pR %{_kernelsrcdir}/ linux
83 %endif
84
85 %patch0 -p1
86 %patch1 -p1
87 %patch2 -p1
88 %patch3 -p1
89 %patch4 -p1
90
91 %if %{klips}
92 %patch6 -p1
93 #%patch7 -p1
94 %endif
95
96 %{?!_without_x509:patch -p1 <%{x509ver}-%{name}-%{version}/freeswan.diff}
97 %{?!_without_x509:%patch5 -p1 }
98
99
100
101 %build
102
103 %if %{klips}
104
105 cd linux
106 if [ -f .config ]; then
107     cat %{SOURCE3} >> .config   
108         
109 else
110     echo "ERROR: There is no kernel configuration available."
111     echo "Configure your kernel first and add --with oldconfig"
112     echo "to rpmbuild command line when trying to build with"
113     echo "klips module next time."
114     exit 1
115
116 #  make oldconfig_nonint 1>/dev/null 2>&1
117 fi
118 %{__make} -s include/linux/version.h
119 cd ..
120 %endif
121
122 USERCOMPILE="%{rpmcflags}" ; export USERCOMPILE
123 OPT_FLAGS="%{rpmcflags}"; export OPT_FLAGS
124 CC=%{__cc}; export CC
125 %{__make}   %{?!_without_klips:KERNELSRC=linux precheck insert ocf module}  programs
126
127 %install
128 rm -rf $RPM_BUILD_ROOT
129 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/ipsec,/etc/rc.d/init.d,/var/run/pluto}
130
131 %{__make} install \
132         DESTDIR="$RPM_BUILD_ROOT"
133
134 %if %{x509}
135  install -d  $RPM_BUILD_ROOT%{_sysconfdir}/ipsec.d
136  for i in crls cacerts private; do
137   install -d  $RPM_BUILD_ROOT%{_sysconfdir}/ipsec.d/$i
138 done
139 for i in CHANGES README; do
140   install  %{x509ver}-%{name}-%{version}/$i $i.x509 ;   
141         gzip -9nf $i.x509 ;
142
143 done
144 %endif
145
146 %if %{klips}
147 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc
148 install linux/net/ipsec/ipsec.o $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/ipsec.o
149 %endif
150
151 bzip2 -dc %{SOURCE1} | tar xf - -C $RPM_BUILD_ROOT%{_mandir}
152
153 gzip -9nf README CREDITS CHANGES BUGS \
154           doc/{kernel.notes,impl.notes,examples,prob.report,standards} 
155                 
156
157 %clean
158 rm -rf $RPM_BUILD_ROOT
159
160 %post
161 # generate RSA private key... if, and only if, /etc/ipsec/ipsec.secrets does
162 # not already exist
163 if [ ! -f %{_sysconfdir}/ipsec/ipsec.secrets ];
164 then
165     echo generate RSA private key...
166     /usr/sbin/ipsec newhostkey --output %{_sysconfdir}/ipsec/ipsec.secrets
167     chmod 600 %{_sysconfdir}/ipsec/ipsec.secrets
168 fi
169
170 /sbin/chkconfig --add ipsec
171 if [ -f /var/lock/subsys/ipsec ]; then
172         /etc/rc.d/init.d/ipsec restart >&2
173 else
174         echo "Run '/etc/rc.d/init.d/ipsec start' to start IPSEC services." >&2
175 fi
176
177 %preun
178 if [ "$1" = "0" ]; then
179         if [ -f /var/lock/subsys/ipsec ]; then
180                 /etc/rc.d/init.d/ipsec stop >&2
181         fi
182         /sbin/chkconfig --del ipsec >&2
183 fi
184
185 %files
186 %defattr(644,root,root,755)
187 %doc *.gz doc/*.gz doc/*.html
188 %{?!_without_x509:%doc CHANGES.x509.gz README.x509.gz}
189 %{_mandir}/man*/*
190 %lang(pl) %{_mandir}/pl/man*/*
191 %attr(755,root,root) %{_sbindir}/*
192 %attr(754,root,root) /etc/rc.d/init.d/*
193 %dir %{_libdir}/ipsec
194 %attr(755,root,root) %{_libdir}/ipsec/*
195 %attr(751,root,root) %dir %{_sysconfdir}/ipsec
196 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/ipsec/*
197 %if %{x509}
198 %attr(0700,root,root) %dir %{_sysconfdir}/ipsec.d
199 %attr(0700,root,root) %dir %{_sysconfdir}/ipsec.d/crls
200 %attr(0700,root,root) %dir %{_sysconfdir}/ipsec.d/cacerts
201 %attr(0700,root,root) %dir %{_sysconfdir}/ipsec.d/private
202 %endif
203
204 %if %{klips}
205 %files -n kernel%{?_with_smp:-smp}-%{_kernel_ver}%{?kext:-%{kext}}-ipsec
206 %defattr(644,root,root,755)
207 /lib/modules/%{kverrel}/kernel/net/ipsec
208 %endif
This page took 0.082223 seconds and 4 git commands to generate.