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