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