systemd support [release 9.10.2.P2-2mamba;Sat Jul 18 2015]

This commit is contained in:
Silvan Calarco 2024-01-05 20:47:26 +01:00
parent 9526d67dd5
commit 832e8ec368
3 changed files with 30 additions and 99 deletions

View File

@ -7,7 +7,7 @@
Name: bind
Version: 9.10.2.P2
Release: 1mamba
Release: 2mamba
Summary: A DNS (Domain Name System) server
Group: System/Servers
Vendor: openmamba
@ -16,7 +16,7 @@ Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.isc.org/products/BIND/
Source0: ftp://ftp.isc.org/isc/bind9/%{pkgver}/bind-%{pkgver}.tar.gz
Source1: dhcp-dynamic-dns-examples.tar.bz2
Source2: named.init
Source2: named.service
Source3: named.logrotate
Source4: named.sysconfig
Source5: keygen.c
@ -118,7 +118,8 @@ cp contrib/scripts/nanny.pl %{buildroot}%{_sbindir}
#cp contrib/queryperf/queryperf %{buildroot}%{_sbindir}
cp contrib/queryperf/README ./README.queryperf
cp %{S:2} %{buildroot}%{_initrddir}/named
install -D -m0644 %{S:2} %{buildroot}%{_unitdir}/named.service
cp %{S:3} %{buildroot}%{_sysconfdir}/logrotate.d/named
cp %{S:4} %{buildroot}/etc/sysconfig/named
@ -138,6 +139,7 @@ cp %{S:15} %{buildroot}%{_sysconfdir}/rndc.conf
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%pre
if [ $1 -eq 1 ]; then
# new install
@ -158,21 +160,22 @@ key "rndckey" {
};
_EOF
fi
%systemd_post named
if [ $1 -ge 1 ]; then
# clean old sysv broken links
find /etc/rc[0-6].d/ -type l -xtype l -exec rm -f {} \;
systemctl -q daemon-reload
systemctl -q enable named
fi
exit 0
%preun
if [ $1 -eq 0 ]; then
# erase
[ -f /var/run/named/named.pid ] && service named stop
chkconfig --del named
fi
%systemd_preun named
exit 0
%postun
if [ $1 -eq 1 ]; then
# update
[ -f /var/run/named/named.pid ] && service named restart
fi
%systemd_postun_with_restart named
exit 0
%files
@ -210,7 +213,7 @@ exit 0
%{_sbindir}/rndc-confgen
%{_sbindir}/tsig-keygen
%attr(0755,root,root) %{_sbindir}/update_bind.pl
%attr(0755,root,root) %config(noreplace) %{_initrddir}/named
%attr(0755,root,root) %config(noreplace) %{_unitdir}/named.service
%dir %attr(0755,named,named) %{_localstatedir}/named
%dir %attr(0755,named,named) %{_localstatedir}/named/slave
%dir %attr(0755,named,named) %{_localstatedir}/run/named
@ -282,6 +285,9 @@ exit 0
%{_mandir}/man8/nsec3hash.*
%changelog
* Sat Jul 18 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 9.10.2.P2-2mamba
- systemd support
* Tue Jul 07 2015 Automatic Build System <autodist@mambasoft.it> 9.10.2.P2-1mamba
- automatic version update by autodist

View File

@ -1,86 +0,0 @@
#!/bin/bash
#
# named -- This shell script takes care of starting and stopping
# named (BIND DNS server).
#
# chkconfig: 345 30 45
# description: named (BIND) is a Domain Name Server (DNS) \
# that is used to resolve host names to IP addresses.
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
NAME=named
DAEMON=/usr/sbin/$NAME
DAEMONPID=/var/run/$NAME.pid
DAEMONCONF=/etc/named.conf
DAEMONLOG=
OPTIONS=
[ -x $DAEMON ] || exit 0
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
[ -r ${ROOTDIR}${DAEMONCONF} ] || exit 0
RETVAL=0
# See how we were called.
case "$1" in
start)
echo -n $"Starting $NAME: "
if [ -n "$ROOTDIR" -a "x$ROOTDIR" != "x/" ]; then
OPTIONS="$OPTIONS -t $ROOTDIR"
fi
daemon $DAEMON -u named $OPTIONS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME
echo
# perform a query so we are sure service is working
# before the system starts other services
dig > /dev/null
exit $RETVAL
;;
stop)
echo -n $"Stopping $NAME: "
killproc $DAEMON
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$NAME
exit $RETVAL
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
condrestart)
[ -e /var/lock/subsys/$NAME ] && $0 restart
;;
reload)
/usr/sbin/rndc -c $ROOTDIR/etc/rndc.conf reload >/dev/null 2>&1 || \
/usr/bin/killall -HUP $NAME
exit $?
;;
status)
/usr/sbin/rndc -c $ROOTDIR/etc/rndc.conf status
exit $?
;;
probe)
# named knows how to reload intelligently; we don't want linuxconf
# to offer to restart every time
/usr/sbin/rndc -c $ROOTDIR/etc/rndc.conf reload >/dev/null 2>&1 || \
echo start
exit $?
;;
*)
echo $"Usage: ""/etc/init.d/$NAME {start|stop|status|restart|condrestart|reload|probe}"
exit 1
;;
esac

11
named.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Internet domain name server
After=network.target
[Service]
ExecStart=/usr/sbin/named -f -u named
ExecReload=/usr/sbin/rndc reload
ExecStop=/usr/sbin/rndc stop
[Install]
WantedBy=multi-user.target