- check $PL_BOOTCD instead of runlevel
[mom.git] / pl_mom.spec
1 %define name pl_mom
2 %define version 0.3
3 %define release 9.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 3.0
15 URL: http://cvs.planet-lab.org/cvs/pl_mom
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 if [ "$1" -ge 1 ]; then
50
51         chkconfig --add pl_mom
52         chkconfig --level 3 pl_mom on
53
54         if [[ "$PL_BOOTCD" != "1" ]]; then
55                 /etc/init.d/pl_mom stop
56                 /etc/init.d/pl_mom start
57         fi
58 fi
59
60 %preun
61 if [ "$1" -eq 0 ]; then
62         if [[ "$PL_BOOTCD" != "1" ]]; then
63                 /etc/init.d/pl_mom stop
64         fi
65
66         chkconfig --del pl_mom
67         chkconfig pl_mom off
68 fi
69
70
71 %postun
72
73