File monit.spec of Package monit

#
# spec file for package monit (Version 4.10.1)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

Name:           monit
BuildRequires:  bison flex openssl-devel
Version:        4.10.1
Release:        1
License:        GPL v2 or later
Group:          System/Monitoring
Summary:        Service Manager and Monitor System
Url:            http://www.tildeslash.com/monit/
AutoReqProv:    on
Source:         http://www.tildeslash.com/monit/dist/%{name}-%{version}.tar.bz2
Source1:        vendor-files.tar.gz
Patch:          page_shift.patch
Patch1:         no-strip.patch
Patch2:         monit-hz.patch
%if %ul_version >= 1
%define  VENDOR UL
%else
%if "%{_vendor}" == "suse"
%define	VENDOR SUSE
%else
%define	VENDOR %_vendor
%endif
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         %fillup_prereq %insserv_prereq

%description
Monit is a utility for managing and monitoring processes, files,
directories, and devices on a Unix system.  Monit conducts automatic
maintenance and repair and can execute meaningful causal actions in
error situations.  For example, monit can start a process if it does
not run, restart a process if it does not respond, and stop a process
if it uses too many resources.	You can use monit to monitor files,
directories, and devices for changes, such as time stamp changes,
checksum changes, or size changes. You can even use monit to monitor
remote hosts: monit can ping a remote host and check port connections.



Authors:
--------
    Jan-Henrik Haukeland <hauk at tildeslash dot com>
    Martin Pala <martin.pala at iol dot cz>
    Rory Toma <rory at digeo dot com>
    Christian Hopp <chopp at iei dot tu-clausthal dot de>

%prep
%setup -a1
%patch -p1
%patch1
%patch2

%build
%{?suse_update_config:%{suse_update_config -f}}
autoreconf --force --install
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
%{configure} \
	--prefix=%{_prefix} \
	--sysconfdir=%{_sysconfdir} \
	--with-ssl-lib-dir=%{_libdir}
%{__make}

%install
make \
	BINDIR=${RPM_BUILD_ROOT}/%{_bindir} \
	MANDIR=${RPM_BUILD_ROOT}/%{_mandir}/man1 \
	install
mkdir -p \
	${RPM_BUILD_ROOT}/%{_sysconfdir}/init.d \
	${RPM_BUILD_ROOT}/%{_sysconfdir}/monit.d \
	${RPM_BUILD_ROOT}/%{_sbindir} \
	${RPM_BUILD_ROOT}/%{_datadir}/monit \
	${RPM_BUILD_ROOT}/%{_var}/adm/fillup-templates \
	${RPM_BUILD_ROOT}/%{_var}/lib/monit \
	${RPM_BUILD_ROOT}/%{_var}/run/monit
. vendor-files/sysconfig/monit.tmpl
MONIT_BIN="/usr/bin/monit"
MONIT_MODIFY_INITTAB="/usr/share/monit/monit-modifyinittab"
MONIT_PID_FILE="/var/run/monit/monit.pid"
MONIT_SYSCONFIG_FILE="/etc/sysconfig/monit"
MONIT_INITTAB_STATE_FILE="/var/lib/monit/monit-inittab.state"
MONIT_ARGS="-p ${MONIT_PID_FILE} -s /var/run/monit/monit.state"
MONIT_EVENTQUE_DIR="/var/lib/monit"
sed -e "s%/var/monit%${MONIT_EVENTQUE_DIR}%g" \
	monitrc > \
		${RPM_BUILD_ROOT}/%{_sysconfdir}/monitrc
pushd vendor-files
for templatefile in docu/README tools/monit-modifyinittab init/monit sysconfig/monit; do
	sed -e "s%__MONIT_RC_FILE__%${MONIT_RC_FILE}%g" \
		-e "s%__MONIT_INITTAB_BASE__%${MONIT_INITTAB_BASE}%g" \
		-e "s%__MONIT_INITTAB_COMMENT__%${MONIT_INITTAB_COMMENT}%g" \
		-e "s%__MONIT_INITTAB_STATE_FILE__%${MONIT_INITTAB_STATE_FILE}%g" \
		-e "s%__MONIT_ARGS__%${MONIT_ARGS}%g" \
		-e "s%__MONIT_BIN__%${MONIT_BIN}%g" \
		-e "s%__MONIT_MODIFY_INITTAB__%${MONIT_MODIFY_INITTAB}%g" \
		-e "s%__MONIT_PID_FILE__%${MONIT_PID_FILE}%g" \
		-e "s%__MONIT_SYSCONFIG_FILE__%${MONIT_SYSCONFIG_FILE}%g" \
		${templatefile}.tmpl > \
			${templatefile}
