File opensnitch.spec of Package opensnitch

#
# spec file for package opensnitch
#
# Copyright (c) 2021, Martin Hauke <mardnh@gmx.de>
#
# 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:           opensnitch
Version:        1.3.6
Release:        0
Summary:        An application-level firewall
License:        GPL-3.0-or-later
Group:          Productivity/Networking/Security
URL:            https://github.com/evilsocket/opensnitch
Source:         https://github.com/evilsocket/opensnitch/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.gz
BuildRequires:  go
BuildRequires:  golang-packaging
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libnetfilter_queue)
%{go_provides}
%{?systemd_requires}

%description
OpenSnitch monitors outbound connections that your applications are
trying to make, preventing or permitting their connection based on
a set of rules (the user is prompted to allow or deny access when
no existing rules are found).

%prep
%autosetup -a 1

%build
%{goprep} github.com/evilsocket/opensnitch/
%{gobuild} ./daemon/...

%install
%{goinstall}
mv %{buildroot}%{_bindir}/daemon %{buildroot}%{_bindir}/opensnitchd
#
sed -i 's|/usr/local/|/usr/|g' daemon/opensnitchd.service
install -D -m 0644 daemon/opensnitchd.service %{buildroot}/%{_unitdir}/opensnitch.service
#
install -D -m 0640 daemon/default-config.json %{buildroot}%{_sysconfdir}/opensnitchd/default-config.json
install -D -m 0644 daemon/system-fw.json %{buildroot}%{_sysconfdir}/opensnitchd/system-fw.json
#
install -d %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcopensnitch

%pre
%service_add_pre opensnitch.service

%post
%service_add_post opensnitch.service

%preun
%service_del_preun opensnitch.service

%postun
%service_del_postun opensnitch.service

%files
%license LICENSE
%doc README.md
%{_bindir}/opensnitchd
%dir %{_sysconfdir}/opensnitchd
%config(noreplace) %{_sysconfdir}/opensnitchd/default-config.json
%config(noreplace) %{_sysconfdir}/opensnitchd/system-fw.json
%{_sbindir}/rcopensnitch
%{_unitdir}/opensnitch.service

%changelog
openSUSE Build Service is sponsored by