1###############################################################################
2#
3# General mumbojumbo
4#
5###############################################################################
6
7Name: dnsmasq
8Version: 2.15
9Release: 1
10Copyright: GPL
11Group: System Environment/Daemons
12Vendor: Simon Kelley
13Packager: Simon Kelley
14Distribution: Red Hat Linux
15URL: http://www.thekelleys.org.uk/dnsmasq
16Source0: %{name}-%{version}.tar.gz
17Requires: chkconfig
18BuildRoot: /var/tmp/%{name}-%{version}
19Summary: A lightweight caching nameserver
20
21%description
22Dnsmasq is lightweight, easy to configure DNS forwarder and DHCP server. It 
23is designed to provide DNS and, optionally, DHCP, to a small network. It can
24serve the names of local machines which are not in the global DNS. The DHCP 
25server integrates with the DNS server and allows machines with DHCP-allocated
26addresses to appear in the DNS with names configured either in each host or 
27in a central configuration file. Dnsmasq supports static and dynamic DHCP 
28leases and BOOTP for network booting of diskless machines.
29
30
31
32###############################################################################
33#
34# Build
35#
36###############################################################################
37
38%prep
39%setup -q
40%build
41make
42
43
44###############################################################################
45#
46# Install
47#
48###############################################################################
49
50%install
51rm -rf $RPM_BUILD_ROOT
52
53mkdir -p -m 755 $RPM_BUILD_ROOT/usr/sbin
54mkdir -p -m 755 $RPM_BUILD_ROOT/etc/rc.d/init.d
55mkdir -p -m 755 $RPM_BUILD_ROOT/usr/share/man/man8
56
57cp rpm/dnsmasq.rh $RPM_BUILD_ROOT/etc/rc.d/init.d/dnsmasq
58strip src/dnsmasq
59cp src/dnsmasq $RPM_BUILD_ROOT/usr/sbin
60cp dnsmasq.8 $RPM_BUILD_ROOT/usr/share/man/man8
61cp dnsmasq.conf.example $RPM_BUILD_ROOT/etc/dnsmasq.conf
62
63###############################################################################
64#
65# Clean up
66#
67###############################################################################
68
69%clean
70rm -rf $RPM_BUILD_ROOT
71
72
73###############################################################################
74#
75# Post-install scriptlet
76#
77###############################################################################
78
79%post
80/sbin/chkconfig --add dnsmasq
81
82
83###############################################################################
84#
85# Pre-uninstall scriptlet
86#
87# If there's a time when your package needs to have one last look around before
88# the user erases it, the place to do it is in the %preun script. Anything that
89# a package needs to do immediately prior to RPM taking any action to erase the
90# package, can be done here.
91#
92###############################################################################
93
94%preun
95if [ $1 = 0 ]; then     # execute this only if we are NOT doing an upgrade
96    service dnsmasq stop >/dev/null 2>&1
97    /sbin/chkconfig --del dnsmasq
98fi
99
100
101###############################################################################
102#
103# Post-uninstall scriptlet
104#
105# The %postun script executes after the package has been removed. It is the
106# last chance for a package to clean up after itself.
107#
108###############################################################################
109
110%postun
111if [ "$1" -ge "1" ]; then
112    service dnsmasq restart >/dev/null 2>&1
113fi
114
115
116###############################################################################
117#
118# File list
119#
120###############################################################################
121
122%files
123%defattr(-,root,root)
124%doc CHANGELOG COPYING FAQ doc.html setup.html UPGRADING_to_2.0
125%config /etc/rc.d/init.d/dnsmasq 
126%config /etc/dnsmasq.conf
127%attr(0755,root,root) /etc/rc.d/init.d/dnsmasq
128%attr(0664,root,root) /etc/dnsmasq.conf
129%attr(0755,root,root) /usr/sbin/dnsmasq
130%attr(0644,root,root) /usr/share/man/man8/dnsmasq*
131
132
133