Building
---------
-Rename the parent directory from pl_mom to pl_dod-0.2 (or whatever is
+Rename the parent directory from pl_mom to pl_mom-0.2 (or whatever is
the appropriate version number listed in the Makefile). Then "make
rpm" should do it.
Notes
------
-The name of the daemon is "pl_mom" but the package name is pl_dod.
-The reason is that the daemon and package were both originally called
-pl_dod. Yum (the package management tool currently in use) does
-not seem to honor the "Obsoletes:" tag in the .spec file. Therefore
-it was not possible to automatically update the old pl_dod package
-with a new one called pl_mom, and so the package kept the old name.
--- /dev/null
+%define name pl_mom
+%define version 0.2
+%define release 16.planetlab%{?date:.%{date}}
+
+Summary: PlanetLab mom -- Cleans up your mess
+Name: %{name}
+Version: %{version}
+Release: %{release}
+Copyright: dontknow
+Group: System Environment/Kernel
+Source: %{name}-%{version}.tgz
+Vendor: PlanetLab
+Packager: PlanetLab Central <support@planet-lab.org>
+Distribution: PlanetLab 2.0
+URL: http://www.planet-lab.org
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+%description
+
+A small daemon that watches the consumed swap space. At 90% utilization, it
+resets the slice that is the biggest memory hog. At 95% utilization, it
+reboots the machine.
+
+%prep
+
+%setup
+
+%build
+
+%install
+mkdir -p $RPM_BUILD_ROOT/usr/local/planetlab/bin/
+mkdir -p $RPM_BUILD_ROOT/etc/init.d/
+
+cp pl_mom $RPM_BUILD_ROOT/etc/init.d/
+cp pl_mom.pl $RPM_BUILD_ROOT/usr/local/planetlab/bin/
+
+%clean
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(0755, root, root)
+/etc/init.d/pl_mom
+/usr/local/planetlab/bin/pl_mom.pl
+
+%pre
+
+
+%post
+RUNLEVEL=`/sbin/runlevel`
+
+if [ "$1" -ge 1 ]; then
+
+ chkconfig --add pl_mom
+ chkconfig --level 3 pl_mom on
+
+ if [[ "$RUNLEVEL" != "unknown" ]]; then
+ /etc/init.d/pl_mom stop
+ /etc/init.d/pl_mom start
+ fi
+fi
+
+%preun
+RUNLEVEL=`/sbin/runlevel`
+
+if [ "$1" -eq 0 ]; then
+ if [[ "$RUNLEVEL" != "unknown" ]]; then
+ /etc/init.d/pl_mom stop
+ fi
+fi
+
+
+%postun
+
+