1###############################################################################
2#
3# General mumbojumbo
4#
5###############################################################################
6
7Name: dnsmasq
8Version: 1.10
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 designed to provide DNS (domain name) services to a small network where using BIND would be overkill. It can be have its DNS servers automatically configured by PPP or DHCP, and it can serve the names of local machines which are not in the global DNS. It is ideal for networks behind NAT routers and connected via modem, ISDN, ADSL, or cable-modem connections. 
23
24
25###############################################################################
26#
27# Build
28#
29###############################################################################
30
31%prep
32%setup -q
33%build
34make
35
36
37###############################################################################
38#
39# Install
40#
41###############################################################################
42
43%install
44rm -rf $RPM_BUILD_ROOT
45
46mkdir -p -m 755 $RPM_BUILD_ROOT/usr/sbin
47mkdir -p -m 755 $RPM_BUILD_ROOT/etc/rc.d/init.d
48mkdir -p -m 755 $RPM_BUILD_ROOT/usr/share/man/man8
49
50cp dnsmasq.rh $RPM_BUILD_ROOT/etc/rc.d/init.d/dnsmasq
51strip dnsmasq
52cp dnsmasq $RPM_BUILD_ROOT/usr/sbin
53cp dnsmasq.8 $RPM_BUILD_ROOT/usr/share/man/man8
54gzip $RPM_BUILD_ROOT/usr/share/man/man8/dnsmasq.8
55
56###############################################################################
57#
58# Clean up
59#
60###############################################################################
61
62%clean
63rm -rf $RPM_BUILD_ROOT
64
65
66###############################################################################
67#
68# Post-install scriptlet
69#
70###############################################################################
71
72%post
73/sbin/chkconfig --add dnsmasq
74
75
76###############################################################################
77#
78# Pre-uninstall scriptlet
79#
80# If there's a time when your package needs to have one last look around before
81# the user erases it, the place to do it is in the %preun script. Anything that
82# a package needs to do immediately prior to RPM taking any action to erase the
83# package, can be done here.
84#
85###############################################################################
86
87%preun
88if [ $1 = 0 ]; then     # execute this only if we are NOT doing an upgrade
89    service dnsmasq stop >/dev/null 2>&1
90    /sbin/chkconfig --del dnsmasq
91fi
92
93
94###############################################################################
95#
96# Post-uninstall scriptlet
97#
98# The %postun script executes after the package has been removed. It is the
99# last chance for a package to clean up after itself.
100#
101###############################################################################
102
103%postun
104if [ "$1" -ge "1" ]; then
105    service dnsmasq restart >/dev/null 2>&1
106fi
107
108
109###############################################################################
110#
111# File list
112#
113###############################################################################
114
115%files
116%defattr(-,root,root)
117%doc CHANGELOG COPYING doc.html setup.html
118%attr(0755,root,root) /etc/rc.d/init.d/dnsmasq
119%attr(0755,root,root) /usr/sbin/dnsmasq
120%attr(0644,root,root) /usr/share/man/man8/dnsmasq.8.gz
121
122
123