AutoReqProv: no
BuildRequires: e2fsprogs, yum
+%define debug_package %{nil}
+
%description
This package creates the virtual server (VServer) reference image used
as the installation base for new PlanetLab slivers.
%build
%install
+# Running as root
+export PATH="$PATH:/sbin:/usr/sbin"
+
# Clean up
if grep -q %{installroot}/proc /proc/mounts ; then
umount %{installroot}/proc
mkdir -p %{installroot}/etc/rpm
cat > %{installroot}/etc/rpm/macros <<EOF
%_install_langs en_US:en
+%_excludedocs 1
+%__file_context_path /dev/null
EOF
# Initialize RPM database in reference image
--installroot=%{installroot} \
-y groupinstall VServer
+# Freshen any new RPMs
+find %{_topdir}/RPMS -type f | xargs rpm --root %{installroot} -F
+
# Clean up /dev in reference image
MAKEDEV
fi
%clean
+# Running as root
+export PATH="$PATH:/sbin:/usr/sbin"
+
# Clean up
if grep -q %{installroot}/proc /proc/mounts ; then
umount %{installroot}/proc
chattr -R -i $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_ROOT
+# Make sure the original user can remove the generated files
+if [ -n "$SUDO_UID" ] ; then
+ chown -R $SUDO_UID.$SUDO_GID .
+ for i in \
+ %{_topdir}/BUILD \
+ %{_topdir}/RPMS/noarch/%{name}-%{version}-%{release}.noarch.rpm \
+ %{_topdir}/RPMS/noarch \
+ %{_topdir}/RPMS/ \
+ %{_topdir}/SRPMS/%{name}-%{version}-%{release}.src.rpm \
+ %{_topdir}/SRPMS/ ; do
+ if [ -e $i ] ; then
+ chown $SUDO_UID.$SUDO_GID $i
+ fi
+ done
+fi
+
%post
# Copy configuration files from host to reference image
for file in /etc/hosts /etc/resolv.conf /etc/yum.conf ; do