438ae705ee01ab41e68d404ef222f07ab72a3770
[util-vserver.git] / util-vserver / util-vserver.spec.in
1 # $Id$
2
3 ## This package understands the following switches:
4 ## --without dietlibc        ...   disable usage of dietlibc
5 ## --without xalan           ...   do not require/use the xalan xslt processor
6
7 %global confdir         %_sysconfdir/vservers
8 %global confdefaultdir  %confdir/.defaults
9 %global pkglibdir       %_libdir/%name
10 %global __chattr        /usr/bin/chattr
11 %global chkconfig       /sbin/chkconfig
12
13 %global _localstatedir  %_var
14
15
16 %{!?release_func:%global release_func() %1}
17
18 Summary:        Linux virtual server utilities
19 Name:           @PACKAGE@
20 Version:        @VERSION@
21 Release:        %release_func 0.13
22 License:        GPL
23 Group:          System Environment/Base
24 URL:            http://savannah.nongnu.org/projects/util-vserver/
25 Source0:        http://savannah.nongnu.org/download/util-vserver/stable.pkg/%version/%name-%version.tar.bz2
26 BuildRoot:      %_tmppath/%name-%version-%release-root
27 Requires:       init(%name)
28 Requires:       %name-core = %version-%release
29 Requires:       %name-lib  = %version-%release
30 Requires:       diffutils mktemp sed
31 Provides:       vserver = %version-%release
32 Obsoletes:      vserver < %version
33 BuildRequires:  mount vconfig gawk iproute iptables
34 BuildRequires:  gcc-c++ wget
35 BuildRequires:  e2fsprogs-devel beecrypt-devel
36 BuildRequires:  doxygen tetex-latex
37 Requires(post):         %__chattr
38 Requires(pre):          %pkglibdir
39 Requires(postun):       %pkglibdir
40 %{!?_without_dietlibc:BuildRequires:    dietlibc >= 0:0.25}
41 %{!?_without_xalan:BuildRequires:       xalan-j}
42
43 %package lib
44 Summary:                Dynamic libraries for util-vserver
45 Group:                  System Environment/Libraries
46
47 %package core
48 Summary:                The core-utilities for util-vserver
49 Group:                  Applications/System
50 Requires:               util-linux
51
52 %package build
53 Summary:                Tools which can be used to build vservers
54 Group:                  Applications/System
55 Requires:               rpm apt wget binutils tar e2fsprogs
56 Requires:               %name = %version-%release
57 Requires(pre):          %confdir
58 Requires(postun):       %confdir
59
60 %package sysv
61 Summary:                SysV-initscripts for vserver
62 Group:                  System Environment/Base
63 Provides:               init(%name) = sysv
64 Requires:               make diffutils
65 Requires:               initscripts
66 Requires:               %name = %version-%release
67 Requires(post):         %chkconfig
68 Requires(preun):        %chkconfig
69 Requires(pre):          %_initrddir %pkglibdir
70 requires(postun):       %_initrddir %pkglibdir
71
72 %package legacy
73 Summary:                Legacy utilities for util-vserver
74 Group:                  Applications/System
75 Requires:               %name = %version-%release
76 Requires(post):         %chkconfig
77 Requires(preun):        %chkconfig
78 Requires(pre):          %_initrddir %pkglibdir
79 requires(postun):       %_initrddir %pkglibdir
80
81 %package devel
82 Summary:                Header-files and libraries which are needed to develop vserver based applications
83 Group:                  Development/Libraries
84 Requires:               pkgconfig
85
86
87 %description
88 This package provides the components and a framework to setup virtual
89 servers.  A virtual server runs inside a linux server. It is nevertheless
90 highly independent. As such, you can run various services with normal
91 configuration. The various vservers can't interact with each other and
92 can't interact with services in the main server.
93
94 This requires a special kernel supporting the new new_s_context and
95 set_ipv4root system call.
96
97 %description lib
98 %description core
99 %description build
100 %description sysv
101 %description legacy
102 %description devel
103
104
105 %prep
106 %setup -q
107
108
109 %build
110 %configure --with-initrddir=%_initrddir --enable-release \
111            %{?_without_dietlibc:--disable-dietlibc}
112
113 %__make %{?_smp_mflags} all
114 %__make %{?_smp_mflags} doc
115
116
117 %install
118 rm -rf $RPM_BUILD_ROOT
119 %__make DESTDIR="$RPM_BUILD_ROOT" install install-distribution
120
121 rm -f $RPM_BUILD_ROOT/%_libdir/*.la
122
123 MANIFEST_CONFIG='%config' \
124 MANIFEST_CONFIG_NOREPLACE='%config(noreplace)' \
125 contrib/make-manifest %name $RPM_BUILD_ROOT contrib/manifest.dat
126
127
128 %check || :
129 %__make check
130
131
132 %clean
133 rm -rf $RPM_BUILD_ROOT
134
135
136 %post
137 test -d /vservers      || mkdir -m0000 /vservers
138 test -d /vservers/.pkg || mkdir -m0755 /vservers/.pkg
139
140 f="%confdefaultdir/vdirbase"; test -L "$f" -o -e "$f" || ln -s /vservers                        "$f"
141 f="%confdefaultdir/run.rev";  test -L "$f" -o -e "$f" || ln -s %_localstatedir/run/vservers.rev "$f"
142
143 %_sbindir/setattr --barrier /vservers || :
144
145
146 %post   lib -p /sbin/ldconfig
147 %postun lib -p /sbin/ldconfig
148
149
150 %post sysv
151 %chkconfig --add vservers-default
152 %chkconfig --add vprocunhide
153
154
155
156 %preun sysv
157 test "$1" != 0 || %_initrddir/vprocunhide stop &>/dev/null || :
158
159 test "$1" != 0 || %chkconfig --del vprocunhide
160 test "$1" != 0 || %chkconfig --del vservers-default
161
162
163 %postun sysv
164 test "$1" = 0  || %_initrddir/vprocunhide condrestart >/dev/null || :
165
166
167 %triggerin build -- fedora-release
168 function copy()
169 {
170     base=$1
171     shift
172
173     for i; do
174         test -r "$i" || continue
175
176         target=%confdir/.distributions/.common/pubkeys/$base-$(basename "$i")
177         cp -a "$i" "$target"
178     done
179 }
180 copy fedora /usr/share/doc/fedora-release-*/RPM-GPG-*
181
182
183 %preun build
184 test "$1" != 0 || rm -f %confdir/.distributions/.common/pubkeys/fedora-*
185
186
187 ## Temporary workaround to remove old v_* files; it will conflict
188 ## somehow with the -legacy package but can be fixed by reinstalling
189 ## this package.
190 ## TODO: remove me in the final .spec file
191 %define v_services      httpd named portmap sendmail smb sshd xinetd gated
192 %triggerun sysv -- util-vserver-sysv < 0.30.198
193 for i in %v_services; do
194         %chkconfig --del v_$i || :
195 done
196
197
198 %post legacy
199 %chkconfig --add rebootmgr
200 %chkconfig --add vservers-legacy
201
202 for i in %v_services; do
203         %chkconfig --add v_$i
204 done
205
206
207 %preun legacy
208 test "$1" != 0 || %_initrddir/rebootmgr   stop &>/dev/null || :
209
210 test "$1" != 0 || for i in %v_services; do
211         %chkconfig --del v_$i
212 done
213
214 test "$1" != 0 || %chkconfig --del rebootmgr
215 test "$1" != 0 || %chkconfig --del vservers-legacy
216
217 %postun legacy
218 test "$1" = 0  || %_initrddir/rebootmgr   condrestart >/dev/null || :
219
220
221 %files -f %name-base.list
222 %defattr(-,root,root,-)
223 %doc AUTHORS COPYING ChangeLog NEWS README THANKS
224 %doc doc/*.html doc/*.css
225 /sbin/vshelper
226 %dir %confdir
227 %dir %confdefaultdir
228 %dir %confdefaultdir/apps
229 %dir %confdefaultdir/files
230 %dir %pkglibdir/defaults
231 %ghost %confdefaultdir/vdirbase
232 %ghost %confdefaultdir/run.rev
233
234 %dir %_localstatedir/run/vservers
235 %dir %_localstatedir/run/vservers.rev
236 %dir %_localstatedir/run/vshelper
237
238
239 %files lib -f %name-lib.list
240 %files sysv -f %name-sysv.list
241
242
243 %files core -f %name-core.list
244 %defattr(-,root,root,-)
245 %dir %pkglibdir
246
247
248 %files build -f %name-build.list
249 %defattr(-,root,root,-)
250 %dir %confdir/.distributions
251 %dir %confdir/.distributions/*
252 %dir %confdir/.distributions/*/apt
253 %dir %confdir/.distributions/.common
254 %dir %confdir/.distributions/.common/pubkeys
255 %dir %confdefaultdir/apps/vunify
256 %dir %confdefaultdir/apps/vunify/hash
257
258
259 %files legacy -f %name-legacy.list
260 %defattr(-,root,root,-)
261 %dir %pkglibdir/legacy
262
263
264 %files devel -f %name-devel.list
265 %defattr(-,root,root,-)
266 %doc lib/apidoc/latex/refman.pdf
267 %doc lib/apidoc/html
268
269
270 %changelog
271 * Wed Jan 26 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.198-0.3
272 - updated BuildRequires:
273 - use 'setattr --barrier' instead of 'chattr +t' in the %post scriptlet
274 - moved the v_* initscripts to legacy
275 - do not ship the /vservers directory itself; as it is immutable, the
276   extraction will fail else
277
278 * Thu Sep  9 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.30.194-0
279 - documented switches for 'rpmbuild'
280
281 * Wed May 26 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.215-0
282 - (re)added the MANIFEST_* variables which were lost some time ago;
283   this will preserve %%config files...
284
285 * Mon Mar 15 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.202-0
286 - use file-list for sysv scripts also
287
288 * Sat Mar  6 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.198-0
289 - added vprocunhide-service support
290 - added doxygen support
291 - updated Requires:
292
293 * Wed Oct  1 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.23.5-0
294 - Initial build.