Added vsh.
[util-vserver.git] / util-vserver.spec
1 %define name util-vserver
2 %define version 0.30
3 %define release 1.planetlab%{?date:.%{date}}
4
5 Vendor: PlanetLab
6 Packager: PlanetLab Central <support@planet-lab.org>
7 Distribution: PlanetLab 3.0
8 URL: http://www.planet-lab.org
9
10 %define __chattr        /usr/bin/chattr
11
12 Summary:        Linux virtual server utilities
13 Name:           %{name}
14 Version:        %{version}
15 Release:        %{release}
16 Epoch:          0
17 Copyright:      GPL
18 Group:          System Environment/Base
19 Source0:        http://savannah.nongnu.org/download/util-vserver/stable.pkg/%version/%name-%version.tar.bz2
20 Provides:       %name-devel = %epoch:%version-%release
21 BuildRoot:      %_tmppath/%name-%version-%release-root
22 Provides:       vserver = %epoch:%version-%release
23 Conflicts:      vserver < %epoch:%version-%release
24 Conflicts:      vserver > %epoch:%version-%release
25 BuildRequires:  e2fsprogs-devel
26 Requires(post): %__chattr
27
28 %package linuxconf
29 Summary:        Linuxconf administration modules for vservers
30 Group:          Applications/System
31 Requires:       %name = %epoch:%version-%release
32 Provides:       vserver-admin = %epoch:%version-%release
33 Conflicts:      vserver-admin < %epoch:%version-%release
34 Conflicts:      vserver-admin > %epoch:%version-%release
35
36 %description
37 This package provides the components and a framework to setup virtual
38 servers.  A virtual server runs inside a linux server. It is nevertheless
39 highly independent. As such, you can run various services with normal
40 configuration. The various vservers can't interact with each other and
41 can't interact with services in the main server.
42
43 This requires a special kernel supporting the new new_s_context and
44 set_ipv4root system call.
45
46
47 %description linuxconf
48 This package provides the components to setup virtual servers with
49 linuxconf.
50
51
52 %prep
53 %setup -q
54 aclocal -I m4
55 autoconf
56 automake --add-missing
57 # bootstrap to avoid BuildRequires of kernel-source
58 for linux in $RPM_BUILD_DIR/linux-* /lib/modules/`uname -r`/build ; do
59    [[ -d $linux/include ]] && %configure --with-kerneldir=$linux --enable-linuxconf && break
60 done
61
62
63 %build
64 make
65
66 %install
67 rm -rf $RPM_BUILD_ROOT
68 %__make DESTDIR=$RPM_BUILD_ROOT install
69
70 mkdir -p $RPM_BUILD_ROOT/vservers
71 test "%_initrddir" = %_sysconfdir/init.d || {
72         mkdir -p ${RPM_BUILD_ROOT}%_initrddir
73         mv ${RPM_BUILD_ROOT}%_sysconfdir/init.d/* ${RPM_BUILD_ROOT}%_initrddir/
74 }
75
76 %clean
77 rm -rf $RPM_BUILD_ROOT
78
79 %define services vcached vservers
80
81 %pre
82 # 1 = install, 2 = upgrade/reinstall
83 if [ $1 -eq 2 ] ; then
84     for i in %{services} ; do
85         [ "`/sbin/runlevel`" = "unknown" ] || service $i stop || :
86     done
87 fi
88
89 %post
90 # 1 = install, 2 = upgrade/reinstall
91 if [ $1 -eq 1 ] ; then
92     for i in %{services} ; do
93         chkconfig --add $i
94         chkconfig $i on
95     done
96 fi
97 for i in %{services} ; do
98     [ "`/sbin/runlevel`" = "unknown" ] || service $i start
99 done
100 if [ ! -f /etc/shells ] || ! grep -q '^/usr/sbin/vsh$' /etc/shells ; then
101     echo /usr/sbin/vsh >> /etc/shells
102 fi
103
104 %__chattr +t /vservers || :
105
106
107 %postun
108 # 0 = erase, 1 = upgrade
109 if [ "$1" = 0 ] ; then
110     perl -i -n -e 'next if /^\/usr\/sbin\/vsh$/; print' /etc/shells
111 fi
112
113 %preun
114 # 0 = erase, 1 = upgrade
115 if [ $1 -eq 0 ] ; then
116     for i in %{services} ; do
117         [ "`/sbin/runlevel`" = "unknown" ] || service $i stop || :
118         chkconfig $i off
119         chkconfig --del $i
120     done
121 fi
122
123 %files
124 %defattr(-,root,root)
125 %doc AUTHORS COPYING ChangeLog NEWS README THANKS
126 %_sbindir/*
127 %_libdir/%name
128 %_includedir/vserver.h
129 %_libdir/libvserver.a
130 %_mandir/man8/*
131 %config %_initrddir/*
132 %config(noreplace) /etc/vservers.conf
133 %config(noreplace) /etc/vcached.conf
134 %dir /etc/vservers
135 %attr(0,root,root) %dir /vservers
136 %attr(4755,root,root) /usr/sbin/vsh
137
138 %exclude %_sbindir/newvserver
139 %exclude %_mandir/man8/newvserver*
140
141 %files linuxconf
142 %defattr(-,root,root)
143 %config(noreplace) /etc/vservers/newvserver.defaults
144 %_sbindir/newvserver
145 %_mandir/man8/newvserver*
146
147 %changelog
148 * Mon Oct 11 2004 Marc E. Fiuczynski <mef@cs.princeton.edu> 0.1-1.planetlab
149 - added vsh
150
151 * Wed Aug 11 2004 Mark Huang <mlhuang@cs.princeton.edu> 0.29-1.planetlab
152 - initial PlanetLab 3.0 build.
153
154 * Thu Mar 18 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.3-0
155 - removed '%%doc doc/FAQ.txt' since file does not exist anymore
156
157 * Fri Sep 26 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.23.4-1
158 - initial build.
159