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