dnscrypt-proxy/dnscrypt-proxy.spec

75 lines
2.3 KiB
RPMSpec
Raw Normal View History

2019-09-18 18:02:53 +03:00
%define debug %nil
%define debug_package %nil
2015-05-08 16:29:52 +04:00
Summary: Tool for securing communications between a client and a DNS resolver
Name: dnscrypt-proxy
2025-01-12 23:11:03 +00:00
Version: 2.1.7
Release: 1
2015-05-08 16:29:52 +04:00
License: BSD
Group: Networking/Other
2024-10-10 22:11:07 +00:00
URL: https://dnscrypt.info
2021-01-03 21:10:48 +03:00
Source0: https://github.com/DNSCrypt/dnscrypt-proxy/archive/%{version}/%{name}-%{version}.tar.gz
2019-09-18 18:02:53 +03:00
Source1: %{name}-resolvconf.service
Source2: %{name}.service
Source3: %{name}.socket
Source4: %{name}-default
Source5: %{name}
BuildRequires: go
BuildRequires: upx
BuildRequires: git-core
2024-10-10 22:11:07 +00:00
BuildRequires: pkgconfig(systemd)
2019-09-18 18:02:53 +03:00
Requires: systemd
Requires(post): rpm-helper
Requires(preun): rpm-helper
2015-05-08 16:29:52 +04:00
%description
A tool for securing communications between a client and a DNS resolver.
2017-09-16 14:05:39 +03:00
%prep
%setup -q
%build
2024-10-10 22:11:07 +00:00
export GOPROXY=direct
go build -ldflags="-s -w" -o bin/dnscrypt-proxy ./%{name}/
2017-09-16 14:05:39 +03:00
2024-10-10 22:11:07 +00:00
upx bin/%{name}
2017-09-16 14:05:39 +03:00
%install
2019-09-18 18:02:53 +03:00
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}
2024-10-10 22:11:07 +00:00
install -Dm0644 %{name}/example-dnscrypt-proxy.toml %{buildroot}%{_sysconfdir}/dnscrypt/dnscrypt-proxy.toml
2017-09-16 14:05:39 +03:00
2019-09-18 18:02:53 +03:00
%files
2024-10-10 22:11:07 +00:00
%doc README.md LICENSE dnscrypt-proxy/example*
2019-09-18 18:02:53 +03:00
%{_systemunitdir}/%{name}-resolvconf.service
%{_systemunitdir}/%{name}.service
%{_systemunitdir}/%{name}.socket
%{_sysconfdir}/default/%{name}
%{_bindir}/%{name}
2024-10-10 22:11:07 +00:00
%{_sysconfdir}/dnscrypt/dnscrypt-proxy.toml
2017-09-16 14:05:39 +03:00
%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
2019-09-18 18:02:53 +03:00
# 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
2017-09-16 14:05:39 +03:00
fi
2024-10-10 22:11:07 +00:00
# настроим сервис systemd-resolver и перезапустим его
sed -i 's/^#DNS=/DNS=127.0.0.1/' /etc/systemd/resolved.conf
/bin/systemctl restart systemd-resolved.service
2017-09-16 14:05:39 +03:00
%preun
%systemd_preun dnscrypt-proxy
2024-10-10 22:11:07 +00:00
# вернем настройки резолвера в дефолтное состояние
sed -i 's/DNS=127.0.0.1/#DNS=/' /etc/systemd/resolved.conf