dnscrypt-proxy/dnscrypt-proxy.spec
2025-01-12 23:11:03 +00:00

75 lines
No EOL
2.3 KiB
RPMSpec
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

%define debug %nil
%define debug_package %nil
Summary: Tool for securing communications between a client and a DNS resolver
Name: dnscrypt-proxy
Version: 2.1.7
Release: 1
License: BSD
Group: Networking/Other
URL: https://dnscrypt.info
Source0: https://github.com/DNSCrypt/dnscrypt-proxy/archive/%{version}/%{name}-%{version}.tar.gz
Source1: %{name}-resolvconf.service
Source2: %{name}.service
Source3: %{name}.socket
Source4: %{name}-default
Source5: %{name}
BuildRequires: go
BuildRequires: upx
BuildRequires: git-core
BuildRequires: pkgconfig(systemd)
Requires: systemd
Requires(post): rpm-helper
Requires(preun): rpm-helper
%description
A tool for securing communications between a client and a DNS resolver.
%prep
%setup -q
%build
export GOPROXY=direct
go build -ldflags="-s -w" -o bin/dnscrypt-proxy ./%{name}/
upx bin/%{name}
%install
install -D -p -m 0755 bin/%{name} %{buildroot}%{_bindir}/%{name}
install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_systemunitdir}/%{name}-resolvconf.service
install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_systemunitdir}/%{name}.service
install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_systemunitdir}/%{name}.socket
install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/default/%{name}
install -Dm0644 %{name}/example-dnscrypt-proxy.toml %{buildroot}%{_sysconfdir}/dnscrypt/dnscrypt-proxy.toml
%files
%doc README.md LICENSE dnscrypt-proxy/example*
%{_systemunitdir}/%{name}-resolvconf.service
%{_systemunitdir}/%{name}.service
%{_systemunitdir}/%{name}.socket
%{_sysconfdir}/default/%{name}
%{_bindir}/%{name}
%{_sysconfdir}/dnscrypt/dnscrypt-proxy.toml
%post
%systemd_post dnscrypt-proxy
# Simple: still needs this since in release 3 services were not set
# enabled and seams that still isnt properly handeled in %%_post_service
if [ "$1" -ge "1" ]; then
# Enable (but don't start) the unit by default
/bin/systemctl enable dnscrypt-proxy.service
# Start dnscrypt-proxy service
/bin/systemctl start dnscrypt-proxy.service
fi
# настроим сервис systemd-resolver и перезапустим его
sed -i 's/^#DNS=/DNS=127.0.0.1/' /etc/systemd/resolved.conf
/bin/systemctl restart systemd-resolved.service
%preun
%systemd_preun dnscrypt-proxy
# вернем настройки резолвера в дефолтное состояние
sed -i 's/DNS=127.0.0.1/#DNS=/' /etc/systemd/resolved.conf