]> git.pld-linux.org Git - packages/dnsmasq.git/commitdiff
- added systemd service auto/th/dnsmasq-2.68-2
authorJan Rękorajski <baggins@pld-linux.org>
Sun, 29 Dec 2013 18:33:02 +0000 (19:33 +0100)
committerJan Rękorajski <baggins@pld-linux.org>
Sun, 29 Dec 2013 18:33:02 +0000 (19:33 +0100)
- rel 2

dnsmasq.config [deleted file]
dnsmasq.service [new file with mode: 0644]
dnsmasq.spec
dnsmasq.sysconfig [new file with mode: 0644]

diff --git a/dnsmasq.config b/dnsmasq.config
deleted file mode 100644 (file)
index e6d59bc..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# configuration for dnsmasq
-
-# you can specify options for dnsmasq here
-OPTIONS=""
-
-# listen on interface
-INTERFACE=""
-
-# change this line if you want dnsmasq to serve an MX record for 
-# the host it is running on. 
-MAILHOSTNAME=""
-
-# change this line if you want dns to get its upstream servers from
-# somewhere other that /etc/resolv.conf 
-RESOLV_CONF=""
-
-# change this if you want dnsmasq to cache any "hostname" or "client-hostname" from
-# a dhcpd's lease file
-DHCP_LEASE="/var/lib/misc/dhcpd.leases"
-
-DOMAIN_SUFFIX=`dnsdomainname`
diff --git a/dnsmasq.service b/dnsmasq.service
new file mode 100644 (file)
index 0000000..555f273
--- /dev/null
@@ -0,0 +1,9 @@
+[Unit]
+Description=DNS caching server.
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/dnsmasq -k $OPTIONS
+
+[Install]
+WantedBy=multi-user.target
index 4238a4ec4342c3627dc85651a211f5fe882db2f5..26873882bf8de739bf21f07de83b5f48596dd1e8 100644 (file)
@@ -5,20 +5,23 @@ Summary:      A lightweight caching server (DNS, DHCP)
 Summary(pl.UTF-8):     Lekki buforujący serwer nazw (DNS) i DHCP
 Name:          dnsmasq
 Version:       2.68
-Release:       1
+Release:       2
 License:       GPL v2
 Group:         Networking/Daemons
 #Source0:      http://thekelleys.org.uk/dnsmasq/test-releases/%{name}-%{version}%{_rc}.tar.gz
 Source0:       http://thekelleys.org.uk/dnsmasq/%{name}-%{version}.tar.gz
 # Source0-md5: 6f8351ca0901f248efdb81532778d2ef
 Source1:       %{name}.init
-Source2:       %{name}.config
+Source2:       %{name}.sysconfig
+Source3:       %{name}.service
 URL:           http://www.thekelleys.org.uk/dnsmasq/doc.html
 BuildRequires: gettext-devel
 BuildRequires: libidn-devel
 BuildRequires: pkgconfig
-BuildRequires: rpmbuild(macros) >= 1.268
+BuildRequires: rpmbuild(macros) >= 1.671
 Requires(post,preun):  /sbin/chkconfig
+Requires(post,preun,postun):   systemd-units >= 38
+Requires:      systemd-units >= 38
 Requires:      rc-scripts
 Provides:      caching-nameserver
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -65,7 +68,8 @@ małe wykorzystanie zasobów i łatwa konfiguracja.
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_sbindir},/etc/sysconfig,/etc/rc.d/init.d,%{_mandir}/man8}
+install -d $RPM_BUILD_ROOT{%{_sbindir},/etc/sysconfig,/etc/rc.d/init.d} \
+       $RPM_BUILD_ROOT{%{systemdunitdir},%{_mandir}/man8}
 
 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dnsmasq
 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/dnsmasq
@@ -74,6 +78,8 @@ install dnsmasq.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dnsmasq.conf
 install contrib/port-forward/dnsmasq-portforward $RPM_BUILD_ROOT%{_sbindir}
 install contrib/port-forward/portforward $RPM_BUILD_ROOT%{_sysconfdir}
 
+install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/dnsmasq.service
+
 %{__make} install-i18n \
        DESTDIR=$RPM_BUILD_ROOT \
        PREFIX=%{_prefix}
@@ -88,17 +94,41 @@ rm -rf $RPM_BUILD_ROOT
 %post
 /sbin/chkconfig --add dnsmasq
 %service dnsmasq restart
+%systemd_post dnsmasq.service
 
 %preun
 if [ "$1" = "0" ]; then
        %service dnsmasq stop
        /sbin/chkconfig --del dnsmasq
 fi
+%systemd_preun dnsmasq.service
+
+%postun
+%systemd_reload
+
+%triggerpostun -- dnsmasq < 2.68-1.1
+if [ -f /etc/sysconfig/dnsmasq ]; then
+       __OPT=
+       . /etc/sysconfig/dnsmasq
+       [ -n "$MAILHOSTNAME" ] &&  __OPT="-m $MAILHOSTNAME"
+       [ -n "$RESOLV_CONF" ] && __OPT="$__OPT -r $RESOLV_CONF"
+       [ -n "$DHCP_LEASE" ] && __OPT="$__OPT -l $DHCP_LEASE"
+       [ -n "$DOMAIN_SUFFIX" ] && __OPT="$__OPT -s $DOMAIN_SUFFIX"
+       [ -n "$INTERFACE" ] && __OPT="$__OPT -i $INTERFACE"
+       if [ -n "$__OPT" ]; then
+               %{__cp} -f /etc/sysconfig/dnsmasq{,.rpmsave}
+               echo >>/etc/sysconfig/dnsmasq
+               echo "# Added by rpm trigger" >>/etc/sysconfig/dnsmasq
+               echo "OPTIONS=\"$OPTIONS $__OPT\"" >>/etc/sysconfig/dnsmasq
+       fi
+fi
+%systemd_trigger dnsmasq.service
 
 %files -f %{name}.lang
 %defattr(644,root,root,755)
 %doc CHANGELOG FAQ *.html contrib/{dnslist,dynamic-dnsmasq}
 %attr(754,root,root) /etc/rc.d/init.d/dnsmasq
+%{systemdunitdir}/dnsmasq.service
 %attr(755,root,root) %{_sbindir}/dnsmasq*
 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dnsmasq
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dnsmasq.conf
diff --git a/dnsmasq.sysconfig b/dnsmasq.sysconfig
new file mode 100644 (file)
index 0000000..62b37b4
--- /dev/null
@@ -0,0 +1,7 @@
+# configuration for dnsmasq
+
+# you can specify options for dnsmasq here
+
+# change '-l /var/lib/misc/dhcpd.leases' option if you want dnsmasq to cache any
+# "hostname" or "client-hostname" from a dhcpd's lease file
+OPTIONS="-l /var/lib/misc/dhcpd.leases"
This page took 0.098712 seconds and 4 git commands to generate.