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