File safte-monitor.spec of Package safte-monitor
#
# spec file for package safte-monitor
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
Name: safte-monitor
Summary: Linux SAF-TE SCSI enclosure monitor
License: GPL-2.0-or-later
Group: System/Monitoring
Version: 1.0.0~1
Release: 0
URL: https://github.com/andrewbasterfield/safte-monitor
Source0: %{name}-%{version}.tar.gz
Source1: safte-monitor.service
Source2: tmpfiles.conf
Source3: sysuser.conf
Source4: sysconfig
Patch01: 0001-Avoid-namespace-collisions-with-getline-via-stdio.h.patch
Patch02: 0002-Fix-compiler-warnings.patch
Patch03: 0003-mathopd.h-declare-mathopd_main.patch
Patch04: 0004-mathopd-provide-declaration-of-process_safte.patch
Patch05: 0005-safte-monitor-fix-call-to-mathopd_main.patch
Patch06: 0006-scsi_api.c-add-missing-includes.patch
Patch07: 0007-safte-monitor.conf.m4-allow-customizing-user.patch
Patch08: 0008-Makefile.in-install-alert-script-to-libexecdir.patch
BuildRequires: m4
Obsoletes: saftemon < %{version}
Provides: saftemon = %{version}
PreReq: %fillup_prereq
%if 0%{?suse_version} < 1500
Requires(pre): systemd-rpm-macros
%endif
%{?systemd_requires}
%description
safte-monitor reads disk enclosure status information from SAF-TE (SCSI
Accessible Fault Tolerant Enclosures). SAF-TE is a component of SES
(SCSI Enclosure Services) which is common on most SCSI disk enclosures.
these days.
The information retrieved includes power supply, temperature, audible
alarm, drive faults, array critical/failed/rebuilding state and door
lock status. saftemon logs changes in the status of these enclosure
elements to syslog and can optionally execute an alert help program
with details of the component failure.
%prep
%autosetup -p1
%build
rm -f config.cache config.log config.status
%configure --with-safte-monitor_user=saftemon
%{?make_build}%{!?make_build:make %{?_smp_mflags}}
%install
%make_install
install -d $RPM_BUILD_ROOT%{_fillupdir}
install -m 0644 %{SOURCE4} $RPM_BUILD_ROOT%{_fillupdir}/sysconfig.safte-monitor
install -d $RPM_BUILD_ROOT%{_unitdir}
install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}
install -d $RPM_BUILD_ROOT%{_tmpfilesdir}
install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_tmpfilesdir}/%{name}.conf
install -d $RPM_BUILD_ROOT/sbin
ln -sf service $RPM_BUILD_ROOT/sbin/rcsafte-monitor
%pre
%sysusers_create_package %{name} %{SOURCE3}
%service_add_pre %{name}.service
%post
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%{fillup_only safte-monitor}
%service_add_post %{name}.service
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%files
%license mathopd-1.3pl7-lite/COPYING
%doc CHANGELOG README README.html
%{_fillupdir}/sysconfig.safte-monitor
%config(noreplace) /etc/safte-monitor.conf
%config(noreplace) /etc/safte-monitor.passwd
/usr/sbin/safte-monitor
/sbin/rcsafte-monitor
%{_libexecdir}/safte-monitor
%{_mandir}/man8/safte-monitor.8*
%{_datadir}/safte-monitor
%attr(755,saftemon,root) %ghost /run/safte-monitor
%attr(-,saftemon,root) /var/log/safte-monitor
%{_unitdir}/%{name}.service
%{_tmpfilesdir}/%{name}.conf
%changelog