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