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