support SL6
[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-pre2939
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 14
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 Source2:        vprocunhide-files
41 Patch1: nomtab.patch
42 Patch2: upstart.patch
43 Patch3: sl.patch
44 BuildRoot:      %_tmppath/%name-%version-%release-root
45 Requires:       init(%name)
46 Requires:       %name-core = %version-%release
47 Requires:       %name-lib  = %version-%release
48 Requires:       diffutils mktemp sed
49 Provides:       vserver = %version-%release
50 Obsoletes:      vserver < %version
51 BuildRequires:  mount vconfig gawk /sbin/ip iptables
52 BuildRequires:  gcc-c++ wget which diffutils
53 BuildRequires:  e2fsprogs-devel e2fsprogs
54 %{!?_without_beecrypt:BuildRequires: beecrypt-devel}
55 %{?_without_beecrypt:BuildRequires: nss-devel}
56 BuildRequires:  e2fsprogs
57 %{!?_without_doc:BuildRequires: doxygen tetex-latex}
58 %{!?_without_python:BuildRequires: python python-devel ctags}
59 Requires(post):         %name-core
60 Requires(pre):          %pkglibdir
61 Requires(postun):       %pkglibdir
62 %{!?_without_dietlibc:BuildRequires:    dietlibc >= 0:0.25}
63 %{?_with_xalan:BuildRequires:   xalan-j}
64
65 %package lib
66 Summary:                Dynamic libraries for util-vserver
67 Group:                  System Environment/Libraries
68
69 %package core
70 Summary:                The core-utilities for util-vserver
71 Group:                  Applications/System
72 Requires:               util-linux
73
74 %package build
75 Summary:                Tools which can be used to build vservers
76 Group:                  Applications/System
77 Requires:               rpm wget binutils tar
78 Requires:               %name = %version-%release
79 Requires(pre):          %confdir
80 Requires(postun):       %confdir
81 Requires(post):         %name-core
82
83 %package sysv
84 Summary:                SysV-initscripts for vserver
85 Group:                  System Environment/Base
86 Provides:               init(%name) = sysv
87 Requires:               make diffutils
88 Requires:               initscripts
89 Requires:               %name = %version-%release
90 Requires(post):         %chkconfig
91 Requires(preun):        %chkconfig
92 Requires(pre):          %_initrddir %pkglibdir
93 requires(postun):       %_initrddir %pkglibdir
94
95 %package legacy
96 Summary:                Legacy utilities for util-vserver
97 Group:                  Applications/System
98 Requires:               %name = %version-%release
99 Requires(post):         %chkconfig
100 Requires(preun):        %chkconfig
101 Requires(pre):          %_initrddir %pkglibdir
102 requires(postun):       %_initrddir %pkglibdir
103
104 %package devel
105 Summary:                Header-files and libraries needed to develop vserver based applications
106 Group:                  Development/Libraries
107 Requires:               pkgconfig
108 Requires:               %name-lib = %version-%release
109
110 %package python
111 Summary:                Python bindings to develop vserver-based applications
112 Group:                  Development/Libraries
113 Requires:               %name-lib = %version-%release
114
115
116 %description
117 util-vserver provides the components and a framework to setup virtual
118 servers.  A virtual server runs inside a linux server. It is nevertheless
119 highly independent. As such, you can run various services with normal
120 configuration. The various vservers can't interact with each other and
121 can't interact with services in the main server.
122
123 This requires a special kernel supporting the new new_s_context and
124 set_ipv4root system call.
125
126 %description lib
127 util-vserver provides the components and a framework to setup virtual
128 servers.  A virtual server runs inside a linux server. It is nevertheless
129 highly independent. As such, you can run various services with normal
130 configuration. The various vservers can't interact with each other and
131 can't interact with services in the main server.
132
133 This package contains the shared libraries needed by all other
134 'util-vserver' subpackages.
135
136 %description core
137 util-vserver provides the components and a framework to setup virtual
138 servers.  A virtual server runs inside a linux server. It is nevertheless
139 highly independent. As such, you can run various services with normal
140 configuration. The various vservers can't interact with each other and
141 can't interact with services in the main server.
142
143 This package contains utilities which are required to communicate with
144 the Linux-Vserver enabled kernel.
145
146
147 %description build
148 util-vserver provides the components and a framework to setup virtual
149 servers.  A virtual server runs inside a linux server. It is nevertheless
150 highly independent. As such, you can run various services with normal
151 configuration. The various vservers can't interact with each other and
152 can't interact with services in the main server.
153
154 This package contains utilities which assist in building Vservers.
155
156 %description sysv
157 util-vserver provides the components and a framework to setup virtual
158 servers.  A virtual server runs inside a linux server. It is nevertheless
159 highly independent. As such, you can run various services with normal
160 configuration. The various vservers can't interact with each other and
161 can't interact with services in the main server.
162
163 This package contains the SysV initscripts which start and stop
164 VServers and related tools.
165
166
167 %description legacy
168 util-vserver provides the components and a framework to setup virtual
169 servers.  A virtual server runs inside a linux server. It is nevertheless
170 highly independent. As such, you can run various services with normal
171 configuration. The various vservers can't interact with each other and
172 can't interact with services in the main server.
173
174 This package contains the tools which are needed to work with VServers
175 having an old-style configuration.
176
177
178 %description devel
179 util-vserver provides the components and a framework to setup virtual
180 servers.  A virtual server runs inside a linux server. It is nevertheless
181 highly independent. As such, you can run various services with normal
182 configuration. The various vservers can't interact with each other and
183 can't interact with services in the main server.
184
185 This package contains header files and libraries which are needed to
186 develop VServer related applications.
187
188 %description python
189 util-vserver provides the components and a framework to setup virtual
190 servers.  A virtual server runs inside a linux server. It is nevertheless
191 highly independent. As such, you can run various services with normal
192 configuration. The various vservers can't interact with each other and
193 can't interact with services in the main server.
194
195 This package contains the files needed to interface with the
196 Linux-VServer API from Python.
197
198
199 %prep
200 %setup -q -n %name-%fullver
201 %patch1 -p1
202 %patch2 -p1
203 %patch3 -p0
204 autoreconf -fi
205
206 %build
207 %configure --with-initrddir=%_initrddir --enable-release \
208            %{?_without_dietlibc:--disable-dietlibc} \
209            %{?_with_legacy:--enable-apis=NOLEGACY} \
210            --with-initscripts=sysv \
211            %{?_without_python:--without-python}
212
213 %__make %{?_smp_mflags} all
214 %{!?_without_doc:%__make %{?_smp_mflags} doc}
215
216
217 %install
218 rm -rf $RPM_BUILD_ROOT
219 %__make DESTDIR="$RPM_BUILD_ROOT" install install-distribution
220
221 rm -f $RPM_BUILD_ROOT/%_libdir/*.la
222
223 MANIFEST_CONFIG='%config' \
224 MANIFEST_CONFIG_NOREPLACE='%config(noreplace)' \
225 contrib/make-manifest %name $RPM_BUILD_ROOT contrib/manifest.dat
226
227 install -c -m 644 %{SOURCE1} %{buildroot}/%pkglibdir/defaults/fstab
228 install -c -m 644 %{SOURCE2} %{buildroot}/%pkglibdir/defaults/vprocunhide-files
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 %chkconfig vprocunhide on
262 %chkconfig util-vserver on
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 NEWS README THANKS
349 #%doc AUTHORS COPYING ChangeLog NEWS README THANKS
350 #%doc doc/*.html doc/*.css
351 /sbin/vshelper
352 %dir %confdir
353 %dir %confdefaultdir
354 %dir %confdefaultdir/apps
355 %dir %confdefaultdir/files
356 %dir %pkglibdir/defaults
357 %ghost %confdefaultdir/cachebase
358 %ghost %confdefaultdir/vdirbase
359 %ghost %confdefaultdir/run.rev
360
361 %dir %_localstatedir/cache/vservers
362 %dir %_localstatedir/run/vservers
363 %dir %_localstatedir/run/vservers.rev
364 %dir %_localstatedir/run/vshelper
365
366
367 %files lib -f %name-lib.list
368 %files sysv -f %name-sysv.list
369
370
371 %files core -f %name-core.list
372 %defattr(-,root,root,-)
373 %dir %pkglibdir
374
375
376 %files build -f %name-build.list
377 %defattr(-,root,root,-)
378 %doc contrib/yum*.patch
379 %dir %confdir/.distributions
380 %dir %confdir/.distributions/*
381 %dir %confdir/.distributions/*/apt
382 %dir %confdir/.distributions/.common
383 %dir %confdir/.distributions/.common/pubkeys
384 %dir %confdefaultdir/apps/vunify
385 %dir %confdefaultdir/apps/vunify/hash
386
387
388 %files legacy -f %name-legacy.list
389 %defattr(-,root,root,-)
390 %dir %pkglibdir/legacy
391
392
393 %files devel -f %name-devel.list
394 %defattr(-,root,root,-)
395 %{!?_without_doc:%doc lib/apidoc/latex/refman.pdf}
396 %{!?_without_doc:%doc lib/apidoc/html}
397
398
399 %files python
400 %defattr(-,root,root,-)
401 %{!?_without_python:%{python_sitearch}/*}
402
403
404 %changelog
405 * Fri Feb 18 2011 Sapan Bhatia <sapanb@cs.princeton.edu> - util-vserver-0.30.216-14
406 - Retagging to make sure the tagging operation worked.
407
408 * Fri Feb 18 2011 Andy Bavier <acb@cs.princeton.edu> - util-vserver-0.30.216-13
409 - Add /proc/diskstats to vprocunhide-files
410
411 * Mon Jan 31 2011 Andy Bavier <acb@cs.princeton.edu> - util-vserver-0.30.216-12
412 - add files needed by CoMon to vprocunhide-files list
413
414 * Thu Jan 20 2011 S.Çağlar Onur <caglar@cs.princeton.edu> - util-vserver-0.30.216-11
415 - add a custom vprocunhide-files file which contains /proc/partitions
416
417 * Wed Dec 08 2010 S.Çağlar Onur <caglar@cs.princeton.edu> - util-vserver-0.30.216-10
418 - Enable vprocunhide service
419
420 * Wed Dec 01 2010 S.Çağlar Onur <caglar@cs.princeton.edu> - util-vserver-0.30.216-9
421 - Sync with upstream revision 2926
422
423 * Tue Nov 16 2010 S.Çağlar Onur <caglar@cs.princeton.edu> - util-vserver-0.30.216-8
424 - Sync with upstream revision 2924
425
426 * Thu Aug 12 2010 S.Çağlar Onur <caglar@cs.princeton.edu> - util-vserver-0.30.216-7
427 - Sync with upstream revision 2912
428
429 * Mon Aug 09 2010 S.Çağlar Onur <caglar@cs.princeton.edu> - util-vserver-0.30.216-6
430 - Sync with upstream revision 2908
431
432 * Thu Jul 29 2010 S.Çağlar Onur <caglar@cs.princeton.edu> - util-vserver-0.30.216-5
433 - Fix f12 build
434
435 * Wed Jul 28 2010 S.Çağlar Onur <caglar@cs.princeton.edu> - util-vserver-0.30.216-4
436 - Sync with upstream revision 2902
437
438 * Tue Jun 08 2010 S.Çağlar Onur <caglar@cs.princeton.edu> - util-vserver-0.30.216-3
439 - Do not restart util-vserver service on upgrades
440
441 * Tue Jun 01 2010 S.Çağlar Onur <caglar@cs.princeton.edu> - util-vserver-0.30.216-2
442 - remove tmpfs mounted /tmp from fstab template
443
444 * Tue May 11 2010 S.Çağlar Onur <caglar@cs.princeton.edu> - util-vserver-0.30.216-1
445
446 * Mon Jun 25 2007 Daniel Hokka Zakrisson <daniel@hozac.com> - 0.30.214-0
447 - updated URLs
448 - get rid of e2fsprogs requirement
449
450 * Fri Dec 29 2006 Daniel Hokka Zakrisson <daniel@hozac.com> - 0.30.213-0
451 - add --with legacy and --without doc switches
452 - add util-vserver initscript
453
454 * Sun Jan 22 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0.30.210-0
455 - do not require 'xalan' anymore by default
456 - removed 'Requires: apt'; apt-rpm is not maintained upstream anymore
457 - removed 'chattr' leftovers
458 - create the '/etc/vservers/.defaults/cachebase' symlink
459 - added /var/cache/vservers and the needed support
460 - set barrier attribute on /vservers/.pkg and /vservers/.hash
461 - added 'centos-release' to the list of packages in the copy-the-keys
462   trigger script
463 - create '/vservers/.hash' and add initial configuration for it
464
465 * Sun Oct 30 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.209-0
466 - version 0.30.209
467 - copy centos keys
468
469 * Sat Jul 16 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.208-2
470 - updated URLs
471
472 * Fri Jul 15 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.208-1
473 - version 0.30.208
474 - require the -lib subpackage by -devel
475 - copy GPG keys from /etc/pki/rpm-gpg/
476
477 * Fri Apr 15 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.206-1
478 - added patches to make yum work in chroot environments
479 - version 0.30.206
480
481 * Thu Mar 24 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.205-0
482 - added some %%descriptions
483 - copy GPG keys from the system into the confdir
484 - buildrequire dietlibc-0.25
485 - BuildRequire beecrypt-devel
486 - cleanups
487 - use %%global instead of %%define
488 - removed 'run.rev' as a vserver-local variable and made it a system-wide setting
489
490 * Wed Jan 26 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.198-0.3
491 - updated BuildRequires:
492 - use 'setattr --barrier' instead of 'chattr +t' in the %%post scriptlet
493 - moved the v_* initscripts to legacy
494 - do not ship the /vservers directory itself; as it is immutable, the
495   extraction will fail else
496
497 * Thu Sep  9 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.194-0
498 - documented switches for 'rpmbuild'
499
500 * Wed May 26 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.215-0
501 - (re)added the MANIFEST_* variables which were lost some time ago;
502   this will preserve %%config files...
503
504 * Mon Mar 15 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.202-0
505 - use file-list for sysv scripts also
506
507 * Sat Mar  6 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.198-0
508 - added vprocunhide-service support
509 - added doxygen support
510 - updated Requires:
511
512 * Wed Oct  1 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.23.5-0
513 - Initial build.