1%define release	1
2
3Summary:	A daemon to record and keep track of system uptimes
4Name:	@PACKAGE@
5Version:	@VERSION@
6Release:	%{release}
7License:	GPL
8Group:	System Environment/Daemons
9Source:	http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
10BuildRoot:	/var/tmp/%{name}-%{version}-buildroot
11PreReq:	chkconfig >= 0.9
12
13%description
14Uptimed is an uptime record daemon keeping track of the highest
15uptimes the system ever had. Instead of using a pid file to
16keep sessions apart from each other, it uses the system boot
17time.
18
19Uptimed has the ability to inform you of records and milestones
20though syslog and e-mail, and comes with a console front end to
21parse the records, which can also easily be used to show your
22records on your Web page
23
24%prep
25%setup -q
26
27%build
28%configure
29make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
30
31%install
32rm -rf "$RPM_BUILD_ROOT"
33make DESTDIR="$RPM_BUILD_ROOT" install
34install -m 755 -d $RPM_BUILD_ROOT/%_docdir/%{name}-%{version}/sample-cgi
35install -m 644 sample-cgi/uprecords.* $RPM_BUILD_ROOT/%_docdir/%{name}-%{version}/sample-cgi
36install -m 755 -d $RPM_BUILD_ROOT/etc/rc.d/init.d
37install -m 755 etc/rc.uptimed $RPM_BUILD_ROOT/etc/rc.d/init.d/uptimed
38mv $RPM_BUILD_ROOT/etc/uptimed.conf-dist $RPM_BUILD_ROOT/etc/uptimed.conf
39
40%post
41/sbin/ldconfig
42install -m 755 -d /var/spool/uptimed
43/sbin/chkconfig --add uptimed
44
45if [ -f /etc/rc.d/rc.sysinit ]
46then
47	if [ ! `grep "/sbin/service uptimed createbootid" /etc/rc.d/rc.sysinit > /dev/null` ]
48	then
49		echo "/sbin/service uptimed createbootid" >> /etc/rc.d/rc.sysinit
50	fi
51else
52echo
53echo "Please add the following line to your rc.sysinit script"
54echo "/sbin/service uptimed createbootid"
55echo
56fi
57
58%postun
59/sbin/ldconfig
60
61%preun
62/sbin/chkconfig --del uptimed
63
64if [ -f /etc/rc.d/rc.sysinit ]
65then
66	grep -v "/sbin/service uptimed createbootid" /etc/rc.d/rc.sysinit > /tmp/rc.sysinit.$$ && mv /tmp/rc.sysinit.$$ /etc/rc.d/rc.sysinit
67	chmod 755 /etc/rc.d/rc.sysinit
68else
69echo
70echo "Please remove the following line to your rc.sysinit script"
71echo "/sbin/service uptimed createbootid"
72echo
73fi
74
75%clean
76rm -rf "$RPM_BUILD_ROOT"
77
78%files
79%defattr(-,root,root)
80%doc AUTHORS COPYING CREDITS ChangeLog INSTALL INSTALL.cgi INSTALL.upgrade README README.unsupported TODO sample-cgi/
81%config(noreplace) /etc/uptimed.conf
82%config /etc/rc.d/init.d/uptimed
83%{_sbindir}/uptimed
84%{_bindir}/uprecords
85%{_mandir}/*/*
86%{_libdir}/libuptimed.*
87
88%changelog
89* Tue May 14 2002 Brett Pemberton <generica@email.com>
90- Reset release to 0 for uptimed-2.0
91- Change source location
92
93* Sat Mar 16 2002 Brett Pemberton <generica@email.com>
94- Add /etc/rc.d/init.d/uptimed
95- Use chkconfig
96
97* Wed Mar 13 2002 Brett Pemberton <generica@email.com>
98- Automate rc.{sysinit,local} add/remove
99- Warn if rc.{sysinit,local} not found
100
101* Fri Dec 21 2001 Brett Pemberton <generica@email.com>
102- Handle sample-cgi dir properly
103- Install uptimed.conf properly
104- Install /var/spool/uptimed
105- Warn user to finish configuring
106
107* Thu Dec 20 2001 Brett Pemberton <generica@email.com>
108- Initial spec-file
109