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