some improvement in dnsmasq initscript
This commit is contained in:
parent
8b0560dcd4
commit
80a7583e23
@ -1,79 +0,0 @@
|
||||
diff -urN dnsmasq-2.33/rpm/dnsmasq.init dnsmasq-2.33-patched/rpm/dnsmasq.init
|
||||
--- dnsmasq-2.33/rpm/dnsmasq.init 1969-12-31 18:00:00.000000000 -0600
|
||||
+++ dnsmasq-2.33-patched/rpm/dnsmasq.init 2006-08-15 15:12:17.000000000 -0500
|
||||
@@ -0,0 +1,75 @@
|
||||
+#!/bin/sh
|
||||
+#
|
||||
+# Startup script for the DNS caching server
|
||||
+#
|
||||
+# chkconfig: - 49 50
|
||||
+# description: This script starts your DNS caching server
|
||||
+# processname: dnsmasq
|
||||
+# pidfile: /var/run/dnsmasq.pid
|
||||
+
|
||||
+# Source function library.
|
||||
+. /etc/rc.d/init.d/functions
|
||||
+
|
||||
+# Source networking configuration.
|
||||
+. /etc/sysconfig/network
|
||||
+
|
||||
+# Check that networking is up.
|
||||
+[ ${NETWORKING} = "no" ] && exit 0
|
||||
+
|
||||
+dnsmasq=/usr/sbin/dnsmasq
|
||||
+[ -f $dnsmasq ] || exit 0
|
||||
+
|
||||
+DOMAIN_SUFFIX=`dnsdomainname`
|
||||
+if [ ! -z "${DOMAIN_SUFFIX}" ]; then
|
||||
+ OPTIONS="-s $DOMAIN_SUFFIX"
|
||||
+fi
|
||||
+
|
||||
+RETVAL=0
|
||||
+
|
||||
+# See how we were called.
|
||||
+case "$1" in
|
||||
+ start)
|
||||
+ echo -n "Starting dnsmasq: "
|
||||
+ daemon $dnsmasq $OPTIONS
|
||||
+ RETVAL=$?
|
||||
+ echo
|
||||
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dnsmasq
|
||||
+ ;;
|
||||
+ stop)
|
||||
+ if test "x`pidof dnsmasq`" != x; then
|
||||
+ echo -n "Shutting down dnsmasq: "
|
||||
+ killproc dnsmasq
|
||||
+ fi
|
||||
+ RETVAL=$?
|
||||
+ echo
|
||||
+ [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dnsmasq /var/run/dnsmasq.pid
|
||||
+ ;;
|
||||
+ status)
|
||||
+ status dnsmasq
|
||||
+ RETVAL=$?
|
||||
+ ;;
|
||||
+ reload)
|
||||
+ echo -n "Reloading dnsmasq: "
|
||||
+ killproc dnsmasq -HUP
|
||||
+ RETVAL=$?
|
||||
+ echo
|
||||
+ ;;
|
||||
+ restart)
|
||||
+ $0 stop
|
||||
+ $0 start
|
||||
+ RETVAL=$?
|
||||
+ ;;
|
||||
+ condrestart)
|
||||
+ if test "x`/sbin/pidof dnsmasq`" != x; then
|
||||
+ $0 stop
|
||||
+ $0 start
|
||||
+ RETVAL=$?
|
||||
+ fi
|
||||
+ ;;
|
||||
+ *)
|
||||
+ echo "Usage: $0 {start|stop|restart|reload|condrestart|status}"
|
||||
+ exit 1
|
||||
+esac
|
||||
+
|
||||
+exit $RETVAL
|
||||
+
|
@ -1,57 +0,0 @@
|
||||
diff -up dnsmasq-2.48/dnsmasq.conf.example.orig dnsmasq-2.48/dnsmasq.conf.example
|
||||
--- dnsmasq-2.48/dnsmasq.conf.example.orig 2009-04-04 06:39:29.000000000 -0500
|
||||
+++ dnsmasq-2.48/dnsmasq.conf.example 2009-06-10 07:13:33.000000000 -0500
|
||||
@@ -410,7 +410,7 @@
|
||||
# The DHCP server needs somewhere on disk to keep its lease database.
|
||||
# This defaults to a sane location, but if you want to change it, use
|
||||
# the line below.
|
||||
-#dhcp-leasefile=/var/lib/misc/dnsmasq.leases
|
||||
+#dhcp-leasefile=/var/lib/dnsmasq/dnsmasq.leases
|
||||
|
||||
# Set the DHCP server to authoritative mode. In this mode it will barge in
|
||||
# and take over the lease for any client which broadcasts on the network,
|
||||
diff -up dnsmasq-2.48/man/dnsmasq.8.orig dnsmasq-2.48/man/dnsmasq.8
|
||||
--- dnsmasq-2.48/man/dnsmasq.8.orig 2009-06-03 15:58:30.000000000 -0500
|
||||
+++ dnsmasq-2.48/man/dnsmasq.8 2009-06-10 07:13:33.000000000 -0500
|
||||
@@ -1249,7 +1249,7 @@ file needs a 1GHz processor and about 60
|
||||
|
||||
.IR /etc/ethers
|
||||
|
||||
-.IR /var/lib/misc/dnsmasq.leases
|
||||
+.IR /var/lib/dnsmasq/dnsmasq.leases
|
||||
|
||||
.IR /var/db/dnsmasq.leases
|
||||
|
||||
diff -up dnsmasq-2.48/man/es/dnsmasq.8.orig dnsmasq-2.48/man/es/dnsmasq.8
|
||||
--- dnsmasq-2.48/man/es/dnsmasq.8.orig 2009-03-14 17:28:26.000000000 -0500
|
||||
+++ dnsmasq-2.48/man/es/dnsmasq.8 2009-06-10 07:13:33.000000000 -0500
|
||||
@@ -1222,7 +1222,7 @@ un CPU de 1GHz y aproximadamente 60MB de
|
||||
|
||||
.IR /etc/ethers
|
||||
|
||||
-.IR /var/lib/misc/dnsmasq.leases
|
||||
+.IR /var/lib/dnsmasq/dnsmasq.leases
|
||||
|
||||
.IR /var/db/dnsmasq.leases
|
||||
|
||||
diff -up dnsmasq-2.48/src/config.h.orig dnsmasq-2.48/src/config.h
|
||||
--- dnsmasq-2.48/src/config.h.orig 2009-05-29 04:23:48.000000000 -0500
|
||||
+++ dnsmasq-2.48/src/config.h 2009-06-10 07:13:21.000000000 -0500
|
||||
@@ -45,7 +45,7 @@
|
||||
# elif defined(__sun__) || defined (__sun)
|
||||
# define LEASEFILE "/var/cache/dnsmasq.leases"
|
||||
# else
|
||||
-# define LEASEFILE "/var/lib/misc/dnsmasq.leases"
|
||||
+# define LEASEFILE "/var/lib/dnsmasq/dnsmasq.leases"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -163,7 +163,7 @@ NOTES:
|
||||
#define HAVE_DHCP
|
||||
#define HAVE_TFTP
|
||||
/* #define HAVE_BROKEN_RTC */
|
||||
-/* #define HAVE_DBUS */
|
||||
+#define HAVE_DBUS
|
||||
|
||||
/* Allow TFTP to be disabled with COPTS=-DNO_TFTP */
|
||||
#ifdef NO_TFTP
|
75
dnsmasq.init
Normal file
75
dnsmasq.init
Normal file
@ -0,0 +1,75 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Startup script for the DNS caching server
|
||||
#
|
||||
# chkconfig: - 49 50
|
||||
# description: This script starts your DNS caching server
|
||||
# processname: dnsmasq
|
||||
# pidfile: /var/run/dnsmasq.pid
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# Source networking configuration.
|
||||
. /etc/sysconfig/network
|
||||
|
||||
# Check that networking is up.
|
||||
[ ${NETWORKING} = "no" ] && exit 0
|
||||
|
||||
dnsmasq=/usr/sbin/dnsmasq
|
||||
[ -f $dnsmasq ] || exit 0
|
||||
|
||||
DOMAIN_SUFFIX=`dnsdomainname`
|
||||
if [ ! -z "${DOMAIN_SUFFIX}" ]; then
|
||||
OPTIONS="-s $DOMAIN_SUFFIX"
|
||||
fi
|
||||
|
||||
RETVAL=0
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting dnsmasq: "
|
||||
daemon $dnsmasq $OPTIONS
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dnsmasq
|
||||
;;
|
||||
stop)
|
||||
if test "x`pidof dnsmasq`" != x; then
|
||||
echo -n "Shutting down dnsmasq: "
|
||||
killproc dnsmasq
|
||||
fi
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dnsmasq /var/run/dnsmasq.pid
|
||||
;;
|
||||
status)
|
||||
status dnsmasq
|
||||
RETVAL=$?
|
||||
;;
|
||||
reload)
|
||||
echo -n "Reloading dnsmasq: "
|
||||
killproc dnsmasq -HUP
|
||||
RETVAL=$?
|
||||
echo
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
RETVAL=$?
|
||||
;;
|
||||
condrestart)
|
||||
if test "x`/sbin/pidof dnsmasq`" != x; then
|
||||
$0 stop
|
||||
$0 start
|
||||
RETVAL=$?
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload|condrestart|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
|
39
dnsmasq.spec
39
dnsmasq.spec
@ -11,26 +11,25 @@
|
||||
|
||||
Name: dnsmasq
|
||||
Version: 2.48
|
||||
Release: 4%{?extraversion}%{?dist}
|
||||
Release: 5%{?extraversion}%{?dist}
|
||||
Summary: A lightweight DHCP/caching DNS server
|
||||
|
||||
Group: System Environment/Daemons
|
||||
License: GPLv2 or GPLv3
|
||||
URL: http://www.thekelleys.org.uk/dnsmasq/
|
||||
Source0: http://www.thekelleys.org.uk/dnsmasq/%{?extrapath}%{name}-%{version}%{?extraversion}.tar.lzma
|
||||
Patch0: %{name}-2.33-initscript.patch
|
||||
Patch1: %{name}-configuration.patch
|
||||
Source1: %{name}.init
|
||||
Patch2: %{name}-2.48-tftp-server-vulnerabilities.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildRequires: dbus-devel
|
||||
BuildRequires: pkgconfig
|
||||
|
||||
Requires(post): /sbin/chkconfig
|
||||
Requires(post): /sbin/service
|
||||
Requires(post): /bin/sed /bin/grep
|
||||
Requires(preun): /sbin/chkconfig
|
||||
Requires(preun): /sbin/service
|
||||
Requires(post): chkconfig
|
||||
Requires(preun): chkconfig
|
||||
# This is for /sbin/service
|
||||
Requires(preun): initscripts
|
||||
Requires(post): initscripts
|
||||
|
||||
%description
|
||||
Dnsmasq is lightweight, easy to configure DNS forwarder and DHCP server.
|
||||
@ -45,8 +44,18 @@ machines.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}%{?extraversion}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
# use /var/lib/dnsmasq instead of /var/lib/misc
|
||||
for file in dnsmasq.conf.example man/dnsmasq.8 man/es/dnsmasq.8 src/config.h; do
|
||||
sed -i 's|/var/lib/misc/dnsmasq.leases|/var/lib/dnsmasq/dnsmasq.leases|g' "$file"
|
||||
done
|
||||
|
||||
#enable dbus
|
||||
sed -i 's|/* #define HAVE_DBUS */|#define HAVE_DBUS|g' src/config.h
|
||||
|
||||
#enable /etc/dnsmasq.d fix bz 526703
|
||||
sed -i 's|#conf-dir=/etc/dnsmasq.d|conf-dir=/etc/dnsmasq.d|g' dnsmasq.conf.example
|
||||
|
||||
%patch2 -p1
|
||||
|
||||
%build
|
||||
@ -56,7 +65,7 @@ make %{?_smp_mflags}
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
# normally i'd do 'make install'...it's a bit messy, though
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sbindir} $RPM_BUILD_ROOT%{_initrddir} \
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sbindir} \
|
||||
$RPM_BUILD_ROOT%{_mandir}/man8 \
|
||||
$RPM_BUILD_ROOT%{_var}/lib/dnsmasq \
|
||||
$RPM_BUILD_ROOT%{_sysconfdir}/dnsmasq.d \
|
||||
@ -64,7 +73,7 @@ mkdir -p $RPM_BUILD_ROOT%{_sbindir} $RPM_BUILD_ROOT%{_initrddir} \
|
||||
install src/dnsmasq $RPM_BUILD_ROOT%{_sbindir}/dnsmasq
|
||||
install dnsmasq.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dnsmasq.conf
|
||||
install dbus/dnsmasq.conf $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d/
|
||||
install rpm/dnsmasq.init $RPM_BUILD_ROOT%{_initrddir}/dnsmasq
|
||||
install -Dp -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/dnsmasq
|
||||
install -m 644 man/dnsmasq.8 $RPM_BUILD_ROOT%{_mandir}/man8/
|
||||
|
||||
%clean
|
||||
@ -111,6 +120,12 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Sat Oct 17 2009 Itamar Reis Peixoto <itamar@ispbrasil.com.br> - 2.48-5
|
||||
- move initscript from patch to a plain text file
|
||||
- drop (dnsmasq-configuration.patch) and use sed instead
|
||||
- enable /etc/dnsmasq.d fix bz 526703
|
||||
- change requires to package name instead of file
|
||||
|
||||
* Mon Oct 5 2009 Mark McLoughlin <markmc@redhat.com> - 2.48-4
|
||||
- Fix multiple TFTP server vulnerabilities (CVE-2009-2957, CVE-2009-2958)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user