File fdns.spec of Package fdns
#
# spec file for package fdns
#
# Copyright (c) 2020 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 pkg_home /var/lib/%{name}
Name: fdns
Version: 0.9.72
Release: 0
Summary: Firejail DNS-over-HTTPS Proxy Server
License: GPL-3.0-only
URL: https://github.com/netblue30/fdns/releases
Source: https://github.com/netblue30/fdns/releases/download/v%{version}/fdns-%{version}.tar.xz
Source1: https://github.com/netblue30/fdns/releases/download/v%{version}/fdns-%{version}.tar.xz.asc
BuildRequires: apparmor-abstractions
BuildRequires: apparmor-rpm-macros
BuildRequires: pkgconfig
BuildRequires: pkgconfig(bash-completion)
BuildRequires: pkgconfig(libseccomp)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(systemd)
%{?systemd_ordering}
Requires(post): apparmor-parser
Requires(pre): shadow
%description
fdns is a DNS-over-HTTPS proxy server targeted at small networks and
Linux desktops. To speed up the name resolution fdns caches the responses,
and uses a configurable adblocker and privacy filter to cut down the
unnecessary traffic.
%prep
%autosetup -p1
%build
export CFLAGS="%{optflags} $(pkg-config --cflags libseccomp)"
%configure
%make_build
%install
%make_install
rm -rv %{buildroot}%{_datadir}/doc/fdns/
mkdir -p \
%{buildroot}%{_sysconfdir}/apparmor.d/local/ \
%{buildroot}%{_sbindir} \
%{buildroot}%{pkg_home}
echo etc/apparmor/usr.bin.fdns > %{buildroot}%{_sysconfdir}/apparmor.d/usr.bin.fdns
echo etc/apparmor/fdns-local > %{buildroot}%{_sysconfdir}/apparmor.d/local/usr.bin.fdns
install -D -m 0644 etc/fdns.service %{buildroot}%{_unitdir}/%{name}.service
ln -sf /sbin/service %{buildroot}%{_sbindir}/rc%{name}
chmod -R u+rwX,g+rX,o= %{buildroot}%{_sysconfdir}/fdns/
%pre
getent group %{name} >/dev/null || /usr/sbin/groupadd -r %{name}
getent passwd %{name} >/dev/null || \
/usr/sbin/useradd -g %{name} -s /bin/false -r \
-c "user for %{name}" -d %{pkg_home} %{name}
%service_add_pre %{name}.service
%post
%apparmor_reload %{_sysconfdir}/apparmor.d/usr.bin.fdns
%service_add_post %{name}.service
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%files
%license COPYING
%doc RELNOTES README
%config(noreplace) %attr(-,root,%{name}) %{_sysconfdir}/fdns/
%config %{_sysconfdir}/apparmor.d/usr.bin.fdns
%config(noreplace) %{_sysconfdir}/apparmor.d/local/usr.bin.fdns
%{_unitdir}/%{name}.service
%{_bindir}/fdns
%{_bindir}/nxdomain
%{_sbindir}/rc%{name}
%{_datadir}/bash-completion/completions/fdns
%{_mandir}/man1/fdns.1%{?ext_man}
%{_mandir}/man1/nxdomain.1%{?ext_man}
%dir %attr(700,%{name},%{name}) %{pkg_home}
%changelog