smartdns.spec 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. Name: smartdns
  2. Version: 1.2020.09.08
  3. Release: 2235%{?dist}
  4. Summary: smartdns
  5. License: GPL 3.0
  6. URL: https://github.com/pymumu/smartdns
  7. Source0: %{name}-%{version}.tar.gz
  8. BuildRequires: glibc
  9. BuildRequires: centos-release >= 7
  10. BuildRequires: openssl-devel
  11. Requires: glibc
  12. Requires: openssl
  13. Requires: systemd
  14. %description
  15. A local DNS server to obtain the fastest website IP for the best Internet experience.
  16. %prep
  17. %setup -q
  18. %build
  19. cd src
  20. make %{?_smp_mflags}
  21. %install
  22. rm -rf $RPM_BUILD_ROOT
  23. %{__install} -D -m 755 src/smartdns $RPM_BUILD_ROOT%{_sbindir}/smartdns
  24. %{__install} -D -m 644 etc/smartdns/smartdns.conf $RPM_BUILD_ROOT%{_sysconfdir}/smartdns/smartdns.conf
  25. %{__install} -D -m 644 systemd/smartdns.service.in $RPM_BUILD_ROOT%{_unitdir}/smartdns.service
  26. cat > $RPM_BUILD_ROOT%{_unitdir}/smartdns.service <<EOF
  27. [Unit]
  28. Description=smartdns
  29. ConditionFileIsExecutable=/usr/sbin/smartdns
  30. After=syslog.target network-online.target
  31. [Service]
  32. Type=simple
  33. ExecStart=/usr/sbin/smartdns -c /etc/smartdns/smartdns.conf -f
  34. PIDFile=/run/smartdns.pid
  35. Restart=on-failure
  36. KillMode=process
  37. [Install]
  38. WantedBy=multi-user.target
  39. EOF
  40. %files
  41. %defattr(-,root,root,-)
  42. %{_sbindir}/smartdns
  43. %config(noreplace) %{_sysconfdir}/smartdns/smartdns.conf
  44. %{_unitdir}/smartdns.service
  45. %post
  46. %systemd_post %{name}.service
  47. %preun
  48. %systemd_preun %{name}.service
  49. %postun
  50. %systemd_postun_with_restart %{name}.service