summaryrefslogtreecommitdiff
path: root/netmrg.spec
blob: 642ae4d6fddf3a557157cf8f88ff55f7a7d24e05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
%define		snap	050727
Summary:	Network Monitoring package using PHP, MySQL, and RRDtool
Summary(pl):	Monitor sieci używający PHP, MySQL i RRDtool
Name:		netmrg
Version:	0.18.2
Release:	1.%{snap}.2
License:	MIT
Group:		Applications/Networking
#Source0:	http://www.netmrg.net/download/release/%{name}-%{version}.tar.gz
Source0:	http://mieszkancy.ds.pg.gda.pl/~luzik/%{name}-%{snap}.tar.gz
# Source0-md5:	e4baf3664aad402d6116fd3863a7d856
Source1:	%{name}-httpd.conf
Source2:	%{name}-cron
Patch0:		%{name}-config.patch
URL:		http://www.netmrg.net/
BuildRequires:	mysql-devel
BuildRequires:	libxml2-devel
BuildRequires:	rrdtool-devel >= 1.2.10
BuildRequires:	net-snmp-devel
PreReq:		webserver
Requires:	libxml2
Requires:	rrdtool >= 1.2.10
Requires:	php-mysql
BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)

%define		_pkglibdir		/var/lib/%{name}
%define		_wwwuser		http
%define		_wwwgroup		http
%define		_wwwrootdir		%{_datadir}/%{name}/webfiles

%description
NetMRG is a tool for network monitoring, reporting, and graphing.
Based on RRDTOOL, the best of open source graphing systems, NetMRG is
capable of creating graphs of any parameter of your network.

%description -l pl
NetMRG służy do monitorowania sieci, raportowania i kreślenia
wykresów. Jest on oparty na RRDTOOL, najlepszym spośród systemów
graficznych o dostępnym kodzie źródłowym. NetMRG potrafi tworzyć
wykresy przedstawiające dowolne parametry sieci.

%prep
%setup -q -n %{name}
%patch0 -p1

%build
%configure
%{__make}

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{_wwwrootdir}

%{__make} install DESTDIR=$RPM_BUILD_ROOT

install -D %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/%{name}.conf
install -D %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name}
mv -f $RPM_BUILD_ROOT/var/www/%{name} $RPM_BUILD_ROOT%{_wwwrootdir}/%{name}
touch $RPM_BUILD_ROOT/var/log/%{name}/lastrun.err
touch $RPM_BUILD_ROOT/var/log/%{name}/lastrun.log
touch $RPM_BUILD_ROOT/var/log/%{name}/runtime

%clean
rm -rf $RPM_BUILD_ROOT

%post
if [ -f /etc/httpd/httpd.conf ] && ! grep -q "^Include.*%{name}.conf" /etc/httpd/httpd.conf; then
	echo "Include /etc/httpd/%{name}.conf" >> /etc/httpd/httpd.conf
elif [ -d /etc/httpd/httpd.conf ]; then
	mv -f /etc/httpd/%{name}.conf /etc/httpd/httpd.conf/99_%{name}.conf
fi
if [ -f /var/lock/subsys/httpd ]; then
	/etc/rc.d/init.d/httpd restart 1>&2
fi
if [ -f /var/lock/subsys/crond ]; then
	/etc/rc.d/init.d/crond restart 1>&2
fi
echo "Before first run read /usr/share/doc/%{name}-%{version}/INSTALL how to put
/usr/share/netmrg/db/netmrg.mysql in your mysql server"


%preun
if [ "$1" = "0" ]; then
	umask 027
	if [ -d /etc/httpd/httpd.conf ]; then
		rm -f /etc/httpd/httpd.conf/99_%{name}.conf
	else
		grep -v "^Include.*%{name}.conf" /etc/httpd/httpd.conf > \
			etc/httpd/httpd.conf.tmp
		mv -f /etc/httpd/httpd.conf.tmp /etc/httpd/httpd.conf
		if [ -f /var/lock/subsys/httpd ]; then
			/usr/sbin/apachectl restart 1>&2
		fi
	fi
fi

%files
%defattr(644,root,root,755)
%doc %{_docdir}/%{name}-%{version}
%attr(640,root,root) %{_sysconfdir}/cron.d/netmrg
%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/netmrg.xml
%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/httpd/%{name}.conf
%attr(755,root,root) %{_bindir}/netmrg-gatherer
%attr(755,root,root) %{_bindir}/rrdedit
%{_datadir}/%{name}
%dir %{_pkglibdir}
%attr(700,http,http) %dir %{_pkglibdir}/rrd
%attr(700,http,http) %{_pkglibdir}/rrd/*
%attr(770,http,http) %dir /var/log/netmrg
%attr(660,http,http) /var/log/netmrg/*
%dir %{_libdir}/%{name}
%attr(755,root,root) %{_libdir}/%{name}/*
%{_mandir}/*/*