Index: /branches/1.0/Makefile
===================================================================
--- /branches/1.0/Makefile	(revision 839)
+++ /branches/1.0/Makefile	(revision 840)
@@ -2,4 +2,5 @@
 #
 TMPDIR = /tmp
+DESTDIR = /usr/local
 
 # Clear this if you don't want to use ${FAKEROOT}
@@ -17,6 +18,6 @@
 REQUIRED = ./jobarchived ./jobmond ./web
 
-deb:	deb-jobmond deb-jobarchived deb-webfrontend
-rpm:	rpm-jobmond rpm-jobarchived rpm-webfrontend
+deb:	tarball-bzip
+rpm:	tarball-bzip
 
 all:	tarball deb rpm
@@ -24,5 +25,5 @@
 tarball:	tarball-gzip tarball-bzip
 
-tarball-gzip:	${REQUIRED}
+tarball-gzip:	${REQUIRED} rpmspec
 	mkdir -p ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}
 	( rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
@@ -31,5 +32,5 @@
 	mv ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}.tar.gz ..
 
-tarball-bzip:	${REQUIRED}
+tarball-bzip:	${REQUIRED} rpmspec
 	mkdir -p ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}
 	( rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
@@ -37,4 +38,69 @@
 	( cd ${TMPDIR}/.monarch_buildroot; tar jcvf ganglia_jobmonarch-${VERSION}.tar.bz2 ./ganglia_jobmonarch-${VERSION} )
 	mv ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}.tar.bz2 ..
+
+rpmspec: pkg/rpm/jobmonarch.spec.in
+	sed -e 's/__VERSION__/$(VERSION)/g' -e 's/__RELEASE__/$(RELEASE)/g' ./pkg/rpm/jobmonarch.spec.in > jobmonarch.spec
+
+debpkgdir: pkg/deb/debian
+	rsync -a --exclude=.svn pkg/deb/debian debian
+	sed -i -e 's/^Version:.*$//Version: $(VERSION)-$(RELEASE)/g' ./debian/control
+
+rpm: tarball-bzip
+	rpmbuild -tb ../ganglia_jobmonarch-${VERSION}.tar.bz2
+
+deb: debpkgdir
+	dpkg-buildpackage -b
+
+install:
+	# Files in SBIN_DIR
+	install -m 0755 -d $(DESTDIR)/usr/sbin
+	install -m 0755 jobmond/jobmond.py $(DESTDIR)/usr/sbin/
+	install -m 0755 jobarchived/jobarchived.py $(DESTDIR)/usr/sbin/
+	(cd $(DESTDIR)/usr/sbin/; ln -s jobmond.py jobmond; ln -s jobarchived.py jobarchived)
+	#
+	# Files specific to distros if /etc/sysconfig => rpm else (/etc/default => debian)
+	if test -d /etc/sysconfig; then \
+		install -m 0755 -d $(DESTDIR)/etc/rc.d/init.d; \
+		install -m 0755 pkg/rpm/init.d/jobmond $(DESTDIR)/etc/rc.d/init.d/; \
+		install -m 0755 pkg/rpm/init.d/jobarchived $(DESTDIR)/etc/rc.d/init.d/; \
+		install -m 0755 -d $(DESTDIR)/etc/sysconfig; \
+		install -m 0755 pkg/rpm/sysconfig/jobmond $(DESTDIR)/etc/sysconfig; \
+		install -m 0755 pkg/rpm/sysconfig/jobarchived $(DESTDIR)/etc/sysconfig; \
+	else \
+		install -m 0755 -d $(DESTDIR)/etc/init.d; \
+		install -m 0755 pkg/deb/init.d/jobmond $(DESTDIR)/etc/init.d/; \
+		install -m 0755 pkg/deb/init.d/jobarchived $(DESTDIR)/etc/init.d/; \
+		install -m 0755 -d $(DESTDIR)/etc/default; \
+		install -m 0755 pkg/deb/default/jobmond $(DESTDIR)/etc/default; \
+		install -m 0755 pkg/deb/default/jobarchived $(DESTDIR)/etc/default; \
+	fi
+	#
+	# Files in /etc
+	#
+	install -m 0644 jobmond/jobmond.conf $(DESTDIR)/etc; \
+	install -m 0644 jobarchived/jobarchived.conf $(DESTDIR)/etc; \
+	#
+	# Files in /usr/share
+	#
+	install -m 0755 -d $(DESTDIR)/usr/share/jobarchived/
+	install -m 0755 jobarchived/job_dbase.sql $(DESTDIR)/usr/share/jobarchived/
+	#
+	# Create the /var/lib/jobarchive directory where rrds are stored.
+	#
+	install -m 0755 -d $(DESTDIR)/var/lib/jobarchive/
+	#
+	# Files for ganglia (adapt to rpm or deb or unknown ganglia packaging)
+	#
+	if test -d /etc/sysconfig; then \
+		install -m 0755 -d $(DESTDIR)/usr/share/ganglia; \
+		(cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php . $(DESTDIR)/usr/share/ganglia); \
+	elif test -d /etc/default; then \
+		install -m 0755 -d $(DESTDIR)/usr/share/ganglia-webfrontend; \
+		(cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php . $(DESTDIR)/usr/share/ganglia-webfrontend); \
+	else \
+		install -m 0755 -d $(DESTDIR)/$(WEBDIR); \
+		(cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php . $(DESTDIR)/$(WEBDIR)); \
+	fi
+
 
 deb-webfrontend:	${REQUIRED}
@@ -97,75 +163,6 @@
 	mv ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}.deb ..
 
