File uptimed.spec of Package uptimed

%define release	1
%define version 0.4.0

Summary:	A daemon to record and keep track of system uptimes
Name:	    uptimed
Version:	%{version}
Release:	%{release}
License:	GPL
Group:		System Environment/Daemons
Source:		http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
BuildRequires: automake autoconf autogen libtool
BuildRoot:	%{_tmppath}/%{name}-%{version}-buildroot
PreReq:		systemd %insserv_prereq %fillup_prereq

%description
Uptimed is an uptime record daemon keeping track of the highest
uptimes the system ever had. Instead of using a pid file to
keep sessions apart from each other, it uses the system boot
time.

Uptimed has the ability to inform you of records and milestones
though syslog and e-mail, and comes with a console front end to
parse the records, which can also easily be used to show your
records on your Web page

%prep
%setup -q

%build
./autogen.sh
%configure
%__make

%install
rm -rf "$RPM_BUILD_ROOT"
%makeinstall
install -m 755 -d $RPM_BUILD_ROOT/%_docdir/%{name}-%{version}/sample-cgi
install -m 644 sample-cgi/uprecords.* $RPM_BUILD_ROOT/%_docdir/%{name}-%{version}/sample-cgi
install -m 755 -d $RPM_BUILD_ROOT/%{_initddir}
install -m 755 etc/rc.uptimed $RPM_BUILD_ROOT/%{_initddir}/uptimed
mv $RPM_BUILD_ROOT/etc/uptimed.conf-dist $RPM_BUILD_ROOT/%{_sysconfdir}/uptimed.conf

%post
/sbin/ldconfig
install -m 755 -d /var/spool/uptimed
/sbin/chkconfig --add uptimed

if [ -f /etc/rc.d/rc.sysinit ]
then
	if [ ! `grep "/sbin/service uptimed createbootid" /etc/rc.d/rc.sysinit > /dev/null` ]
	then
		echo "/sbin/service uptimed createbootid" >> /etc/rc.d/rc.sysinit
	fi
else
echo
echo "Please add the following line to your rc.sysinit script"
echo "/sbin/service uptimed createbootid"
echo
fi

%postun
/sbin/ldconfig

%preun
/sbin/chkconfig --del uptimed

if [ -f /etc/rc.d/rc.sysinit ]
then
	grep -v "/sbin/service uptimed createbootid" /etc/rc.d/rc.sysinit > /tmp/rc.sysinit.$$ && mv /tmp/rc.sysinit.$$ /etc/rc.d/rc.sysinit
	chmod 755 /etc/rc.d/rc.sysinit
else
echo
echo "Please remove the following line to your rc.sysinit script"
echo "/sbin/service uptimed createbootid"
echo
fi

%clean
rm -rf "$RPM_BUILD_ROOT"

%files
%defattr(-,root,root)
%doc AUTHORS COPYING CREDITS ChangeLog INSTALL INSTALL.cgi INSTALL.upgrade
%doc README.md README.unsupported TODO
%doc %_docdir/%{name}-%{version}/sample-cgi/*
%config(noreplace) %{_sysconfdir}/uptimed.conf
%config %{_initddir}/uptimed
%{_sbindir}/uptimed
%{_bindir}/uprecords
%{_mandir}/*/*
%{_libdir}/libuptimed.*

%changelog
openSUSE Build Service is sponsored by