tweaks to improve the automated, rpm installation of monitor-server.
[monitor.git] / monitor-server.spec
1 #
2 # $Id$
3
4
5 %define url $URL: svn+ssh://svn.planet-lab.org/svn/Monitor/trunk/monitor-server.spec $
6
7 %define name monitor-server
8 %define version 1.0
9 %define taglevel 9
10
11 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
12 %global python_sitearch %( python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" )
13
14
15 Summary: Monitor backend scripts for server
16 Name: %{name}
17 Version: %{version}
18 Release: %{release}
19 Source0: %{name}-%{version}.tar.bz2
20 License: GPL
21 Group: Applications/System
22 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
23
24 Vendor: PlanetLab
25 Packager: PlanetLab Central <support@planet-lab.org>
26 Distribution: PlanetLab %{plrelease}
27 URL: %(echo %{url} | cut -d ' ' -f 2)
28
29 Requires: curl
30 Requires: coreutils
31 Requires: openssh-clients
32 Requires: perl-libwww-perl
33 Requires: perl-IO-Socket-SSL 
34 Requires: MySQL-python
35 Requires: rt3 == 3.4.1
36 Requires: nmap
37
38 Requires: PLCWWW >= 4.2
39 Requires: bootcd-planetlab-i386 >= 4.2
40
41 %description
42 Scripts for polling PLC, the node, and PCU status.  Also a collection of
43 command-line utilities for querying the status database. 
44
45 %prep
46 %setup -q
47
48 %build
49 # TODO: note that we should build the cmdamt/ with g++
50 cd cmdamt
51 export TMPDIR=$PWD/tmp
52 make
53 cd ..
54
55 %install
56
57 rm -rf $RPM_BUILD_ROOT
58 mkdir -p $RPM_BUILD_ROOT/usr/share/%{name}
59 mkdir -p $RPM_BUILD_ROOT/data/var/lib/%{name}
60 mkdir -p $RPM_BUILD_ROOT/data/var/lib/%{name}/archive-pdb
61 mkdir -p $RPM_BUILD_ROOT/var/lib/%{name}
62 mkdir -p $RPM_BUILD_ROOT/var/lib/%{name}/archive-pdb
63 mkdir -p $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/
64
65 echo " * Installing core scripts"
66 rsync -a --exclude www --exclude archive-pdb --exclude .svn --exclude CVS \
67           ./ $RPM_BUILD_ROOT/usr/share/%{name}/
68
69 echo " * Installing web pages"
70 rsync -a www/ $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/
71
72 echo " * Installing cron job for automated polling"
73 install -D -m 755 %{name}.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/%{name}.cron
74 echo " * TODO: Setting up Monitor account in local MyPLC"
75 # TODO: 
76
77 mkdir -p $RPM_BUILD_ROOT/%{python_sitearch}/monitor
78 install -d -D -m 755 monitor $RPM_BUILD_ROOT/%{python_sitearch}/monitor
79 # TODO: need a much better way to do this.
80 for file in __init__.py database.py config.py ; do 
81         install -D -m 644 monitor/$file $RPM_BUILD_ROOT/%{python_sitearch}/monitor/$file
82 done
83 install -D -m 755 threadpool.py $RPM_BUILD_ROOT/%{python_sitearch}/threadpool.py
84
85 touch $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
86 chmod 777 $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
87
88 install -D -m 755 monitor-default.conf $RPM_BUILD_ROOT/etc/monitor.conf
89 cp $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig-default.py $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig.py
90
91 %clean
92 rm -rf $RPM_BUILD_ROOT
93
94 %files
95 %defattr(-,root,root)
96 %config /usr/share/%{name}/monitorconfig.py
97 %config /etc/monitor.conf
98 /usr/share/%{name}
99 /var/lib/%{name}
100 /var/www/cgi-bin/monitor
101 %{_sysconfdir}/cron.d/%{name}.cron
102 %{python_sitearch}/threadpool.py
103 %{python_sitearch}/threadpool.pyc
104 %{python_sitearch}/threadpool.pyo
105 %{python_sitearch}/monitor
106
107 %post
108 echo "Post processing"
109 # TODO: this will be nice when we have a web-based service running., such as
110 #               an API server or so on.
111 # TODO: create real monitorconfig.py from monitorconfig-default.py
112 # TODO: create monitorconfig.php using phpconfig.py 
113 # TODO: create symlink in /var/lib/monitor-server for chroot environments
114 # TODO: update the content of automate_pl03.sh 
115 # TODO: Use the installed version of bootcd to create custom boot images. ( or, use the api now).
116
117 #chkconfig --add monitor-server
118 #chkconfig monitor-server on
119
120 %changelog
121 * Thu Sep 25 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-9
122 - includes all removals of 'monitorconfig'
123
124 * Wed Sep 24 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-8
125 - These are all changes in the latest Monitor code.  I will branch this version
126 - next, before making additional large changes.
127
128 * Mon Sep 01 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-1.0-7
129 - Checkpointing current version for 4.2-rc21 - many many changes
130
131 * Mon Aug 11 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-6
132 - This is a major tag of every thing.  probably needs a very different release
133 - number.
134
135 * Wed Jul 30 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-server-1.0-5
136 - initial creation of server-side package