Name:		mstpd
Version:	0.1.0
Release:	1%{?dist}
Summary:	Multiple Spanning Tree Protocol Daemon (MSTP Daemon)

License:	GPLv2
URL:		https://github.com/mstpd/mstpd
Source0:	%{name}-%{version}.tar.gz

BuildRequires:	automake, autoconf, libtool, systemd, NetworkManager

%description
MSTPD is an open source user-space daemon licensed under GPLv2.

MSTPD is reported to be compliant with IXIA ANVL RSTP test suite, with
the notable exception of looped-back BPDUs (see discussion on the
matter on the Implementation Features wiki page:
https://github.com/mstpd/mstpd/wiki/ImplementationFeatures).

Important note! MSTP part of the code (as opposed to STP/RSTP part) is
mainly untested, so I believe it will behave unexpectedly in many
situations. Don't use it in production!

%prep
%setup -q
sed -i -e 's!^mstpdpidfile=\$(localstatedir)/run/mstpd\.pid$!mstpdpidfile=/run/mstpd.pid!' Makefile.am

%build
./autogen.sh
%configure
%make_build

%install
%make_install
mkdir -p %{buildroot}%{_datadir}/bash-completion
mv %{buildroot}%{_sysconfdir}/bash_completion.d %{buildroot}%{_datadir}/bash-completion/completions

%post
%systemd_post %{name}.service

%preun
%systemd_preun %{name}.service

%postun
%systemd_postun_with_restart %{name}.service

%files
%license LICENSE
%config(noreplace) %{_sysconfdir}/bridge-stp.conf
%{_sbindir}/*
%dir %{_libexecdir}/mstpctl-utils
%{_libexecdir}/mstpctl-utils/*
%{_prefix}/lib/systemd/system/*
%{_prefix}/lib/NetworkManager/dispatcher.d/*
%{_datadir}/bash-completion/completions/*
%{_datadir}/man/man*/*
%{_docdir}/*

%changelog
* Sat May 06 2023 Philippe Troin <phil@fifi.org>
- Created.