From 03e51fb084e0d9f8e037682c3373cbb7213ed366 Mon Sep 17 00:00:00 2001 From: Victor Ryzhikh Date: Mon, 5 Dec 2016 14:29:01 +0400 Subject: [PATCH] Fixed autostart service --- dnscrypt-proxy.spec | 82 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 76 insertions(+), 6 deletions(-) diff --git a/dnscrypt-proxy.spec b/dnscrypt-proxy.spec index 5cdd526..31f2082 100644 --- a/dnscrypt-proxy.spec +++ b/dnscrypt-proxy.spec @@ -1,7 +1,7 @@ Summary: Tool for securing communications between a client and a DNS resolver Name: dnscrypt-proxy Version: 1.7.0 -Release: 7 +Release: 8 License: BSD Group: Networking/Other Url: http://dnscrypt.org @@ -52,11 +52,8 @@ install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name} # 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 -echo '#!/bin/sh -systemctl start dnscrypt-proxy.service' > /etc/rc.d/rc.local -chmod +x /etc/rc.d/rc.local - -ln -s /etc/rc.d/rc.local /etc/rc.local + # 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 @@ -75,3 +72,76 @@ Development libraries from %{name}. %files devel %{_includedir}/dnscrypt/*.h +Summary: Tool for securing communications between a client and a DNS resolver +Name: dnscrypt-proxy +Version: 1.7.0 +Release: 8 +License: BSD +Group: Networking/Other +Url: http://dnscrypt.org +Source0: http://download.dnscrypt.org/dnscrypt-proxy/%{name}-%{version}.tar.bz2 +Source1: %{name}.service +Source2: %{name}.socket +Source3: %{name}.sysconfig +BuildRequires: pkgconfig(libsodium) +BuildRequires: pkgconfig(systemd) +BuildRequires: gawk +BuildRequires: sed +BuildRequires: grep + +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 +%configure2_5x --enable-static=no --with-systemd +%make + +%install +%makeinstall +install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_systemunitdir}/%{name}.service +install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_systemunitdir}/%{name}.socket +install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name} + +%files +%{_systemunitdir}/%{name}.service +%{_systemunitdir}/%{name}.socket +%{_sysconfdir}/sysconfig/%{name} +%{_sbindir}/%{name} +%{_bindir}/hostip +%{_mandir}/man8/%{name}.8* +%{_mandir}/man8/hostip.8* +%{_datadir}/%{name}/dnscrypt-resolvers.csv +%{_datadir}/%{name}/minisign.pub +%{_libdir}/dnscrypt-proxy/libdcplugin_example.so +%{_libdir}/dnscrypt-proxy/libdcplugin_example_logging.so + +%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 + +%preun +%systemd_preun dnscrypt-proxy + +%package devel +Group: Development/C +Summary: Development libraries from %{name} +Requires: %{name} = %{EVRD} + +%description devel +Development libraries from %{name}. + +%files devel +%{_includedir}/dnscrypt/*.h