File clewarecontrol.spec of Package clewarecontrol
#
# spec file for package clewarecontrol
#
# 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/
#
%define clewareuser _clewarecontrol
%define clewaregroup _clewarecontrol
Name: clewarecontrol
Version: 6.6.3
Release: 0
Summary: Control Cleware USB devices
License: GPL-3.0
Group: Hardware/Other
URL: https://www.cleware-shop.de/
Source: Linux_Ubuntu_%{version}.zip
Source1: %{name}.service
Source2: clewarecontrol.rc
Source3: %{name}.conf
Source12: check_temperature
Source100: clewarecontrol-rpmlintrc
Patch0: clewarecontrol-optflags.patch
BuildRequires: gcc-c++
BuildRequires: nagios-rpm-macros
BuildRequires: pkgconfig
BuildRequires: systemd-rpm-macros
BuildRequires: pkgconfig(hidapi-hidraw)
BuildRequires: swig
BuildRequires: unzip
Requires(pre): shadow
%{?systemd_requires}
%description
This program lets you control the USB-devices made by Cleware GmbH.
You can measure the temperature or humidity, switch on and off and configure
switches, control the watchdog, etc.
%lang_package
%package -n monitoring-plugins-clewarecontrol_temperature
Summary: Nagios script to monitor the temperature through clewarecontrol
Group: System/Monitoring
Recommends: nrpe
Obsoletes: %{name}-check_temperature < %{version}
Provides: %{name}-check_temperature = %{version}
%description -n monitoring-plugins-clewarecontrol_temperature
Provides a small bash script which interacts with nagios or icinga through
NRPE.
%prep
%setup -q -c
%patch0 -p1
sed -e 's|@CFLAGS@|%{optflags}|g' \
-e 's|@CXXFLAGS@|%{optflags}|g' Makefile > Makefile.new
mv Makefile.new Makefile
%build
CXXFLAGS+=" %{optflags}"
export CXXFLAGS
make all
%install
install -d %{buildroot}/%{_bindir} %{buildroot}%{_sbindir}
make install DESTDIR=%{buildroot} PREFIX=%{_prefix}
install -Dm 0755 %{SOURCE12} %{buildroot}/%{nagios_plugindir}/check_temperature
install -Dm 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
install -Dm 0644 %{SOURCE3} %{buildroot}%{_tmpfilesdir}/%{name}.conf
%find_lang %{name} --all-name %{?no_lang_C}
%pre
%{_sbindir}/groupadd -r %{clewaregroup} >/dev/null 2>&1 || :
%{_sbindir}/useradd -g %{clewaregroup} -s /bin/false -r \
-c "clewarecontrol" -d %{_localstatedir}/run/clewarecontrol %{clewareuser} >/dev/null 2>&1 || :
%service_add_pre %{name}.service
%post
systemd-tmpfiles --create %{_tmpfilesdir}/%{name}.conf || true
%service_add_post %{name}.service
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%files
%license gpl-3.0.txt
%doc readme.txt
%{_sbindir}/rc%{name}
%{_bindir}/%{name}
%dir %{_tmpfilesdir}
%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/%{name}.service
%{_mandir}/man1/clewarecontrol.1%{?ext_man}
%files lang -f %{name}.lang
%files -n monitoring-plugins-clewarecontrol_temperature
%defattr(0755,root,root)
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%{nagios_plugindir}/check_temperature
%changelog