Commit f4707ae4 authored by Michał Kępień's avatar Michał Kępień
Browse files

Drop CentOS 6 support

parent ddb6ba6e
......@@ -40,23 +40,12 @@
##### Conditionally enabled features
%bcond_without dnstap
%bcond_with tuninglarge
%if %{MINOR_VERSION} <= 16
%if 0%{?rhel} >= 7 || 0%{?fedora} >= 14
%bcond_without python
%else
%bcond_with python
%endif
%endif
%if 0%{?rhel} >= 7 || 0%{?fedora} >= 15
%bcond_without systemd
%else
%bcond_with systemd
%endif
%bcond_with tuninglarge
##### Package metadata
# 'bind' package
......@@ -73,6 +62,9 @@ BuildRequires: libxml2-devel
BuildRequires: libxslt
BuildRequires: openssl-devel
BuildRequires: perl
BuildRequires: systemd
%{?systemd_requires}
%if %{MINOR_VERSION} <= 16 && %{with python}
BuildRequires: %{python_version}
BuildRequires: %{python_version}-rpm-macros
......@@ -86,11 +78,7 @@ Requires: %{name}-libs = %{PACKAGE_VERSION}
%{?!scl:Conflicts: bind}
%if %{MINOR_VERSION} >= 16
%if 0%{?rhel} >= 7 || 0%{?fedora} >= 14
BuildRequires: python3
%else
BuildRequires: python34
%endif
BuildRequires: libcap-devel
BuildRequires: %{?scl_prefix}libuv-devel
Requires: %{?scl_prefix}libuv
......@@ -108,20 +96,14 @@ Requires: %{?scl_prefix}fstrm
Requires: %{?scl_prefix}protobuf-c
%endif
%if %{with systemd}
BuildRequires: systemd
%{?systemd_requires}
%endif
%{?scl:BuildRequires: %{scl}-build}
%{?scl:BuildRequires: %scl_runtime}
%{?scl:Requires: %scl_runtime}
Source0: https://ftp.isc.org/isc/bind9/%{UPSTREAM_VERSION}/bind-%{UPSTREAM_VERSION}.tar.%{TARBALL_FORMAT}
Source1: named.service.in
Source2: named.init.in
Source3: named.sysconfig
Source4: named.conf.in
Source2: named.sysconfig
Source3: named.conf.in
%description
BIND (Berkeley Internet Name Domain) is an implementation of the DNS
......@@ -260,30 +242,23 @@ rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la
rm -f ${RPM_BUILD_ROOT}%{_libdir}/*/*.la
rm -rf ${RPM_BUILD_ROOT}%{_builddir}/
# systemd unit file / init script
%if %{with systemd}
# systemd unit file
install -d ${RPM_BUILD_ROOT}%{_unitdir}
%replace_tokens %{SOURCE1} > ${RPM_BUILD_ROOT}%{_unitdir}/%{service_name}.service
%else
install -d ${RPM_BUILD_ROOT}%{?scl:%_root_initddir}%{!?scl:%_initddir}
%replace_tokens %{SOURCE2} > ${RPM_BUILD_ROOT}%{?scl:%_root_initddir}%{!?scl:%_initddir}/%{service_name}
%endif
# /etc files
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
install %{SOURCE3} ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/named
%replace_tokens %{SOURCE4} > ${RPM_BUILD_ROOT}%{_sysconfdir}/named.conf
install %{SOURCE2} ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/named
%replace_tokens %{SOURCE3} > ${RPM_BUILD_ROOT}%{_sysconfdir}/named.conf
touch ${RPM_BUILD_ROOT}%{_sysconfdir}/rndc.key
# /var directories
install -d ${RPM_BUILD_ROOT}%{_localstatedir}/named/data
install -d ${RPM_BUILD_ROOT}%{_localstatedir}/run/named
%if %{with systemd}
# tmpfiles.d entry required to recreate /run/named on reboot (/tmp is a tmpfs)
install -d ${RPM_BUILD_ROOT}%{_tmpfilesdir}
echo "d %{_localstatedir}/run/named 0770 named named -" > ${RPM_BUILD_ROOT}%{_tmpfilesdir}/%{service_name}.conf
%endif
%files
%defattr(-,root,root,-)
......@@ -324,11 +299,7 @@ echo "d %{_localstatedir}/run/named 0770 named named -" > ${RPM_BUILD_ROOT}%{_tm
%{?_scl_root}%{python_version_sitelib}/*
%endif
%if %{with systemd}
%attr(0644,root,root) %{_unitdir}/%{service_name}.service
%else
%attr(0755,root,root) %{?scl:%_root_initddir}%{!?scl:%_initddir}/%{service_name}
%endif
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/named
......@@ -339,13 +310,8 @@ echo "d %{_localstatedir}/run/named 0770 named named -" > ${RPM_BUILD_ROOT}%{_tm
%defattr(0660, named, named, 0770)
%dir %{_localstatedir}/named/data
%if %{with systemd}
%defattr(-,root,root,-)
%{_tmpfilesdir}/%{service_name}.conf
%else
%defattr(0660, named, named, 0770)
%dir %{_localstatedir}/run/named
%endif
# 'bind-devel' package
......@@ -406,18 +372,11 @@ if [ "$1" -eq 1 ]; then
fi
%post
%if %{with systemd}
%systemd_post %{service_name}.service
if [ "$1" -eq 1 ]; then
# Initial installation, not upgrade
%tmpfiles_create %{service_name}.conf
fi
%else
if [ "$1" -eq 1 ]; then
# Initial installation, not upgrade
chkconfig --add %{service_name}
fi
%endif
%if %{MINOR_VERSION} >= 16
%global RNDC_CONFGEN_CMD %{_sbindir}/rndc-confgen -a
......@@ -437,30 +396,13 @@ if [ "$1" -eq 1 ]; then
fi
%preun
%if %{with systemd}
%systemd_preun %{service_name}.service
%else
if [ "$1" -eq 0 ]; then
# Package removal, not upgrade
service %{service_name} stop > /dev/null 2>&1 || true
chkconfig --del %{service_name} || true
fi
%endif
%postun
%if %{with systemd}
%if 0%{?rhel} >= 8 || 0%{?fedora} >= 24
systemctl daemon-reload >/dev/null 2>&1 || :
%endif
%systemd_postun_with_restart %{service_name}.service
%else
if [ "$1" -eq 1 ]; then
# Upgrade, not removal
if service %{service_name} status > /dev/null 2>&1; then
service %{service_name} restart > /dev/null 2>&1 || true
fi
fi
%endif
# 'bind-libs' package
......
#!/bin/bash
#
# chkconfig: - 13 87
# description: Versatile, Classic, Complete Name Server Software
# processname: named
# config: @SYSCONFDIR@/named.conf
# pidfile: @LOCALSTATEDIR@/run/named/named.pid
. /etc/rc.d/init.d/functions
[ -r @SYSCONFDIR@/sysconfig/named ] && . @SYSCONFDIR@/sysconfig/named
PIDFILE="@LOCALSTATEDIR@/run/named/named.pid"
RETVAL=0
start() {
echo -n "Starting named: "
if pidofproc -p ${PIDFILE} named > /dev/null; then
echo "already running"
return 0
fi
@SCL_ROOT@/usr/sbin/named -u named ${OPTIONS} && success || failure
RETVAL=$?
echo
return ${RETVAL}
}
stop() {
echo -n "Stopping named: "
killproc -p ${PIDFILE} -d 30 named
RETVAL=$?
echo
return ${RETVAL}
}
reload() {
echo -n "Reloading named: "
killproc -p ${PIDFILE} named -HUP
RETVAL=$?
echo
return ${RETVAL}
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
reload)
reload
;;
status)
status -p ${PIDFILE} named
;;
*)
echo "Usage: named {start|stop|restart|reload|status}"
;;
esac
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment