use build/build.common to use common build operations
[bootmanager.git] / bootmanager.spec
index 248b3f0..dbdcbad 100644 (file)
@@ -1,10 +1,10 @@
 %define name bootmanager
-%define version 3.1
-%define release 1.planetlab.planetlab%{?date:.%{date}}
+%define version 3.1.16
+%define release 1%{?pldistro:.%{pldistro}}%{?date:.%{date}}
 
 Vendor: PlanetLab
 Packager: PlanetLab Central <support@planet-lab.org>
-Distribution: PlanetLab 3.0
+Distribution: PlanetLab 4.1
 URL: http://cvs.planet-lab.org/cvs/bootmanager
 
 Summary: The PlanetLab Boot Manager
@@ -16,6 +16,11 @@ Group: System Environment/Base
 Source0: %{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 
+Requires: tar, gnupg, sharutils, bzip2
+
+AutoReqProv: no
+%define debug_package %{nil}
+
 %description
 The PlanetLab Boot Manager securely authenticates and boots PlanetLab
 nodes.
@@ -24,25 +29,44 @@ nodes.
 %setup -q
 
 %build
+pushd bootmanager
+
 ./build.sh
-make -C support-files PlanetLab-Bootstrap.tar.bz2
+pushd support-files
+./buildnode.sh -r $([ -f "/etc/fedora-release" ] && awk ' { if ($2=="Core") print $4; else print $3 } ' /etc/fedora-release || echo 4)
+popd
+
+popd
 
 %install
 rm -rf $RPM_BUILD_ROOT
+
+pushd bootmanager
+
+# Install source so that it can be rebuilt
+find build.sh source | cpio -p -d -u $RPM_BUILD_ROOT/%{_datadir}/%{name}/
+
 install -D -m 755 bootmanager.sh $RPM_BUILD_ROOT/var/www/html/boot/bootmanager.sh
-install -D -m 644 support-files/PlanetLab-Bootstrap.tar.bz2 $RPM_BUILD_ROOT/var/www/html/boot/PlanetLab-Bootstrap.tar.bz2
+for file in \
+    uudecode.gz \
+    PlanetLab-Bootstrap.tar.bz2 ; do
+  install -D -m 644 support-files/$file $RPM_BUILD_ROOT/var/www/html/boot/$file
+done
 
-# If run under sudo, allow user to delete the build directory
-if [ -n "$SUDO_USER" ] ; then
-    chown -R $SUDO_USER .
-fi
+popd
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-# If run under sudo, allow user to delete the built RPM
+# If run under sudo
 if [ -n "$SUDO_USER" ] ; then
-    chown $SUDO_USER %{_rpmdir}/%{_arch}/%{name}-%{version}-%{release}.%{_arch}.rpm
+    # Allow user to delete the build directory
+    chown -h -R $SUDO_USER .
+    # Some temporary cdroot files like /var/empty/sshd and
+    # /usr/bin/sudo get created with non-readable permissions.
+    find . -not -perm +0600 -exec chmod u+rw {} \;
+    # Allow user to delete the built RPM(s)
+    chown -h -R $SUDO_USER %{_rpmdir}/%{_arch}
 fi
 
 %post
@@ -53,8 +77,8 @@ EOF
 
 %files
 %defattr(-,root,root,-)
-/var/www/html/boot/bootmanager.sh
-/var/www/html/boot/PlanetLab-Bootstrap.tar.bz2
+%{_datadir}/%{name}
+/var/www/html/boot/*
 
 %changelog
 * Fri Sep  2 2005 Mark Huang <mlhuang@cotton.CS.Princeton.EDU> -