%define name vserver-reference %define version 3.0 %define release 1.planetlab%{?date:.%{date}} Vendor: PlanetLab Packager: PlanetLab Central Distribution: PlanetLab 3.0 URL: http://www.planet-lab.org Summary: VServer reference image Name: %{name} Version: %{version} Release: %{release} Source0: %{name}-%{version}.tar.bz2 License: GPL Group: Applications/System BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot BuildArchitectures: noarch Requires: util-vserver AutoReqProv: no BuildRequires: e2fsprogs, yum %description This package creates the virtual server (VServer) reference image used as the installation base for new PlanetLab slivers. %define vrootdir /vservers %define vrefdir %{vrootdir}/%{name} %define installroot $RPM_BUILD_ROOT%{vrefdir} %prep %setup -q # chattr, mknod, mount, yum all require root privileges. Yech. if [ $UID -ne 0 ] ; then echo You must be root to build the %{name} package. false fi %build %install # Clean up if grep -q %{installroot}/proc /proc/mounts ; then umount %{installroot}/proc fi if grep -q %{installroot}/dev/pts /proc/mounts ; then umount %{installroot}/dev/pts fi chattr -R -i $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT # Make /vservers mkdir -p $RPM_BUILD_ROOT%{vrootdir} chmod 000 $RPM_BUILD_ROOT%{vrootdir} chattr +t $RPM_BUILD_ROOT%{vrootdir} # Make /vservers/vserver-reference mkdir -p %{installroot} chattr -t %{installroot} chmod 755 %{installroot} MAKEDEV () { if grep -q %{installroot}/dev/pts /proc/mounts ; then umount %{installroot}/dev/pts fi rm -rf %{installroot}/dev mkdir -p %{installroot}/dev mknod -m 666 %{installroot}/dev/null c 1 3 mknod -m 666 %{installroot}/dev/zero c 1 5 mknod -m 666 %{installroot}/dev/full c 1 7 mknod -m 644 %{installroot}/dev/random c 1 8 mknod -m 644 %{installroot}/dev/urandom c 1 9 mknod -m 666 %{installroot}/dev/tty c 5 0 mknod -m 666 %{installroot}/dev/ptmx c 5 2 touch %{installroot}/dev/hdv1 } # Initialize /dev in reference image MAKEDEV # Mount /dev/pts in reference image mkdir -p %{installroot}/dev/pts mount -t devpts none %{installroot}/dev/pts # Mount /proc in reference image mkdir -p %{installroot}/proc mount -t proc none %{installroot}/proc # Create a dummy /etc/fstab in reference image mkdir -p %{installroot}/etc cat > %{installroot}/etc/fstab < %{installroot}/etc/rpm/macros < 3.0-1.planetlab - initial build