-rpm-jobmond:	${REQUIRED}
-	mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/etc/init.d >/dev/null
-	mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/etc/sysconfig >/dev/null
-	mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/usr/sbin >/dev/null
-	install -m 755 jobmond/jobmond.py ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/usr/sbin
-	( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/usr/sbin; \
-	ln -s jobmond.py jobmond || true)
-	install jobmond/jobmond.conf ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/etc
-	install pkg/rpm/init.d/jobmond ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/etc/init.d
-	install pkg/rpm/sysconfig/jobmond ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/etc/sysconfig
-	cp pkg/rpm/jobmonarch-jobmond.spec \
-	${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/jobmonarch-jobmond-${VERSION}-${RELEASE}.spec
-	( cd ${TMPDIR}/.monarch_buildroot/; \
-	cat jobmonarch-jobmond-${VERSION}-${RELEASE}/jobmonarch-jobmond-${VERSION}-${RELEASE}.spec \
-	| sed "s/^Buildroot:.*$//Buildroot: \${TMPDIR}\/\.monarch_buildroot\/jobmonarch-jobmond-${VERSION}-${RELEASE}/g" \
-	| sed "s/^Version:.*$//Version: ${VERSION}/g" \
-	| sed "s/^Release:.*$//Release: ${RELEASE}/g" \
-	>jobmonarch-jobmond-${VERSION}-${RELEASE}/jobmonarch-jobmond-${VERSION}-${RELEASE}.spec.new; \
-	mv jobmonarch-jobmond-${VERSION}-${RELEASE}/jobmonarch-jobmond-${VERSION}-${RELEASE}.spec.new \
-	jobmonarch-jobmond-${VERSION}-${RELEASE}/jobmonarch-jobmond-${VERSION}-${RELEASE}.spec )
-	( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}; \
-	${FAKEROOT} rpmbuild --buildroot=${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE} -bb jobmonarch-jobmond-${VERSION}-${RELEASE}.spec )
-	mv ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}.rpm ..
-
-rpm-jobarchived:	${REQUIRED}
-	mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/etc/init.d >/dev/null
-	mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/etc/sysconfig >/dev/null
-	mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/usr/sbin >/dev/null
-	mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/usr/share/jobarchived >/dev/null
-	install -m 755 jobarchived/jobarchived.py ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/usr/sbin
-	( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/usr/sbin; \
-	ln -s jobarchived.py jobarchived || true)
-	install jobarchived/jobarchived.conf ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/etc
-	install pkg/rpm/init.d/jobarchived ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/etc/init.d
-	install pkg/rpm/sysconfig/jobarchived ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/etc/sysconfig
-	install jobarchived/job_dbase.sql \
-	${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/usr/share/jobarchived
-	cp pkg/rpm/jobmonarch-jobarchived.spec \
-	${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/jobmonarch-jobarchived-${VERSION}-${RELEASE}.spec
-	( cd ${TMPDIR}/.monarch_buildroot/; \
-	cat jobmonarch-jobarchived-${VERSION}-${RELEASE}/jobmonarch-jobarchived-${VERSION}-${RELEASE}.spec \
-	| sed "s/^Buildroot:.*$//Buildroot: \${TMPDIR}\/\.monarch_buildroot\/jobmonarch-jobarchived-${VERSION}-${RELEASE}/g" \
-	| sed "s/^Version:.*$//Version: ${VERSION}/g" \
-	| sed "s/^Release:.*$//Release: ${RELEASE}/g" \
-	>jobmonarch-jobarchived-${VERSION}-${RELEASE}/jobmonarch-jobarchived-${VERSION}-${RELEASE}.spec.new; \
-	mv jobmonarch-jobarchived-${VERSION}-${RELEASE}/jobmonarch-jobarchived-${VERSION}-${RELEASE}.spec.new \
-	jobmonarch-jobarchived-${VERSION}-${RELEASE}/jobmonarch-jobarchived-${VERSION}-${RELEASE}.spec )
-	( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}; \
-	${FAKEROOT} rpmbuild --buildroot=${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE} -bb jobmonarch-jobarchived-${VERSION}-${RELEASE}.spec )
-	mv ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}.rpm ..
-
-rpm-webfrontend:	${REQUIRED}
-	mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend-${VERSION}-${RELEASE}/${WEBDIR} >/dev/null
-	( cd web; \
-	rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
-	. ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend-${VERSION}-${RELEASE}/${WEBDIR} )
-	cp pkg/rpm/jobmonarch-webfrontend.spec \
-	${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend-${VERSION}-${RELEASE}/jobmonarch-webfrontend-${VERSION}-${RELEASE}.spec
-	( cd ${TMPDIR}/.monarch_buildroot/; \
-	cat jobmonarch-webfrontend-${VERSION}-${RELEASE}/jobmonarch-webfrontend-${VERSION}-${RELEASE}.spec \
-	| sed "s/^Buildroot:.*$//Buildroot: \${TMPDIR}\/\.monarch_buildroot\/jobmonarch-webfrontend-${VERSION}-${RELEASE}/g" \
-	| sed "s/^Version:.*$//Version: ${VERSION}/g" \
-	| sed "s/^Release:.*$//Release: ${RELEASE}/g" \
-	| sed "s+/var/www/ganglia+${WEBDIR}+g" \
-	>jobmonarch-webfrontend-${VERSION}-${RELEASE}/jobmonarch-webfrontend-${VERSION}-${RELEASE}.spec.new; \
-	mv jobmonarch-webfrontend-${VERSION}-${RELEASE}/jobmonarch-webfrontend-${VERSION}-${RELEASE}.spec.new \
-	jobmonarch-webfrontend-${VERSION}-${RELEASE}/jobmonarch-webfrontend-${VERSION}-${RELEASE}.spec )
-	( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend-${VERSION}-${RELEASE}; \
-	${FAKEROOT} rpmbuild --buildroot ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend-${VERSION}-${RELEASE} -bb jobmonarch-webfrontend-${VERSION}-${RELEASE}.spec )
-	mv ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend-${VERSION}-${RELEASE}.rpm ..
-
-clean:	${TMPDIR}/.monarch_buildroot
+clean:
 	rm -rf ${TMPDIR}/.monarch_buildroot
+	rm -rf ./jobmonarch.spec
+	rm -rf ./debian
Index: /branches/1.0/pkg/deb/debian/changelog
===================================================================
--- /branches/1.0/pkg/deb/debian/changelog	(revision 840)
+++ /branches/1.0/pkg/deb/debian/changelog	(revision 840)
@@ -0,0 +1,5 @@
+jobmonarch (1.0-1) unstable; urgency=low
+
+  * Initial release.
+
+ -- Olivier LAHAYE <olivier.lahaye@cea.fr>  Tue, 24 Apr 2013 14:44:18 +0200
Index: /branches/1.0/pkg/deb/debian/compat
===================================================================
--- /branches/1.0/pkg/deb/debian/compat	(revision 840)
+++ /branches/1.0/pkg/deb/debian/compat	(revision 840)
@@ -0,0 +1,1 @@
+8
Index: /branches/1.0/pkg/deb/debian/control
===================================================================
--- /branches/1.0/pkg/deb/debian/control	(revision 840)
+++ /branches/1.0/pkg/deb/debian/control	(revision 840)
@@ -0,0 +1,36 @@
+Source: jobmonarch
+Section: misc
+Priority: optional
+Maintainer: Olivier LAHAYE <olivier.lahaye@cea.fr>
+Build-Depends: debhelper (>= 8.0.0)
+Standards-Version: 3.9.3
+Homepage: https://oss.trac.surfsara.nl/jobmonarch
+
+
+Package: jobmonarch-webfrontend
+Version: 1.0-1
+Architecture: all
+Essential: no
+Depends: php5, php5-gd, rrdtool
+Installed-Size: 304K
+Maintainer: Job Monarch Development team <jobmonarch-developers@lists.sourceforge.net>
+Description: Job MonArch's Web Frontend
+
+Package: jobmonarch-jobmond
+Version: 1.0-1
+Architecture: all
+Essential: no
+Depends: python, pbs-python, ganglia-monitor
+Installed-Size: 44K
+Maintainer: Job Monarch Development team <jobmonarch-developers@lists.sourceforge.net>
+Description: Job Monitoring Daemon
+
+Package: jobmonarch-jobarchived
+Version: 1.0-1
+Architecture: all
+Essential: no
+Depends: python, gmetad, rrdtool, postgresql, python-psycopg2
+Installed-Size: 76K
+Maintainer: Job Monarch Development team <jobmonarch-developers@lists.sourceforge.net>
+Description: Job Archiving Daemon
+
Index: /branches/1.0/pkg/deb/debian/docs
===================================================================
--- /branches/1.0/pkg/deb/debian/docs	(revision 840)
+++ /branches/1.0/pkg/deb/debian/docs	(revision 840)
@@ -0,0 +1,7 @@
+AUTHORS
+CHANGELOG
+INSTALL
+LICENSE
+README
+TODO
+UPGRADE
Index: /branches/1.0/pkg/deb/debian/jobmonarch-jobarchived.conffiles
===================================================================
--- /branches/1.0/pkg/deb/debian/jobmonarch-jobarchived.conffiles	(revision 840)
+++ /branches/1.0/pkg/deb/debian/jobmonarch-jobarchived.conffiles	(revision 840)
@@ -0,0 +1,1 @@
+/etc/jobarchived.conf
Index: /branches/1.0/pkg/deb/debian/jobmonarch-jobarchived.postinst
===================================================================
--- /branches/1.0/pkg/deb/debian/jobmonarch-jobarchived.postinst	(revision 840)
+++ /branches/1.0/pkg/deb/debian/jobmonarch-jobarchived.postinst	(revision 840)
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+
+if [ -x /etc/init.d/jobarchived ]
+	then
+
+		update-rc.d -f jobarchived defaults
+fi
+
+echo ""
+echo "Additional manual changes are required to setup jobarchived:"
+echo ""
+echo "1) Edit /etc/jobarchived.conf to reflect your local settings and setup:"
+echo "   - ARCHIVE_DATASOURCES and ARCHIVE_PATH"
+echo ""
+echo "2) Create a 'jobarchive' database and create jobarchived's tables:" 
+echo "   - createdb jobarchive"
+echo "   - psql -f /usr/share/jobarchived/job_dbase.sql jobarchive"
+echo ""
Index: /branches/1.0/pkg/deb/debian/jobmonarch-jobarchived.prerm
===================================================================
--- /branches/1.0/pkg/deb/debian/jobmonarch-jobarchived.prerm	(revision 840)
+++ /branches/1.0/pkg/deb/debian/jobmonarch-jobarchived.prerm	(revision 840)
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+
+/etc/init.d/jobarchived stop || true
+update-rc.d -f jobarchived remove || true
+
+exit 0
Index: /branches/1.0/pkg/deb/debian/jobmonarch-jobmond.conffiles
===================================================================
--- /branches/1.0/pkg/deb/debian/jobmonarch-jobmond.conffiles	(revision 840)
+++ /branches/1.0/pkg/deb/debian/jobmonarch-jobmond.conffiles	(revision 840)
@@ -0,0 +1,1 @@
+/etc/jobmond.conf
Index: /branches/1.0/pkg/deb/debian/jobmonarch-jobmond.postinst
===================================================================
--- /branches/1.0/pkg/deb/debian/jobmonarch-jobmond.postinst	(revision 840)
+++ /branches/1.0/pkg/deb/debian/jobmonarch-jobmond.postinst	(revision 840)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+
+if [ -x /etc/init.d/jobmond ] 
+	then
+
+		update-rc.d -f jobmond defaults
+
+fi
+
+/etc/init.d/jobmond restart
Index: /branches/1.0/pkg/deb/debian/jobmonarch-jobmond.prerm
===================================================================
--- /branches/1.0/pkg/deb/debian/jobmonarch-jobmond.prerm	(revision 840)
+++ /branches/1.0/pkg/deb/debian/jobmonarch-jobmond.prerm	(revision 840)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+
+/etc/init.d/jobmond stop || true
+update-rc.d -f jobmond remove || true
Index: /branches/1.0/pkg/deb/debian/jobmonarch-webfrontend.conffiles
===================================================================
--- /branches/1.0/pkg/deb/debian/jobmonarch-webfrontend.conffiles	(revision 840)
+++ /branches/1.0/pkg/deb/debian/jobmonarch-webfrontend.conffiles	(revision 840)
@@ -0,0 +1,1 @@
+/var/www/ganglia/addons/job_monarch/conf.php
Index: /branches/1.0/pkg/deb/debian/jobmonarch-webfrontend.postinst
===================================================================
--- /branches/1.0/pkg/deb/debian/jobmonarch-webfrontend.postinst	(revision 840)
+++ /branches/1.0/pkg/deb/debian/jobmonarch-webfrontend.postinst	(revision 840)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+echo "Make sure to set your Ganglia template to job_monarch now"
+echo "" 
+echo "In your Ganglia conf.php, set this line:"
+echo "$template_name = \"job_monarch\";"
Index: /branches/1.0/pkg/deb/debian/jobmonarch-webfrontend.postrm
===================================================================
--- /branches/1.0/pkg/deb/debian/jobmonarch-webfrontend.postrm	(revision 840)
+++ /branches/1.0/pkg/deb/debian/jobmonarch-webfrontend.postrm	(revision 840)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo "Dont forget to set your Ganglia template back to default"
Index: /branches/1.0/pkg/deb/debian/rules
===================================================================
--- /branches/1.0/pkg/deb/debian/rules	(revision 840)
+++ /branches/1.0/pkg/deb/debian/rules	(revision 840)
@@ -0,0 +1,5 @@
+#!/usr/bin/make -f
+
+%:
+	dh $@
+
Index: anches/1.0/pkg/rpm/jobmonarch-jobarchived.spec
===================================================================
--- /branches/1.0/pkg/rpm/jobmonarch-jobarchived.spec	(revision 839)
+++ 	(revision )
@@ -1,59 +1,0 @@
-Buildroot: 
-Name: jobmonarch-jobarchived
-Version: 
-Release: 
-Summary: Job Archiving Daemon
-License: GPL
-Distribution: Fedora
-Group: Applications/System
-
-%define _rpmdir ../
-%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.rpm
-%define _unpackaged_files_terminate_build 0
-
-%post
-#!/bin/sh
-
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-
-if [ -x /etc/init.d/jobarchived ]
-	then
-
-                chkconfig --add jobarchived
-		chkconfig jobarchived on
-
-fi
-
-echo ""
-echo "Additional manual changes are required to setup jobarchived:"
-echo ""
-echo "1) Edit /etc/jobarchived.conf to reflect your local settings and setup:"
-echo "   - ARCHIVE_DATASOURCES and ARCHIVE_PATH"
-echo ""
-echo "2) Create a 'jobarchive' database and create jobarchived's tables:" 
-echo "   - createdb jobarchive"
-echo "   - psql -f /usr/share/jobarchived/job_dbase.sql jobarchive"
-echo ""
-
-
-%preun
-#!/bin/sh
-
-/etc/init.d/jobarchived stop
-chkconfig jobarchived off
-chkconfig --del jobarchived
-
-
-%description
-
-
-Job MonArch's archive daemon
-
-%files
-"/usr/sbin/jobarchived.py"
-"/usr/sbin/jobarchived"
-"/etc/init.d/jobarchived"
-%config "/etc/jobarchived.conf"
-%config "/etc/sysconfig/jobarchived"
-%dir "/usr/share/jobarchived/"
-"/usr/share/jobarchived/job_dbase.sql"
Index: anches/1.0/pkg/rpm/jobmonarch-jobmond.spec
===================================================================
--- /branches/1.0/pkg/rpm/jobmonarch-jobmond.spec	(revision 839)
+++ 	(revision )
@@ -1,46 +1,0 @@
-Buildroot: 
-Name: jobmonarch-jobmond
-Version: 
-Release: 
-Summary: Job Monitoring Daemon
-License: GPL
-Distribution: Fedora
-Group: Applications/System
-
-%define _rpmdir ../
-%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.rpm
-%define _unpackaged_files_terminate_build 0
-
-%post
-#!/bin/sh
-
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-
-if [ -x /etc/init.d/jobmond ]
-	then
-
-		chkconfig --add jobmond
-		chkconfig jobmond on
-		/etc/init.d/jobmond restart
-
-fi
-
-%preun
-#!/bin/sh
-
-/etc/init.d/jobmond stop
-chkconfig jobmond off
-chkconfig --del jobmond
-
-
-%description
-
-
-Job MonArch's monitoring daemon.
-
-%files
-"/etc/init.d/jobmond"
-%config "/etc/sysconfig/jobmond"
-"/usr/sbin/jobmond.py"
-"/usr/sbin/jobmond"
-%config "/etc/jobmond.conf"
Index: anches/1.0/pkg/rpm/jobmonarch-webfrontend.spec
===================================================================
--- /branches/1.0/pkg/rpm/jobmonarch-webfrontend.spec	(revision 839)
+++ 	(revision )
@@ -1,203 +1,0 @@
-Buildroot: 
-Name: jobmonarch-webfrontend
-Version: 
-Release: 
-Summary: Job MonArch Web Frontend
-License: GPL
-Distribution: Fedora
-Group: Applications/Internet
-
-%define _rpmdir ../
-%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.rpm
-%define _unpackaged_files_terminate_build 0
-
-%post
-#!/bin/sh
-
-echo "Make sure to set your Ganglia template to job_monarch now"
-echo "" 
-echo "In your Ganglia conf.php, set this line:"
-echo "$template_name = \"job_monarch\";"
-
-
-%postun
-#!/bin/sh
-
-echo "Dont forget to set your Ganglia template back to default"
-
-
-%description
-
-
-Job Monarch's web frontend.
-
-%files
-%dir "/var/www/ganglia/templates/job_monarch/"
-%dir "/var/www/ganglia/templates/job_monarch/images/"
-"/var/www/ganglia/templates/job_monarch/cluster_extra.tpl"
-"/var/www/ganglia/templates/job_monarch/host_extra.tpl"
-"/var/www/ganglia/templates/job_monarch/images/logo.jpg"
-%dir "/var/www/ganglia/addons/"
-%dir "/var/www/ganglia/addons/job_monarch/"
-%dir "/var/www/ganglia/addons/job_monarch/clusterconf/"
-"/var/www/ganglia/addons/job_monarch/clusterconf/example.php"
-%dir "/var/www/ganglia/addons/job_monarch/templates/"
-"/var/www/ganglia/addons/job_monarch/templates/search.tpl"
-"/var/www/ganglia/addons/job_monarch/templates/overview.tpl"
-"/var/www/ganglia/addons/job_monarch/templates/host_view.tpl"
-"/var/www/ganglia/addons/job_monarch/templates/header.tpl"
-"/var/www/ganglia/addons/job_monarch/templates/footer.tpl"
-%config "/var/www/ganglia/addons/job_monarch/conf.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/plugins"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/processors"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/processors/pre.smarty_compat.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/filters"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/filters/html_format.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/math.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/fetch.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/upper.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/spacify.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/count_sentences.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/dump.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/wordwrap.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/count_words.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/cat.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/extends.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/reverse.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/replace.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/string_format.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/return.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/nl2br.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/eol.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/indent.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/tif.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/include.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/default.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/assign.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/truncate.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/date_format.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/eval.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/isset.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/lower.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/whitespace.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/load_templates.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/cycle.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/escape.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/count_paragraphs.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/regex_replace.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/extendsCheck.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/safe.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/counter.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/strip_tags.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/optional.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/mailto.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/capitalize.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/functions/count_characters.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/block.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/textformat.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/if.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/forelse.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/smartyinterface.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/strip.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/capture.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/section.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/topLevelBlock.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/elseif.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/foreach.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/loop.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/with.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/template.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/a.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/foreachelse.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/dynamic.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/withelse.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/for.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/else.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/blocks/auto_escape.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/plugins/builtin/helper.array.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/cache"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Smarty"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Smarty/Adapter.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/ICompilable"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/ICompilable/Block.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Block"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Block/Plugin.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/Agavi"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/Agavi/dwoo_plugins"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/Agavi/dwoo_plugins/url.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/Agavi/dwoo_plugins/t.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/Agavi/DwooRenderer.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/Agavi/README"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CakePHP"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CakePHP/README"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CakePHP/dwoo.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/config"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/config/dwootemplate.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/controllers"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/controllers/dwoowelcome.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/libraries"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/libraries/Dwootemplate.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/views"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/views/dwoowelcome.tpl"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/views/page.tpl"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/README"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/ZendFramework"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/ZendFramework/View.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/ZendFramework/PluginProxy.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/ZendFramework/README"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Adapters/ZendFramework/Dwoo.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Security"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Security/Exception.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Security/Policy.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Template"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Template/File.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Template/String.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Compilation"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Compilation/Exception.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/IDataProvider.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Plugin.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Exception.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Loader.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Data.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/IPluginProxy.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Compiler.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Processor.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/ILoader.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/ICompilable.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/ICompiler.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/ITemplate.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/IElseable.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Filter.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo/Core.php"
-%dir "/var/www/ganglia/addons/job_monarch/dwoo/compiled"
-"/var/www/ganglia/addons/job_monarch/dwoo/dwooAutoload.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo.compiled.php"
-"/var/www/ganglia/addons/job_monarch/dwoo/Dwoo.php"
-"/var/www/ganglia/addons/job_monarch/prev.gif"
-"/var/www/ganglia/addons/job_monarch/next.gif"
-"/var/www/ganglia/addons/job_monarch/footer.php"
-"/var/www/ganglia/addons/job_monarch/jobmonarch.gif"
-"/var/www/ganglia/addons/job_monarch/graph.php"
-"/var/www/ganglia/addons/job_monarch/ts_validatetime.js"
-"/var/www/ganglia/addons/job_monarch/logo_ned.gif"
-"/var/www/ganglia/addons/job_monarch/search.php"
-"/var/www/ganglia/addons/job_monarch/ajax-loader.gif"
-"/var/www/ganglia/addons/job_monarch/overview.php"
-"/var/www/ganglia/addons/job_monarch/libtoga.js"
-"/var/www/ganglia/addons/job_monarch/host_view.php"
-"/var/www/ganglia/addons/job_monarch/index.php"
-"/var/www/ganglia/addons/job_monarch/document_archive.jpg"
-"/var/www/ganglia/addons/job_monarch/ts_picker.js"
-"/var/www/ganglia/addons/job_monarch/cal.gif"
-"/var/www/ganglia/addons/job_monarch/redcross.jpg"
-"/var/www/ganglia/addons/job_monarch/libtoga.php"
-"/var/www/ganglia/addons/job_monarch/image.php"
-"/var/www/ganglia/addons/job_monarch/styles.css"
-"/var/www/ganglia/addons/job_monarch/version.php"
Index: /branches/1.0/pkg/rpm/jobmonarch.spec.in
===================================================================
--- /branches/1.0/pkg/rpm/jobmonarch.spec.in	(revision 840)
+++ /branches/1.0/pkg/rpm/jobmonarch.spec.in	(revision 840)
@@ -0,0 +1,417 @@
+# Don't need debuginfo RPM
+%define debug_package %{nil}
+%define __check_files %{nil}
+
+%define gangliaroot        %{_datadir}/ganglia
+%define gangliatemplatedir %{gangliaroot}/templates
+%define gangliaaddonsdir   %{gangliaroot}/addons
+
+Summary: Tools and addons to Ganglia to monitor and archive batch job info
+Name: jobmonarch
+Version: __VERSION__
+URL: https://oss.trac.surfsara.nl/jobmonarch
+Release: __RELEASE__%{?dist}
+License: GPL
+Packager: Olivier Lahaye <olivier.lahaye@cea.fr>
+Group: Applications/Base
+Source: ganglia_jobmonarch-%{version}.tar.bz2
+BuildArch: noarch
+BuildRoot: %{_tmppath}/%{name}
+Requires: jobmonarch-jobarchived jobmonarch-jobmond jobmonarch-webfrontend
+
+# Following requires were moved to the config.xml file in order to keep the
+# RPM distro-independent
+#Requires: mysql-client python-mysql
+#%if %suse_version
+#Requires: php5-gd >= 2.0 php5-mbstring
+#%else
+#Requires: php-gd >= 2.0 php-mbstring
+#%endif
+#AutoReqProv: no
+
+%description
+Job Monarch is a set of tools to monitor and optionally archive (batch)job
+information. It is a addon for the Ganglia monitoring system and plugs into an
+existing Ganglia setup. jobmond is the job monitoring daemon that gathers
+PBS/Torque/SGE batch statistics on jobs/nodes and submits them into Ganglia's
+XML stream. jobarchived is the Job Archiving Daemon. It listens to Ganglia's
+XML stream and archives the job and node statistics. It stores the job
+statistics in a Postgres SQL database and the node statistics in RRD
+files. Through this daemon, users are able to lookup a old/finished job and
+view all it's statistics. The Job Monarch web frontend interfaces with the
+jobmond data and (optionally) the jobarchived and presents the data and
+graphs. It does this in a similar layout/setup as Ganglia itself, so the
+navigation and usage is intuitive.
+
+This package is the meta package that for installation of all jobmonarche components:
+(jobmonarch-jobarchived - jobmonarch-jobmond - jobmonarch-webfrontend)
+
+
+%package -n jobmonarch-jobarchived
+Summary: jobarchived is the archiving daemon for jobmonarch.
+Requires: postgresql >= 8.1.22
+Requires: postgresql-server >= 8.1.22
+Requires: python >= 2.5
+Requires: python-rrdtool
+Requires: python-psycopg2
+
+%description -n jobmonarch-jobarchived
+jobmonach-jobarchived is the Job Archiving Daemon. It listens to Ganglia's
+XML stream and archives the job and node statistics. It stores the job
+statistics in a Postgres SQL database and the node statistics in RRD
+files. Through this daemon, users are able to lookup a old/finished job and
+view all it's statistics.
+
+%package -n jobmonarch-jobmond
+Summary: jobmond is the job monitoring daemon for jobmonarch.
+Requires: python >= 2.5
+Requires: pbs_python
+# Requires: lsf_python
+
+%description -n jobmonarch-jobmond
+jobmonarch-jobmond is the job monitoring daemon that gathers PBS/Torque/SGE
+batch statistics on jobs/nodes and submits them into Ganglia's XML stream.
+
+%package -n jobmonarch-webfrontend
+Summary: webfrontend is the ganglia webfrontend for jobmonarch.
+Requires: ganglia-gmetad >= 3.5.0 ganglia-web >= 3.5.7
+Requires: jobmonarch-jobmond = 1.0
+
+%description -n jobmonarch-webfrontend
+ The Job Monarch web frontend interfaces with the
+jobmond data and (optionally) the jobarchived and presents the data and
+graphs. It does this in a similar layout/setup as Ganglia itself, so the
+navigation and usage is intuitive.
+
+%prep
+%setup -q -n ganglia_jobmonarch-%{version}
+
+%build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+# Set the correct GANGLIA_PATH.
+sed -i -e 's|/var/www/ganglia/|%{gangliaroot}/|g' web/addons/job_monarch/conf.php
+
+# Fix rrdtool web link in footer:
+sed -i -e 's|http:/www.rrdtool.com/|http:/oss.oetiker.ch/rrdtool/|g' ./web/addons/job_monarch/templates/footer.tpl
+
+%__make install DESTDIR=$RPM_BUILD_ROOT
+
+# Create the directory structure.
+#install -m 0755 -d $RPM_BUILD_ROOT/%{_sbindir}
+#install -m 0755 -d $RPM_BUILD_ROOT%{_initrddir}
+#install -m 0755 -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
+#install -m 0755 -d $RPM_BUILD_ROOT%{gangliatemplatedir}
+#install -m 0755 -d $RPM_BUILD_ROOT%{gangliaaddonsdir}
+#install -m 0755 -d $RPM_BUILD_ROOT%{_datadir}/jobarchived/
+#install -m 0755 -d $RPM_BUILD_ROOT%{_sharedstatedir}/jobarchived/
+
+# Install jobmond files
+#install -m 0644 jobmond/jobmond.conf $RPM_BUILD_ROOT%{_sysconfdir}/
+#install -m 0755 jobmond/jobmond.py $RPM_BUILD_ROOT/%{_sbindir}/
+#install -m 0755 pkg/rpm/init.d/jobmond $RPM_BUILD_ROOT%{_initrddir}/
+#install -m 0755 pkg/rpm/sysconfig/jobmond $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/
+#(cd $RPM_BUILD_ROOT/%{_sbindir}/; ln -s jobmond.py jobmond)
+
+# Install jobarchived files
+#install -m 0644 jobarchived/jobarchived.conf $RPM_BUILD_ROOT%{_sysconfdir}/
+#install -m 0755 jobarchived/jobarchived.py $RPM_BUILD_ROOT/%{_sbindir}/
+#install -m 0755 pkg/rpm/init.d/jobarchived $RPM_BUILD_ROOT%{_initrddir}/
+#install -m 0755 pkg/rpm/sysconfig/jobarchived $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/
+#install -m 0755 jobarchived/job_dbase.sql $RPM_BUILD_ROOT%{_datadir}/jobarchived/
+#(cd $RPM_BUILD_ROOT/%{_sbindir}/; ln -s jobarchived.py jobarchived)
+
+# Install gangliaweb interface
+#cp %{gangliatemplatedir}/default/images/logo.jpg web/templates/job_monarch/images
+#cp -r web/templates/job_monarch $RPM_BUILD_ROOT%{gangliatemplatedir}/job_monarch
+#cp -r web/addons/job_monarch $RPM_BUILD_ROOT%{gangliaaddonsdir}/job_monarch
+
+%clean
+%__rm -rf $RPM_BUILD_ROOT
+
+%post -n jobmonarch-jobmond
+if [ -x /sbin/chkconfig ]; then
+    /sbin/chkconfig --add jobmond
+fi
+
+%post -n jobmonarch-jobarchived
+if [ -x /sbin/chkconfig ]; then
+    if [ ! -d /var/lib/pgsql/data/base ]; then
+        /sbin/service postgresql initdb
+    fi
+    /sbin/service postgresql start
+    su -l postgres -c "/usr/bin/createdb jobarchive"
+    su -l postgres -c "/usr/bin/psql -f /usr/share/jobarchived/job_dbase.sql jobarchive"
+    /sbin/chkconfig --add jobarchived
+fi
+
+%post -n jobmonarch-webfrontend
+echo "Make sure to set your Ganglia template to job_monarch now"
+echo ""
+echo "In your Ganglia conf.php, set this line:"
+echo "\$template_name = \"job_monarch\";"
+
+%preun -n jobmonarch-jobmond
+if [ "$1" = 0 ]; then
+    if [ -x /sbin/chkconfig ]; then
+	/sbin/service jobmond stop
+	/sbin/chkconfig --del jobmond
+    fi
+fi
+
+%preun -n jobmonarch-jobarchived
+if [ "$1" = 0 ]; then
+    if [ -x /sbin/chkconfig ]; then
+	/sbin/service jobarchived stop
+	/sbin/chkconfig --del jobarchived
+    fi
+fi
+
+%preun -n jobmonarch-webfrontend
+if [ "$1" = 0 ]; then
+    echo "Make sure to set your Ganglia template to previous config now"
+    echo ""
+    echo "In your Ganglia conf.php, remove this line:"
+    echo "\$template_name = \"job_monarch\";"
+fi
+
+%files
+%doc AUTHORS CHANGELOG INSTALL LICENSE README TODO UPGRADE
+
+%files -n jobmonarch-jobmond
+%doc jobmond/examples
+%config %{_sysconfdir}/jobmond.conf
+%{_sysconfdir}/sysconfig/jobmond
+%{_initrddir}/jobmond
+%{_sbindir}/jobmond.py
+%{_sbindir}/jobmond
+
+%files -n jobmonarch-jobarchived
+%doc jobarchived/examples
+%config %{_sysconfdir}/jobarchived.conf
+%{_sysconfdir}/sysconfig/jobarchived
+%{_initrddir}/jobarchived
+%dir %{_datadir}/jobarchived
+%{_sbindir}/jobarchived.py
+%{_sbindir}/jobarchived
+%{_datadir}/jobarchived/*
+%dir %{_sharedstatedir}/jobarchive
+
+%files -n jobmonarch-webfrontend
+%dir %{gangliatemplatedir}/job_monarch
+%dir %{gangliaaddonsdir}/job_monarch
+%{gangliatemplatedir}/job_monarch/cluster_extra.tpl
+%{gangliatemplatedir}/job_monarch/host_extra.tpl
+%dir %{gangliatemplatedir}/job_monarch/images
+%{gangliatemplatedir}/job_monarch/images/logo.jpg
+%config %{gangliaaddonsdir}/job_monarch/conf.php
+%{gangliaaddonsdir}/job_monarch/ajax-loader.gif
+%{gangliaaddonsdir}/job_monarch/cal.gif
+%{gangliaaddonsdir}/job_monarch/clusterconf
+%{gangliaaddonsdir}/job_monarch/document_archive.jpg
+%dir %{gangliaaddonsdir}/job_monarch/dwoo
+%{gangliaaddonsdir}/job_monarch/dwoo/dwooAutoload.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/plugins
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/filters
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/filters/html_format.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/helper.array.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/processors
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/processors/pre.smarty_compat.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/forelse.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/capture.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/if.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/elseif.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/block.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/smartyinterface.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/foreachelse.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/loop.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/textformat.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/template.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/withelse.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/with.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/strip.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/for.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/a.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/dynamic.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/else.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/topLevelBlock.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/auto_escape.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/section.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/blocks/foreach.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/cat.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/fetch.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/extendsCheck.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/count_characters.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/regex_replace.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/truncate.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/escape.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/safe.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/replace.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/return.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/math.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/isset.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/strip_tags.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/capitalize.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/dump.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/cycle.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/upper.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/eval.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/mailto.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/counter.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/spacify.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/default.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/optional.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/include.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/eol.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/reverse.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/lower.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/extends.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/wordwrap.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/load_templates.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/count_paragraphs.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/indent.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/assign.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/count_sentences.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/tif.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/nl2br.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/string_format.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/whitespace.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/count_words.php
+%{gangliaaddonsdir}/job_monarch/dwoo/plugins/builtin/functions/date_format.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/compiled
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/cache
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/IPluginProxy.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Filter.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Compiler.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Compilation
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Compilation/Exception.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Template
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Template/String.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Template/File.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/IDataProvider.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/ICompilable.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Block
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Block/Plugin.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/ICompiler.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/ICompilable
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/ICompilable/Block.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Processor.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Smarty
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Smarty/Adapter.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Exception.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Plugin.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Core.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/ILoader.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Data.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Security
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Security/Policy.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Security/Exception.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/IElseable.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/ITemplate.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Loader.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/ZendFramework
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/ZendFramework/README
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/ZendFramework/PluginProxy.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/ZendFramework/View.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/ZendFramework/Dwoo.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/views
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/views/dwoowelcome.tpl
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/views/page.tpl
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/controllers
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/controllers/dwoowelcome.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/libraries
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/libraries/Dwootemplate.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/README
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/config
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CodeIgniter/config/dwootemplate.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CakePHP
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CakePHP/README
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/CakePHP/dwoo.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/Agavi
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/Agavi/README
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/Agavi/DwooRenderer.php
+%dir %{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/Agavi/dwoo_plugins
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/Agavi/dwoo_plugins/t.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo/Adapters/Agavi/dwoo_plugins/url.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo.compiled.php
+%{gangliaaddonsdir}/job_monarch/dwoo/Dwoo.php
+%{gangliaaddonsdir}/job_monarch/footer.php
+%{gangliaaddonsdir}/job_monarch/graph.php
+%{gangliaaddonsdir}/job_monarch/host_view.php
+%{gangliaaddonsdir}/job_monarch/image.php
+%{gangliaaddonsdir}/job_monarch/index.php
+%{gangliaaddonsdir}/job_monarch/jobmonarch.gif
+%{gangliaaddonsdir}/job_monarch/libtoga.js
+%{gangliaaddonsdir}/job_monarch/libtoga.php
+%{gangliaaddonsdir}/job_monarch/logo_ned.gif
+%{gangliaaddonsdir}/job_monarch/next.gif
+%{gangliaaddonsdir}/job_monarch/overview.php
+%{gangliaaddonsdir}/job_monarch/prev.gif
+%{gangliaaddonsdir}/job_monarch/redcross.jpg
+%{gangliaaddonsdir}/job_monarch/search.php
+%{gangliaaddonsdir}/job_monarch/styles.css
+%dir %{gangliaaddonsdir}/job_monarch/templates
+%{gangliaaddonsdir}/job_monarch/templates/footer.tpl
+%{gangliaaddonsdir}/job_monarch/templates/header.tpl
+%{gangliaaddonsdir}/job_monarch/templates/host_view.tpl
+%{gangliaaddonsdir}/job_monarch/templates/overview.tpl
+%{gangliaaddonsdir}/job_monarch/templates/search.tpl
+%{gangliaaddonsdir}/job_monarch/ts_picker.js
+%{gangliaaddonsdir}/job_monarch/ts_validatetime.js
+%{gangliaaddonsdir}/job_monarch/version.php
+
+
+%changelog
+* Wed Apr 24 2013 Olivier Lahaye <olivier.lahaye@free.fr> 1.0-3
+- Use make install to install the files
+- Fix the correct gangliaroot path
+- Fix the correct jobarchive rrd file path.
+
+* Tue Apr 23 2013 Olivier Lahaye <olivier.lahaye@free.fr> 1.0-2
+- Package missing files (/etc/sysconfig/{job{mond,archived}} and /etc/init.d scripts)
+- Fix Requires:
+  - Added missing python-psycopg2 require in jobarchived
+  - Removed pyPgSQL require (replaced by psycopg2)
+  - Removed useless requires: pbs_python from jobarchived
+  - Removed useless requires: python-rrdtools from jobmond
+
+* Mon Apr 22 2013 Olivier Lahaye <olivier.lahaye@free.fr> 1.0-1
+- Major rewrite of the spec file (sub packages)
+- Final upstream release.
+
+* Wed Mar 13 2013 Olivier Lahaye <olivier.lahaye1@free.fr> 0.4-0.4
+- Added Requires: pbs_python
+
+* Mon Mar  4 2013 Olivier Lahaye <olivier.lahaye1@free.fr> 0.4-0.3
+- Added Requires: pyPgSQL python-rrdtool
+- Fixed postinstall (Postgress initdb if required)
+- Fixed gangliaaddonsdir
+- Add %dir in file sections for gangliaaddonsdir and gangliatemplatedir
+  so rpm -qf know those dirs belong to jobmonarch package.
+- Fix web/addons/job_monarch/conf.php (GANGLIA_PATH and JOB_ARCHIVE_DIR)
+- Fix default gmond.conf path (/etc/ganglia/gmond.conf)
+- Mark %{_sharedstatedir}/jobarchived directory as part of the package
+- Fix rrdtool web URL in footer
+- Fix VERSION (it is a 0.4-pre, not a 0.3.1)
+- Patch from Daems Dirk: new pbs_python with arrays
+- Patch from Jeffrey J. Zahari: jobs attributes retrieval
+
+* Fri May 11 2012 Olivier Lahaye <olivier.lahaye1@free.fr> 0.4-0.2
+- Update to support EPEL/RF ganglia rpm.
+- Using 0.4 prerelease as there is an important bugfix over 0.3.1
+- Use macros
+
+* Fri Jul 29 2011 Olivier Lahaye <olivier.lahaye1@free.fr> 0.4-0.1
+- Update to V0.4SVN
+
+* Sun Aug 12 2006 Babu Sundaram <babu@cs.uh.edu> 0.3.1-1
+- Prepare first rpm for Job Monarch's jobmond Daemon
+
