use build/build.common to use common build operations
[bootmanager.git] / bootmanager.spec
index ba34842..dbdcbad 100644 (file)
@@ -1,10 +1,10 @@
 %define name bootmanager
-%define version 3.1.15
+%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,8 @@ 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}
 
@@ -27,30 +29,44 @@ nodes.
 %setup -q
 
 %build
+pushd bootmanager
+
 ./build.sh
-make -C support-files
+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
-for tarball in \
-    alpina-BootLVM.tar.gz \
-    alpina-PartDisks.tar.gz \
+for file in \
+    uudecode.gz \
     PlanetLab-Bootstrap.tar.bz2 ; do
-  install -D -m 644 support-files/$tarball $RPM_BUILD_ROOT/var/www/html/boot/$tarball
+  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
@@ -61,6 +77,7 @@ EOF
 
 %files
 %defattr(-,root,root,-)
+%{_datadir}/%{name}
 /var/www/html/boot/*
 
 %changelog