$%^!*& rpm #&!^*
[util-vserver.git] / util-vserver.spec
index dfb7941..3518824 100644 (file)
@@ -1,13 +1,21 @@
+%define name util-vserver
+%define version 0.30
+%define release 1.planetlab%{?date:.%{date}}
+
+Vendor: PlanetLab
+Packager: PlanetLab Central <support@planet-lab.org>
+Distribution: PlanetLab 3.0
+URL: http://www.planet-lab.org
+
 %define __chattr       /usr/bin/chattr
 
 Summary:       Linux virtual server utilities
-Name:          util-vserver
-Version:       0.30
-Release:       0
+Name:          %{name}
+Version:       %{version}
+Release:       %{release}
 Epoch:         0
 Copyright:     GPL
 Group:         System Environment/Base
-URL:           http://savannah.nongnu.org/projects/util-vserver/
 Source0:       http://savannah.nongnu.org/download/util-vserver/stable.pkg/%version/%name-%version.tar.bz2
 Provides:      %name-devel = %epoch:%version-%release
 BuildRoot:     %_tmppath/%name-%version-%release-root
@@ -43,12 +51,17 @@ linuxconf.
 
 %prep
 %setup -q
+aclocal -I m4
+autoconf
+automake --add-missing
+# bootstrap to avoid BuildRequires of kernel-source
+for linux in $RPM_BUILD_DIR/linux-* /lib/modules/`uname -r`/build ; do
+   [[ -d $linux/include ]] && %configure --with-kerneldir=$linux --enable-linuxconf && break
+done
 
 
 %build
-%configure --enable-linuxconf
-%__make %{?_smp_mflags}
-
+make
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -60,36 +73,55 @@ test "%_initrddir" = %_sysconfdir/init.d || {
        mv ${RPM_BUILD_ROOT}%_sysconfdir/init.d/* ${RPM_BUILD_ROOT}%_initrddir/
 }
 
+mkdir -p ${RPM_BUILD_ROOT}/bin
+ln -f ${RPM_BUILD_ROOT}%_sbindir/vsh ${RPM_BUILD_ROOT}/bin/vsh
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%define services vcached vservers
 
-%define v_services     httpd named portmap sendmail smb sshd xinetd
-%post
-/sbin/chkconfig --add vservers
-/sbin/chkconfig --add rebootmgr
+%pre
+# 1 = install, 2 = upgrade/reinstall
+if [ $1 -eq 2 ] ; then
+    for i in %{services} ; do
+       [ "`/sbin/runlevel`" = "unknown" ] || service $i stop || :
+    done
+fi
 
-for i in %v_services; do
-       /sbin/chkconfig --add v_$i
+%post
+# 1 = install, 2 = upgrade/reinstall
+if [ $1 -eq 1 ] ; then
+    for i in %{services} ; do
+       chkconfig --add $i
+       chkconfig $i on
+    done
+fi
+for i in %{services} ; do
+    [ "`/sbin/runlevel`" = "unknown" ] || service $i start
 done
+if [ ! -f /etc/shells ] || ! grep -q '^/bin/vsh$' /etc/shells ; then
+    echo /bin/vsh >> /etc/shells
+fi
 
 %__chattr +t /vservers || :
 
 
-%preun
-test "$1" != 0 || for i in %v_services; do
-       /sbin/chkconfig --del v_$i
-done
-
-test "$1" != 0 || %{_initrddir}/rebootmgr stop &>/dev/null || :
-test "$1" != 0 || /sbin/chkconfig --del rebootmgr
-test "$1" != 0 || /sbin/chkconfig --del vservers
-
-
 %postun
-test "$1" = 0  || %{_initrddir}/rebootmgr condrestart >/dev/null || :
+# 0 = erase, 1 = upgrade
+if [ "$1" = 0 ] ; then
+    perl -i -n -e 'next if /^\/bin\/vsh$/; print' /etc/shells
+fi
 
+%preun
+# 0 = erase, 1 = upgrade
+if [ $1 -eq 0 ] ; then
+    for i in %{services} ; do
+       [ "`/sbin/runlevel`" = "unknown" ] || service $i stop || :
+       chkconfig $i off
+       chkconfig --del $i
+    done
+fi
 
 %files
 %defattr(-,root,root)
@@ -101,22 +133,31 @@ test "$1" = 0  || %{_initrddir}/rebootmgr condrestart >/dev/null || :
 %_mandir/man8/*
 %config %_initrddir/*
 %config(noreplace) /etc/vservers.conf
+%config(noreplace) /etc/vcached.conf
+%dir /etc/vservers
 %attr(0,root,root) %dir /vservers
+%attr(4755,root,root) /usr/sbin/vsh
+%attr(4755,root,root) /bin/vsh
 
 %exclude %_sbindir/newvserver
 %exclude %_mandir/man8/newvserver*
 
-
 %files linuxconf
 %defattr(-,root,root)
 %config(noreplace) /etc/vservers/newvserver.defaults
 %_sbindir/newvserver
 %_mandir/man8/newvserver*
 
-
 %changelog
+* Mon Oct 11 2004 Marc E. Fiuczynski <mef@cs.princeton.edu> 0.1-1.planetlab
+- added vsh
+
+* Wed Aug 11 2004 Mark Huang <mlhuang@cs.princeton.edu> 0.29-1.planetlab
+- initial PlanetLab 3.0 build.
+
 * Thu Mar 18 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.29.3-0
 - removed '%%doc doc/FAQ.txt' since file does not exist anymore
 
 * Fri Sep 26 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.23.4-1
 - initial build.
+