replace patch with external file
[util-vserver.git] / util-vserver.spec
1 # $Id: util-vserver.spec.in 2807 2008-10-30 01:59:52Z dhozac $
2
3 %if "%{?_without_python:1}" != "1"
4 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
5 %endif
6
7 ## This package understands the following switches:
8 ## --without dietlibc        ...   disable usage of dietlibc
9 ## --with xalan              ...   require/use the xalan xslt processor
10 ## --without doc             ...   disable doc generation
11 ## --with legacy             ...   enable the legacy APIs
12
13 %global confdir         %_sysconfdir/vservers
14 %global confdefaultdir  %confdir/.defaults
15 %global pkglibdir       %_libdir/%name
16 %global chkconfig       /sbin/chkconfig
17
18 %global _localstatedir  %_var
19
20 %global fullver         0.30.216-pre2883
21 %global modulever 0.30.216
22 %global ver             %( echo %fullver | sed 's/-.*//' )
23 %global subver          %( s=`echo %fullver | grep -- - | sed 's/.*-/./'`; echo ${s:-.1} )
24
25 # for module-tools
26 %global module_version_varname modulever
27 %global taglevel 2
28
29 %{!?release_func:%global release_func() %1%{?dist}}
30
31 Summary:        Linux virtual server utilities
32 Name:           util-vserver
33 Version:        %ver
34 Release:        %taglevel
35 License:        GPL
36 Group:          System Environment/Base
37 URL:            http://savannah.nongnu.org/projects/util-vserver/
38 Source0:        http://ftp.linux-vserver.org/pub/utils/util-vserver/%name-%fullver.tar.bz2
39 Source1:        fstab
40 Patch1:         f12.patch
41 Patch2:         f13.patch
42 BuildRoot:      %_tmppath/%name-%version-%release-root
43 Requires:       init(%name)
44 Requires:       %name-core = %version-%release
45 Requires:       %name-lib  = %version-%release
46 Requires:       diffutils mktemp sed
47 Provides:       vserver = %version-%release
48 Obsoletes:      vserver < %version
49 BuildRequires:  mount vconfig gawk /sbin/ip iptables
50 BuildRequires:  gcc-c++ wget which diffutils
51 BuildRequires:  e2fsprogs-devel e2fsprogs
52 %{!?_without_beecrypt:BuildRequires: beecrypt-devel}
53 %{?_without_beecrypt:BuildRequires: nss-devel}
54 BuildRequires:  e2fsprogs
55 %{!?_without_doc:BuildRequires: doxygen tetex-latex}
56 %{!?_without_python:BuildRequires: python python-devel ctags}
57 Requires(post):         %name-core
58 Requires(pre):          %pkglibdir
59 Requires(postun):       %pkglibdir
60 %{!?_without_dietlibc:BuildRequires:    dietlibc >= 0:0.25}
61 %{?_with_xalan:BuildRequires:   xalan-j}
62
63 %package lib
64 Summary:                Dynamic libraries for util-vserver
65 Group:                  System Environment/Libraries
66
67 %package core
68 Summary:                The core-utilities for util-vserver
69 Group:                  Applications/System
70 Requires:               util-linux
71
72 %package build
73 Summary:                Tools which can be used to build vservers
74 Group:                  Applications/System
75 Requires:               rpm wget binutils tar
76 Requires:               %name = %version-%release
77 Requires(pre):          %confdir
78 Requires(postun):       %confdir
79 Requires(post):         %name-core
80
81 %package sysv
82 Summary:                SysV-initscripts for vserver
83 Group:                  System Environment/Base
84 Provides:               init(%name) = sysv
85 Requires:               make diffutils
86 Requires:               initscripts
87 Requires:               %name = %version-%release
88 Requires(post):         %chkconfig
89 Requires(preun):        %chkconfig
90 Requires(pre):          %_initrddir %pkglibdir
91 requires(postun):       %_initrddir %pkglibdir
92
93 %package legacy
94 Summary:                Legacy utilities for util-vserver
95 Group:                  Applications/System
96 Requires:               %name = %version-%release
97 Requires(post):         %chkconfig
98 Requires(preun):        %chkconfig
99 Requires(pre):          %_initrddir %pkglibdir
100 requires(postun):       %_initrddir %pkglibdir
101
102 %package devel
103 Summary:                Header-files and libraries needed to develop vserver based applications
104 Group:                  Development/Libraries
105 Requires:               pkgconfig
106 Requires:               %name-lib = %version-%release
107
108 %package python
109 Summary:                Python bindings to develop vserver-based applications
110 Group:                  Development/Libraries
111 Requires:               %name-lib = %version-%release
112
113
114 %description
115 util-vserver provides the components and a framework to setup virtual
116 servers.  A virtual server runs inside a linux server. It is nevertheless
117 highly independent. As such, you can run various services with normal
118 configuration. The various vservers can't interact with each other and
119 can't interact with services in the main server.
120
121 This requires a special kernel supporting the new new_s_context and
122 set_ipv4root system call.
123
124 %description lib
125 util-vserver provides the components and a framework to setup virtual
126 servers.  A virtual server runs inside a linux server. It is nevertheless
127 highly independent. As such, you can run various services with normal
128 configuration. The various vservers can't interact with each other and
129 can't interact with services in the main server.
130
131 This package contains the shared libraries needed by all other
132 'util-vserver' subpackages.
133
134 %description core
135 util-vserver provides the components and a framework to setup virtual
136 servers.  A virtual server runs inside a linux server. It is nevertheless
137 highly independent. As such, you can run various services with normal
138 configuration. The various vservers can't interact with each other and
139 can't interact with services in the main server.
140
141 This package contains utilities which are required to communicate with
142 the Linux-Vserver enabled kernel.
143
144
145 %description build
146 util-vserver provides the components and a framework to setup virtual
147 servers.  A virtual server runs inside a linux server. It is nevertheless
148 highly independent. As such, you can run various services with normal
149 configuration. The various vservers can't interact with each other and
150 can't interact with services in the main server.
151
152 This package contains utilities which assist in building Vservers.
153
154 %description sysv
155 util-vserver provides the components and a framework to setup virtual
156 servers.  A virtual server runs inside a linux server. It is nevertheless
157 highly independent. As such, you can run various services with normal
158 configuration. The various vservers can't interact with each other and
159 can't interact with services in the main server.
160
161 This package contains the SysV initscripts which start and stop
162 VServers and related tools.
163
164
165 %description legacy
166 util-vserver provides the components and a framework to setup virtual
167 servers.  A virtual server runs inside a linux server. It is nevertheless
168 highly independent. As such, you can run various services with normal
169 configuration. The various vservers can't interact with each other and
170 can't interact with services in the main server.
171
172 This package contains the tools which are needed to work with VServers
173 having an old-style configuration.
174
175
176 %description devel
177 util-vserver provides the components and a framework to setup virtual
178 servers.  A virtual server runs inside a linux server. It is nevertheless
179 highly independent. As such, you can run various services with normal
180 configuration. The various vservers can't interact with each other and
181 can't interact with services in the main server.
182
183 This package contains header files and libraries which are needed to
184 develop VServer related applications.
185
186 %description python
187 util-vserver provides the components and a framework to setup virtual
188 servers.  A virtual server runs inside a linux server. It is nevertheless
189 highly independent. As such, you can run various services with normal
190 configuration. The various vservers can't interact with each other and
191 can't interact with services in the main server.
192
193 This package contains the files needed to interface with the
194 Linux-VServer API from Python.
195
196
197 %prep
198 %setup -q -n %name-%fullver
199 %patch1 -p0
200 %patch2 -p1
201 autoreconf -fi
202
203 %build
204 %configure --with-initrddir=%_initrddir --enable-release \
205            %{?_without_dietlibc:--disable-dietlibc} \
206            %{?_with_legacy:--enable-apis=NOLEGACY} \
207            --with-initscripts=sysv \
208            %{?_without_python:--without-python}
209
210 %__make %{?_smp_mflags} all
211 %{!?_without_doc:%__make %{?_smp_mflags} doc}
212
213
214 %install
215 rm -rf $RPM_BUILD_ROOT
216 %__make DESTDIR="$RPM_BUILD_ROOT" install install-distribution
217
218 rm -f $RPM_BUILD_ROOT/%_libdir/*.la
219
220 MANIFEST_CONFIG='%config' \
221 MANIFEST_CONFIG_NOREPLACE='%config(noreplace)' \
222 contrib/make-manifest %name $RPM_BUILD_ROOT contrib/manifest.dat
223
224 install -c -m 755 %{SOURCE1} %{buildroot}/%pkglibdir/defaults/fstab
225
226 %check
227 %__make check
228
229
230 %clean
231 rm -rf $RPM_BUILD_ROOT
232
233
234 %post
235 test -d /vservers      || mkdir -m0000 /vservers
236 test -d /vservers/.pkg || mkdir -m0755 /vservers/.pkg
237
238 f="%confdefaultdir/vdirbase";  test -L "$f" -o -e "$f" || ln -s /vservers                        "$f"
239 f="%confdefaultdir/run.rev";   test -L "$f" -o -e "$f" || ln -s %_localstatedir/run/vservers.rev "$f"
240 f="%confdefaultdir/cachebase"; test -L "$f" -o -e "$f" || ln -s %_localstatedir/cache/vservers   "$f"
241
242 %_sbindir/setattr --barrier /vservers /vservers/.pkg || :
243
244
245 %preun
246 test "$1" != 0 || rm -rf %_localstatedir/cache/vservers/* 2>/dev/null || :
247
248
249 %post   lib -p /sbin/ldconfig
250 %postun lib -p /sbin/ldconfig
251
252
253 %post sysv
254 %chkconfig --add vservers-default
255 %chkconfig --add vprocunhide
256 %chkconfig --add util-vserver
257 %chkconfig util-vserver on
258 service util-vserver restart
259
260 %preun sysv
261 test "$1" != 0 || %_initrddir/vprocunhide stop &>/dev/null || :
262
263 test "$1" != 0 || %chkconfig --del vprocunhide
264 test "$1" != 0 || %chkconfig --del vservers-default
265 test "$1" != 0 || %chkconfig --del util-vserver
266
267
268 %postun sysv
269 test "$1" = 0  || %_initrddir/vprocunhide condrestart >/dev/null || :
270
271
272 %triggerin build -- fedora-release, centos-release
273 function copy()
274 {
275     base=$1
276     shift
277
278     for i; do
279         test -r "$i" || continue
280
281         target=%confdir/.distributions/.common/pubkeys/$base-$(basename "$i")
282         cp -a "$i" "$target"
283     done
284 }
285 copy fedora /usr/share/doc/fedora-release-*/RPM-GPG-*
286 copy fedora /etc/pki/rpm-gpg/RPM-GPG-*
287 copy centos /usr/share/doc/centos-*/RPM-GPG-KEY-*
288
289
290 %pre build
291 x="%_libdir/util-vserver/distributions/etch"
292 test -d "$x" && mv "$x" "$x.rpmsave" || :
293
294
295 %post build
296 test -d /vservers/.hash || mkdir -m0700 /vservers/.hash
297
298 f="%confdefaultdir/apps/vunify/hash"; test -e "$f"/method -o -e "$f"/00 || \
299         ln -s /vservers/.hash "$f"/00
300
301 %_sbindir/setattr --barrier /vservers/.hash || :
302
303
304 %preun build
305 test "$1" != 0 || rm -f %confdir/.distributions/.common/pubkeys/fedora-*
306
307
308 ## Temporary workaround to remove old v_* files; it will conflict
309 ## somehow with the -legacy package but can be fixed by reinstalling
310 ## this package.
311 ## TODO: remove me in the final .spec file
312 %define v_services      httpd named portmap sendmail smb sshd xinetd gated
313 %triggerun sysv -- util-vserver-sysv < 0.30.198
314 for i in %v_services; do
315         %chkconfig --del v_$i || :
316 done
317
318
319 %post legacy
320 %chkconfig --add rebootmgr
321 %chkconfig --add vservers-legacy
322
323 for i in %v_services; do
324         %chkconfig --add v_$i
325 done
326
327
328 %preun legacy
329 test "$1" != 0 || %_initrddir/rebootmgr   stop &>/dev/null || :
330
331 test "$1" != 0 || for i in %v_services; do
332         %chkconfig --del v_$i
333 done
334
335 test "$1" != 0 || %chkconfig --del rebootmgr
336 test "$1" != 0 || %chkconfig --del vservers-legacy
337
338 %postun legacy
339 test "$1" = 0  || %_initrddir/rebootmgr   condrestart >/dev/null || :
340
341
342 %files -f %name-base.list
343 %defattr(-,root,root,-)
344 %doc AUTHORS COPYING ChangeLog NEWS README THANKS
345 %doc doc/*.html doc/*.css
346 /sbin/vshelper
347 %dir %confdir
348 %dir %confdefaultdir
349 %dir %confdefaultdir/apps
350 %dir %confdefaultdir/files
351 %dir %pkglibdir/defaults
352 %ghost %confdefaultdir/cachebase
353 %ghost %confdefaultdir/vdirbase
354 %ghost %confdefaultdir/run.rev
355
356 %dir %_localstatedir/cache/vservers
357 %dir %_localstatedir/run/vservers
358 %dir %_localstatedir/run/vservers.rev
359 %dir %_localstatedir/run/vshelper
360
361
362 %files lib -f %name-lib.list
363 %files sysv -f %name-sysv.list
364
365
366 %files core -f %name-core.list
367 %defattr(-,root,root,-)
368 %dir %pkglibdir
369
370
371 %files build -f %name-build.list
372 %defattr(-,root,root,-)
373 %doc contrib/yum*.patch
374 %dir %confdir/.distributions
375 %dir %confdir/.distributions/*
376 %dir %confdir/.distributions/*/apt
377 %dir %confdir/.distributions/.common
378 %dir %confdir/.distributions/.common/pubkeys
379 %dir %confdefaultdir/apps/vunify
380 %dir %confdefaultdir/apps/vunify/hash
381
382
383 %files legacy -f %name-legacy.list
384 %defattr(-,root,root,-)
385 %dir %pkglibdir/legacy
386
387
388 %files devel -f %name-devel.list
389 %defattr(-,root,root,-)
390 %{!?_without_doc:%doc lib/apidoc/latex/refman.pdf}
391 %{!?_without_doc:%doc lib/apidoc/html}
392
393
394 %files python
395 %defattr(-,root,root,-)
396 %{!?_without_python:%{python_sitearch}/*}
397
398
399 %changelog
400 * Tue Jun 01 2010 S.Çağlar Onur <caglar@cs.princeton.edu> - util-vserver-0.30.216-2
401 - remove tmpfs mounted /tmp from fstab template
402
403 * Tue May 11 2010 S.Çağlar Onur <caglar@cs.princeton.edu> - util-vserver-0.30.216-1
404
405 * Mon Jun 25 2007 Daniel Hokka Zakrisson <daniel@hozac.com> - 0.30.214-0
406 - updated URLs
407 - get rid of e2fsprogs requirement
408
409 * Fri Dec 29 2006 Daniel Hokka Zakrisson <daniel@hozac.com> - 0.30.213-0
410 - add --with legacy and --without doc switches
411 - add util-vserver initscript
412
413 * Sun Jan 22 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0.30.210-0
414 - do not require 'xalan' anymore by default
415 - removed 'Requires: apt'; apt-rpm is not maintained upstream anymore
416 - removed 'chattr' leftovers
417 - create the '/etc/vservers/.defaults/cachebase' symlink
418 - added /var/cache/vservers and the needed support
419 - set barrier attribute on /vservers/.pkg and /vservers/.hash
420 - added 'centos-release' to the list of packages in the copy-the-keys
421   trigger script
422 - create '/vservers/.hash' and add initial configuration for it
423
424 * Sun Oct 30 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.209-0
425 - version 0.30.209
426 - copy centos keys
427
428 * Sat Jul 16 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.208-2
429 - updated URLs
430
431 * Fri Jul 15 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.208-1
432 - version 0.30.208
433 - require the -lib subpackage by -devel
434 - copy GPG keys from /etc/pki/rpm-gpg/
435
436 * Fri Apr 15 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.206-1
437 - added patches to make yum work in chroot environments
438 - version 0.30.206
439
440 * Thu Mar 24 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.205-0
441 - added some %%descriptions
442 - copy GPG keys from the system into the confdir
443 - buildrequire dietlibc-0.25
444 - BuildRequire beecrypt-devel
445 - cleanups
446 - use %%global instead of %%define
447 - removed 'run.rev' as a vserver-local variable and made it a system-wide setting
448
449 * Wed Jan 26 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.198-0.3
450 - updated BuildRequires:
451 - use 'setattr --barrier' instead of 'chattr +t' in the %%post scriptlet
452 - moved the v_* initscripts to legacy
453 - do not ship the /vservers directory itself; as it is immutable, the
454   extraction will fail else
455
456 * Thu Sep  9 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.194-0
457 - documented switches for 'rpmbuild'
458
459 * Wed May 26 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.215-0
460 - (re)added the MANIFEST_* variables which were lost some time ago;
461   this will preserve %%config files...
462
463 * Mon Mar 15 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.202-0
464 - use file-list for sysv scripts also
465
466 * Sat Mar  6 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.198-0
467 - added vprocunhide-service support
468 - added doxygen support
469 - updated Requires:
470
471 * Wed Oct  1 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.23.5-0
472 - Initial build.