dnsmasq-vl.spec 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. %bcond_with systemd
  2. Name: dnsmasq
  3. Version: 2.82
  4. Release: 1%{?_dist_release}%{?with_systemd:.systemd}
  5. Summary: A lightweight DHCP/caching DNS server
  6. Summary(ja): 軽量 DHCP/DNSキャッシュサーバ
  7. Group: servers
  8. Vendor: Project Vine
  9. Distribution: Vine Linux
  10. License: GPLv2 or GPLv3
  11. URL: http://www.thekelleys.org.uk/dnsmasq/
  12. Source0: http://www.thekelleys.org.uk/dnsmasq/%{name}-%{version}.tar.xz
  13. Source1: %{name}.service
  14. Source2: dnsmasq-systemd-sysusers.conf
  15. Patch0: %{name}-2.33-initscript.patch
  16. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
  17. BuildRequires: dbus-devel, libidn2-devel, nettle-devel
  18. BuildRequires: pkgconfig
  19. Requires(pre): shadow-utils
  20. Requires(post): /bin/sed /bin/grep
  21. %if %{with systemd}
  22. BuildRequires: systemd
  23. %{?systemd_requires}
  24. %else
  25. Requires(post): /sbin/chkconfig
  26. Requires(post): /sbin/service
  27. Requires(preun): /sbin/chkconfig
  28. Requires(preun): /sbin/service
  29. Requires(postun): /sbin/service
  30. %endif
  31. %description
  32. Dnsmasq is lightweight, easy to configure DNS forwarder and DHCP server.
  33. It is designed to provide DNS and, optionally, DHCP, to a small network.
  34. It can serve the names of local machines which are not in the global
  35. DNS. The DHCP server integrates with the DNS server and allows machines
  36. with DHCP-allocated addresses to appear in the DNS with names configured
  37. either in each host or in a central configuration file. Dnsmasq supports
  38. static and dynamic DHCP leases and BOOTP for network booting of diskless
  39. machines.
  40. %debug_package
  41. %prep
  42. %setup -q -n %{name}-%{version}
  43. %if !%{with systemd}
  44. %patch0 -p1
  45. %endif
  46. # use /var/lib/dnsmasq instead of /var/lib/misc
  47. for file in dnsmasq.conf.example man/dnsmasq.8 man/es/dnsmasq.8 src/config.h; do
  48. sed -i 's|/var/lib/misc/dnsmasq.leases|/var/lib/dnsmasq/dnsmasq.leases|g' "$file"
  49. done
  50. # fix the path to the trust anchor
  51. sed -i 's|%%%%PREFIX%%%%|%{_prefix}|' dnsmasq.conf.example
  52. #set dnsmasq user / group
  53. sed -i 's|#user=|user=dnsmasq|' dnsmasq.conf.example
  54. sed -i 's|#group=|group=dnsmasq|' dnsmasq.conf.example
  55. #set default user /group in src/config.h
  56. sed -i 's|#define CHUSER "nobody"|#define CHUSER "dnsmasq"|' src/config.h
  57. sed -i 's|#define CHGRP "dip"|#define CHGRP "dnsmasq"|' src/config.h
  58. #enable dbus
  59. sed -i 's|/\* #define HAVE_DBUS \*/|#define HAVE_DBUS|g' src/config.h
  60. #enable libidn2 support
  61. sed -i 's|/\* #define HAVE_LIBIDN2 \*/|#define HAVE_LIBIDN2|g' src/config.h
  62. #enable DNSSEC support
  63. sed -i 's|/\* #define HAVE_DNSSEC \*/|#define HAVE_DNSSEC|g' src/config.h
  64. #enable /etc/dnsmasq.d fix bz 526703, ignore RPM backup files
  65. cat << EOF >> dnsmasq.conf.example
  66. # Include all files in /etc/dnsmasq.d except RPM backup files
  67. conf-dir=%{_sysconfdir}/dnsmasq.d,.rpmnew,.rpmsave,.rpmorig
  68. EOF
  69. %build
  70. make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
  71. make %{?_smp_mflags} -C contrib/lease-tools CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
  72. %install
  73. rm -rf $RPM_BUILD_ROOT
  74. # normally i'd do 'make install'...it's a bit messy, though
  75. mkdir -p $RPM_BUILD_ROOT%{_sbindir} \
  76. $RPM_BUILD_ROOT%{_mandir}/man8 \
  77. $RPM_BUILD_ROOT%{_var}/lib/dnsmasq \
  78. $RPM_BUILD_ROOT%{_sysconfdir}/dnsmasq.d \
  79. $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d
  80. install src/dnsmasq $RPM_BUILD_ROOT%{_sbindir}/dnsmasq
  81. install dnsmasq.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dnsmasq.conf
  82. install dbus/dnsmasq.conf $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d/
  83. install -m 644 man/dnsmasq.8 $RPM_BUILD_ROOT%{_mandir}/man8/
  84. install -D trust-anchors.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/trust-anchors.conf
  85. # utils sub package
  86. mkdir -p $RPM_BUILD_ROOT%{_bindir} \
  87. $RPM_BUILD_ROOT%{_mandir}/man1
  88. install -m 755 contrib/lease-tools/dhcp_release $RPM_BUILD_ROOT%{_bindir}/dhcp_release
  89. install -m 644 contrib/lease-tools/dhcp_release.1 $RPM_BUILD_ROOT%{_mandir}/man1/dhcp_release.1
  90. install -m 755 contrib/lease-tools/dhcp_release6 $RPM_BUILD_ROOT%{_bindir}/dhcp_release6
  91. install -m 644 contrib/lease-tools/dhcp_release6.1 $RPM_BUILD_ROOT%{_mandir}/man1/dhcp_release6.1
  92. install -m 755 contrib/lease-tools/dhcp_lease_time $RPM_BUILD_ROOT%{_bindir}/dhcp_lease_time
  93. install -m 644 contrib/lease-tools/dhcp_lease_time.1 $RPM_BUILD_ROOT%{_mandir}/man1/dhcp_lease_time.1
  94. %if %{with systemd}
  95. # Systemd
  96. mkdir -p %{buildroot}%{_unitdir}
  97. install -m644 %{SOURCE1} %{buildroot}%{_unitdir}
  98. rm -rf %{buildroot}%{_initrddir}
  99. #install systemd sysuser file
  100. install -Dpm 644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf
  101. %else
  102. mkdir -p $RPM_BUILD_ROOT%{_initrddir}
  103. install rpm/dnsmasq.init $RPM_BUILD_ROOT%{_initrddir}/dnsmasq
  104. %endif
  105. %clean
  106. rm -rf $RPM_BUILD_ROOT
  107. %pre
  108. %if %{with systemd}
  109. #precreate users so that rpm can install files owned by that user
  110. %sysusers_create_package %{name} %{SOURCE2}
  111. %else
  112. getent group dnsmasq >/dev/null || groupadd -r dnsmasq
  113. getent passwd dnsmasq >/dev/null || \
  114. useradd -r -g dnsmasq -d /var/lib/dnsmasq -s /sbin/nologin \
  115. -c "Dnsmasq DHCP and DNS server" dnsmasq
  116. exit 0
  117. %endif
  118. %post
  119. %if %{with systemd}
  120. %systemd_post dnsmasq.service
  121. %endif
  122. if [ "$1" = "2" ]; then # if we're being upgraded
  123. # if using the old leases location, move the file to the new one
  124. # but only if we're not clobbering another file
  125. #
  126. if [ -f /var/lib/misc/dnsmasq.leases -a ! -f /var/lib/dnsmasq/dnsmasq.leases ]; then
  127. # causes rpmlint to report dangerous-command-in-post,
  128. # but that's the price of selinux compliance :-(
  129. mv -f /var/lib/misc/dnsmasq.leases /var/lib/dnsmasq/dnsmasq.leases || :
  130. fi
  131. # ugly, but kind of necessary
  132. if [ ! `grep -q dhcp-leasefile=/var/lib/misc/dnsmasq.leases %{_sysconfdir}/dnsmasq.conf` ]; then
  133. cp %{_sysconfdir}/dnsmasq.conf %{_sysconfdir}/dnsmasq.conf.tmp || :
  134. sed -e 's/var\/lib\/misc/var\/lib\/dnsmasq/' < %{_sysconfdir}/dnsmasq.conf.tmp > %{_sysconfdir}/dnsmasq.conf || :
  135. rm -f %{_sysconfdir}/dnsmasq.conf.tmp || :
  136. fi
  137. %if !%{with systemd}
  138. else # if we're being installed
  139. /sbin/chkconfig --add dnsmasq
  140. %endif
  141. fi
  142. %preun
  143. %if %{with systemd}
  144. %systemd_preun dnsmasq.service
  145. %else
  146. if [ "$1" = "0" -o -x /bin/systemctl ]; then # execute this only if we are NOT doing an upgrade
  147. /sbin/service dnsmasq stop >/dev/null 2>&1 || :
  148. /sbin/chkconfig --del dnsmasq
  149. fi
  150. %endif
  151. %postun
  152. %if %{with systemd}
  153. %systemd_postun_with_restart dnsmasq.service
  154. %else
  155. if [ "$1" -gt "0" ]; then
  156. /sbin/service dnsmasq condrestart >/dev/null 2>&1 || :
  157. fi
  158. %endif
  159. %files
  160. %defattr(-,root,root,-)
  161. %license COPYING*
  162. %doc CHANGELOG FAQ doc.html setup.html dbus/DBus-interface
  163. %config(noreplace) %attr(644,root,root) %{_sysconfdir}/dnsmasq.conf
  164. %dir /etc/dnsmasq.d
  165. %dir %{_var}/lib/dnsmasq
  166. %config(noreplace) %attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/dnsmasq.conf
  167. %dir %{_datadir}/dnsmasq
  168. %{_datadir}/dnsmasq/*
  169. %{_sbindir}/dnsmasq
  170. %{_mandir}/man8/dnsmasq*
  171. %if %{with systemd}
  172. %{_unitdir}/%{name}.service
  173. %{_sysusersdir}/dnsmasq.conf
  174. %else
  175. %{_initrddir}/dnsmasq
  176. %endif
  177. %{_bindir}/dhcp_*
  178. %{_mandir}/man1/dhcp_*
  179. %changelog
  180. * Tue Sep 08 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.82-1
  181. - new upstream release.
  182. * Sat May 23 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.81-1
  183. - new upstream release.
  184. - added systemd support (disabled as default).
  185. * Sat Mar 21 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.80-2
  186. - rebuilt with libidn2.
  187. * Sat May 25 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.80-1
  188. - new upstream release.
  189. * Tue Jul 5 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.76-1
  190. - new upstream release.
  191. * Sat Dec 28 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.45-3
  192. - rebuild with VineSeed environment
  193. * Sun Apr 17 2011 Shu KONNO <owa@bg.wakwak.com> 2.45-2
  194. - rebuilt with rpm-4.8.1-3
  195. * Thu Jul 31 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.45-1
  196. - initial build for Vine Linux
  197. * Mon Jul 21 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.45-1
  198. - Upstream release (bugfixes)
  199. * Wed Jul 16 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.43-2
  200. - New upstream release, contains fixes for CVE-2008-1447/CERT VU#800113
  201. - Dropped patch for newer glibc (merged upstream)
  202. * Wed Feb 13 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.8
  203. - Added upstream-authored patch for newer glibc (thanks Simon!)
  204. * Wed Feb 13 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.7
  205. - New upstream release
  206. * Wed Jan 30 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.6.rc1
  207. - Release candidate
  208. - Happy Birthday Isaac!
  209. * Wed Jan 23 2008 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.5.test30
  210. - Bugfix update
  211. * Mon Dec 31 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.4.test26
  212. - Bugfix/feature enhancement update
  213. * Thu Dec 13 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.3.test24
  214. - Upstream fix for fairly serious regression
  215. * Tue Dec 04 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.41-0.2.test20
  216. - New upstream test release
  217. - Moving dnsmasq.leases to /var/lib/dnsmasq/ as per BZ#407901
  218. - Ignoring dangerous-command-in-%%post rpmlint warning (as per above fix)
  219. - Patch consolidation/cleanup
  220. - Removed conditionals for Fedora <= 3 and Aurora 2.0
  221. * Tue Sep 18 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.40-1
  222. - Finalized upstream release
  223. - Removing URLs from patch lines (CVS is the authoritative source)
  224. - Added more magic to make spinning rc/test packages more seamless
  225. * Sun Aug 26 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.40-0.1.rc2
  226. - New upstream release candidate (feature-frozen), thanks Simon!
  227. - License clarification
  228. * Tue May 29 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.39-1
  229. - New upstream version (bugfixes, enhancements)
  230. * Mon Feb 12 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.38-1
  231. - New upstream version with bugfix for potential hang
  232. * Tue Feb 06 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.37-1
  233. - New upstream version
  234. * Wed Jan 24 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.36-1
  235. - New upstream version
  236. * Mon Nov 06 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.35-2
  237. - Stop creating /etc/sysconfig on %%install
  238. - Create /etc/dnsmasq.d on %%install
  239. * Mon Nov 06 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.35-1
  240. - Update to 2.35
  241. - Removed UPGRADING_to_2.0 from %%doc as per upstream change
  242. - Enabled conf-dir in default config as per RFE BZ#214220 (thanks Chris!)
  243. - Added %%dir /etc/dnsmasq.d to %%files as per above RFE
  244. * Tue Oct 24 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.34-2
  245. - Fixed BZ#212005
  246. - Moved %%postun scriptlet to %%post, where it made more sense
  247. - Render scriptlets safer
  248. - Minor cleanup for consistency
  249. * Thu Oct 19 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.34-1
  250. - Hardcoded version in patches, as I'm getting tired of updating them
  251. - Update to 2.34
  252. * Mon Aug 28 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.33-2
  253. - Rebuild for FC6
  254. * Tue Aug 15 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.33-1
  255. - Update
  256. * Sat Jul 22 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.32-3
  257. - Added pkgconfig BuildReq due to reduced buildroot
  258. * Thu Jul 20 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.32-2
  259. - Forced update due to dbus version bump
  260. * Mon Jun 12 2006 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.32-1
  261. - Update from upstream
  262. - Patch from Dennis Gilmore fixed the conditionals to detect Aurora Linux
  263. * Mon May 8 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.31-1
  264. - Removed dbus config patch (now provided upstream)
  265. - Patched in init script (no longer provided upstream)
  266. - Added DBus-interface to docs
  267. * Tue May 2 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-4.2
  268. - More upstream-recommended cleanups :)
  269. - Killed sysconfig file (provides unneeded functionality)
  270. - Tweaked init script a little more
  271. * Tue May 2 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-4
  272. - Moved options out of init script and into /etc/sysconfig/dnsmasq
  273. - Disabled DHCP_LEASE in sysconfig file, fixing bug #190379
  274. - Simon Kelley provided dbus/dnsmasq.conf, soon to be part of the tarball
  275. * Thu Apr 27 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-3
  276. - Un-enabled HAVE_ISC_READER, a hack to enable a deprecated feature (request)
  277. - Split initscript & enable-dbus patches, conditionalized dbus for FC3
  278. - Tweaked name field in changelog entries (trying to be consistent)
  279. * Mon Apr 24 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-2
  280. - Disabled stripping of binary while installing (oops)
  281. - Enabled HAVE_ISC_READER/HAVE_DBUS via patch
  282. - Added BuildReq for dbus-devel
  283. * Mon Apr 24 2006 Patrick "Jima" Laughton <jima@auroralinux.org> 2.30-1
  284. - Initial Fedora Extras RPM