File udplogger.spec of Package udplogger
#
# spec file for package udplogger
#
# Copyright (c) 2024 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/
#
Name: udplogger
Version: 1.1
Release: 0
Summary: A utility for receiving netconsole messages
License: GPL-2.0-only
Group: System/Daemons
URL: https://sourceforge.jp/projects/akari/scm/svn/archive/head/branches/udplogger/?format=tar.gz
Source0: %{name}-%{version}.tar.gz
Source1: udplogger.conf
Source2: udplogger.service
Source3: udplogger@.service
Source4: udplogger.target
Patch0: 01-monthly-logging.patch
Patch1: 02-current-symlink.patch
Patch2: 03-setgroups.patch
%if 0%{?suse_version}
BuildRequires: systemd-rpm-macros
%endif
%description
Kernel netconsole does not use proper syslog format, so a dedicated
logging tool is needed for best results. This utility provides a
standalone logging mechanism for netconsole messages.
%prep
%autosetup -p1
%build
%make_build CFLAGS="%{optflags} -g"
%install
%make_install INSTALLDIR=%{buildroot} USRDOCDIR=%{_docdir}
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/udplogger.conf
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
install -p -D -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}@.service
install -p -D -m 644 %{SOURCE4} %{buildroot}%{_unitdir}/%{name}.target
install -d -m 755 %{buildroot}%{_sbindir}
rm %{buildroot}%{_docdir}/%{name}/COPYING
%check
%pre
%service_add_pre %{name}.service
%service_add_pre %{name}@.service
%service_add_pre %{name}.target
%preun
%service_del_preun %{name}.service
%service_del_preun %{name}@.service
%service_del_preun %{name}.target
%post
%service_add_post %{name}.service
%service_add_post %{name}@.service
%service_add_post %{name}.target
%postun
%service_del_postun %{name}.service
%service_del_postun %{name}@.service
%service_del_postun %{name}.target
%files
%license COPYING
%{_docdir}/%{name}/
%{_docdir}/%{name}/README
%{_bindir}/udplogger
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}@.service
%{_unitdir}/%{name}.target
%config(noreplace) %{_sysconfdir}/udplogger.conf
%changelog