done
popd
install -m 0754 vendor-files/init/monit ${RPM_BUILD_ROOT}/etc/init.d/monit
ln -s ../../etc/init.d/monit ${RPM_BUILD_ROOT}/%{_sbindir}/rcmonit
install -m 0754 vendor-files/tools/monit-modifyinittab ${RPM_BUILD_ROOT}/%{_datadir}/monit
install -m 0644 vendor-files/sysconfig/monit ${RPM_BUILD_ROOT}/%{_var}/adm/fillup-templates/sysconfig.monit
touch ${RPM_BUILD_ROOT}/%{_var}/lib/monit/monit-inittab.state
touch ${RPM_BUILD_ROOT}/%{_var}/run/monit/monit.{pid,state}
install -m 0644 vendor-files/docu/README ${RPM_BUILD_DIR}/%{name}-%{version}/README.%{VENDOR}

%post
%{fillup_and_insserv}

%preun
%{stop_on_removal monit}

%postun
%{restart_on_update monit}
%{insserv_cleanup}

%clean
[ "${RPM_BUILD_ROOT}" != "/" -a -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}

%files
%defattr(-,root,root)
%doc CHANGES.txt CONTRIBUTORS COPYING FAQ.txt LICENSE PLATFORMS README* STATUS UPGRADE.txt doc
%attr(0600, root, root) %config(noreplace) %{_sysconfdir}/monitrc
%dir %{_sysconfdir}/monit.d
%attr(0754, root, root) %config %{_sysconfdir}/init.d/monit
%{_sbindir}/rcmonit
%{_bindir}/monit
%{_mandir}/man1/monit.1.gz
%dir %{_datadir}/monit
%{_datadir}/monit/monit-modifyinittab
%{_var}/adm/fillup-templates/sysconfig.monit
%dir %{_var}/lib/monit
%ghost %{_var}/lib/monit/monit-inittab.state
%dir %{_var}/run/monit
%ghost %{_var}/run/monit/monit.pid
%ghost %{_var}/run/monit/monit.state
%changelog
* Fri Nov 09 2007 - crrodriguez@suse.de
- update to version 4.10.1 (massive feature,bugfix release see CHANGES.txt for more details)
- add missing PreReq tags to fix build in BETA
- add missing remote_fs dependency in the init script
* Thu Mar 29 2007 - rguenther@suse.de
- add bison and flex BuildRequires
* Tue Aug 08 2006 - ro@suse.de
- define HZ sysconf(_SC_CLK_TCK) if not defined
* Sat May 27 2006 - lmuelle@suse.de
- Update to version 4.8.1 (bugfix release; see CHANGES.txt for more details).
  * Fix logging on 64-bit systems.
  * Don't stop if there is no space on the filesystem.
  * Remove the false warning about TOTALMEMORY.
* Fri Apr 21 2006 - lmuelle@suse.de
- Use /var/lib/monit to store the inittab state file.
* Tue Apr 18 2006 - lmuelle@suse.de
- Use kill instead of killproc to terminate monit if we start monit from
  inittab.
- Add /etc/monit.d and /var/lib/monit directories.
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Fri Jan 20 2006 - schwab@suse.de
- Don't strip binaries.
* Fri Jan 13 2006 - lmuelle@suse.de
- Update to version 4.7.
* Thu Oct 27 2005 - lmuelle@suse.de
- Update to version 4.6.
* Thu Apr 14 2005 - lmuelle@suse.de
- Update to version 4.5.1.
* Mon Apr 11 2005 - lmuelle@suse.de
- Update to version 4.5.
* Mon Oct 11 2004 - lmuelle@suse.de
- Update to version 4.4.
* Fri Sep 10 2004 - lmuelle@suse.de
- Remove update notify message, [#44356].
- Move vendor files to an own tar ball.
* Fri May 14 2004 - lmuelle@suse.de
- Update to version 4.3.
* Tue Apr 20 2004 - lmuelle@suse.de
- Update to version 4.2.1, [#39166]
* Wed Jan 07 2004 - lmuelle@suse.de
- update to version 4.1.1
- allow call of /usr/share/monit/monit-modifyinittab without a switch
- add /usr/share/monit/monit-modifyinittab as Command: to sysconfig file
* Mon Nov 10 2003 - lmuelle@suse.de
- rename SuSEconfig.monit to /usr/share/monit/monit-modifyinittab
- add --add and --remove switch to /usr/share/monit/monit-modifyinittab
- call /usr/share/monit/monit-modifyinittab in the init script if
  MONIT_VIA_INITTAB of /etc/sysconfig/monit is set to "yes"
* Sat Nov 08 2003 - lmuelle@suse.de
- use 0600 for /etc/monitrc
- add systax check to init and SuSEconfog.monit script
- don't check for configuration file or syntax if the init script is called
  with 'stop'
* Fri Nov 07 2003 - lmuelle@suse.de
- update to version 4.1
- add restart on update and other usual macros to %%preun and %%postun
- add poll option to the init script to send SIGUSR1
- add a vendor README
- add norootforbuild to the spec file
* Wed Oct 01 2003 - schwab@suse.de
- Don't use PAGE_SHIFT.
* Mon Jun 02 2003 - lmuelle@suse.de
- inital SuSE RPM based on the spec file provided by the monit team
openSUSE Build Service is sponsored by