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