Minor changes for PlanetLab V3
[mom.git] / pl_mom.spec
1 %define name pl_mom
2 %define version 0.2
3 %define release 16.planetlab%{?date:.%{date}}
4  
5 Summary: PlanetLab mom -- Cleans up your mess
6 Name: %{name}
7 Version: %{version}
8 Release: %{release}
9 Copyright: dontknow
10 Group: System Environment/Kernel
11 Source: %{name}-%{version}.tgz
12 Vendor: PlanetLab
13 Packager: PlanetLab Central <support@planet-lab.org>
14 Distribution: PlanetLab 2.0
15 URL: http://www.planet-lab.org
16 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
17  
18 %description
19
20 A small daemon that watches the consumed swap space.  At 90% utilization, it
21 resets the slice that is the biggest memory hog.  At 95% utilization, it 
22 reboots the machine.
23
24 %prep
25
26 %setup
27
28 %build
29
30 %install
31 mkdir -p $RPM_BUILD_ROOT/usr/local/planetlab/bin/
32 mkdir -p $RPM_BUILD_ROOT/etc/init.d/
33
34 cp pl_mom $RPM_BUILD_ROOT/etc/init.d/
35 cp pl_mom.pl $RPM_BUILD_ROOT/usr/local/planetlab/bin/
36
37 %clean
38 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
39
40 %files
41 %defattr(0755, root, root)
42 /etc/init.d/pl_mom
43 /usr/local/planetlab/bin/pl_mom.pl
44
45 %pre
46
47
48 %post 
49 RUNLEVEL=`/sbin/runlevel`
50
51 if [ "$1" -ge 1 ]; then
52
53         chkconfig --add pl_mom
54         chkconfig --level 3 pl_mom on
55
56         if [[ "$RUNLEVEL" != "unknown" ]]; then
57                 /etc/init.d/pl_mom stop
58                 /etc/init.d/pl_mom start
59         fi
60 fi
61
62 %preun
63 RUNLEVEL=`/sbin/runlevel`
64
65 if [ "$1" -eq 0 ]; then
66         if [[ "$RUNLEVEL" != "unknown" ]]; then
67                 /etc/init.d/pl_mom stop
68         fi
69 fi
70
71
72 %postun
73
74