[yadifa] yadifa: initial import (#1123689)

Denis Fateyev dfateyev at fedoraproject.org
Fri Aug 29 20:47:24 UTC 2014


commit ac0a64bf9ed82528476fb0fd8db2d7a878c77038
Author: Denis Fateyev <denis at fateyev.com>
Date:   Sat Aug 30 02:47:18 2014 +0600

    yadifa: initial import (#1123689)

 .gitignore       |    1 +
 sources          |    1 +
 yadifa.logrotate |   15 ++++
 yadifa.spec      |  210 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 yadifad.init     |  109 ++++++++++++++++++++++++++++
 yadifad.service  |   12 +++
 6 files changed, 348 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..e872e49 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/yadifa-1.0.3-2880.tar.gz
diff --git a/sources b/sources
index e69de29..5a3680a 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+ef4b0d8bd605de9c84152440fe771f16  yadifa-1.0.3-2880.tar.gz
diff --git a/yadifa.logrotate b/yadifa.logrotate
new file mode 100644
index 0000000..3f2d4ff
--- /dev/null
+++ b/yadifa.logrotate
@@ -0,0 +1,15 @@
+/var/log/yadifa/*log {
+    daily
+    rotate 10
+    compress
+    missingok
+    notifempty
+    sharedscripts
+    postrotate
+        if [ -f "/usr/sbin/service" ]; then
+            /usr/sbin/service yadifad reload > /dev/null 2>/dev/null || true
+        else
+            /sbin/service yadifad reload > /dev/null 2>/dev/null || true
+        fi
+    endscript
+}
diff --git a/yadifa.spec b/yadifa.spec
new file mode 100644
index 0000000..72bf1ce
--- /dev/null
+++ b/yadifa.spec
@@ -0,0 +1,210 @@
+
+%global _hardened_build	1
+
+# version revision
+%global revision	2880
+
+%if 0%{?rhel} >= 7
+%global _with_systemd	1
+%endif
+%if 0%{?fedora}
+%global _with_systemd	1
+%endif
+
+Name:		yadifa
+Version:	1.0.3
+Release:	2%{?dist}
+Summary:	Lightweight authoritative Name Server with DNSSEC capabilities
+
+Group:		System Environment/Daemons
+License:	GPLv2
+URL:		http://www.yadifa.eu
+Source0:	http://cdn.yadifa.eu/sites/default/files/releases/%{name}-%{version}-%{revision}.tar.gz
+Source1:	yadifad.service
+Source2:	yadifad.init
+Source3:	yadifa.logrotate
+
+%{?el5:BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)}
+
+BuildRequires:	openssl-devel
+Requires:	yadifa-libs = %{version}-%{release}
+
+%if 0%{?_with_systemd}
+Requires(post):		systemd
+Requires(preun):	systemd
+Requires(postun):	systemd
+BuildRequires:		systemd
+%else
+Requires(post):		chkconfig
+Requires(preun):	chkconfig
+Requires(preun):	initscripts
+Requires(postun):	initscripts
+%endif
+
+
+%description
+YADIFA is a name server implementation developed from scratch by .eu.
+It is portable across multiple operating systems and supports DNSSEC,
+TSIG, DNS notify, DNS update, IPv6.
+
+%package libs
+Summary: Libraries used by the YADIFA packages
+Group:    Applications/System
+
+%description libs
+Contains libraries used by YADIFA DNS server
+
+%package devel
+Summary:  Header files and libraries needed for YADIFA development
+Group:    Development/Libraries
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description devel
+The yadifa-devel package contains header files and libraries
+required for development with YADIFA DNS server
+
+
+%prep
+%setup -q -n %{name}-%{version}-%{revision}
+
+%build
+export CPPFLAGS="%{optflags} -g"
+export LDFLAGS="$LDFLAGS -lssl -lcrypto"
+
+# avoid gcc-4.1 bug
+%ifarch i386
+%{?el5:export CPPFLAGS="$CPPFLAGS -pthread -march=i486"}
+%endif
+
+%configure --enable-shared --disable-static
+
+# don't mess with rpath
+sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
+    {.,lib/dnscore,lib/dnsdb,lib/dnszone,sbin/yadifad}/libtool
+sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
+    {.,lib/dnscore,lib/dnsdb,lib/dnszone,sbin/yadifad}/libtool
+# avoid unused-direct-shlib-dependency
+sed -i -e 's! -shared ! -Wl,--as-needed\0!g' \
+    {.,lib/dnscore,lib/dnsdb,lib/dnszone,sbin/yadifad}/libtool
+# respect filesystem hierarhy
+sed -i 's|PREFIX "/etc/"|"/etc/"|g' sbin/yadifad/confs.h
+sed -i 's|PREFIX "/var|"/var|g' sbin/yadifad/confs.h
+sed -i 's|PACKAGE ".pid"|"yadifad.pid"|g' sbin/yadifad/confs.h
+sed -i 's|/var/log|/var/log/yadifa|g' sbin/yadifad/confs.h
+sed -i 's|/usr/local/var|/var|g' etc/yadifad.conf.example
+sed -i 's|/var/log|/var/log/yadifa|g' etc/yadifad.conf.example
+# set proper build options
+sed -i 's|-mtune=native||g' \
+    {.,lib/dnscore,lib/dnsdb,lib/dnszone,sbin/yadifad}/Makefile
+sed -i 's|-fno-ident -ansi -pedantic||g' \
+    {.,lib/dnscore,lib/dnsdb,lib/dnszone,sbin/yadifad}/Makefile
+sed -i '/^YRCFLAGS = -DNDEBUG $(CCOPTIMISATIONFLAGS) -DCMR/d' \
+    {.,lib/dnscore,lib/dnsdb,lib/dnszone,sbin/yadifad}/Makefile
+sed -i '/^YPCFLAGS = -DNDEBUG $(CCOPTIMISATIONFLAGS) -pg -DCMP/d' \
+    {.,lib/dnscore,lib/dnsdb,lib/dnszone,sbin/yadifad}/Makefile
+sed -i '/^YDCFLAGS = -DDEBUG $(DEBUGFLAGS) -DCMD/d' \
+    {.,lib/dnscore,lib/dnsdb,lib/dnszone,sbin/yadifad}/Makefile
+# change configuration options
+sed -i '/daemon/s/off/on/g' etc/yadifad.conf.example
+sed -i '/^[\ \t]*# Enable EDNS0 support/d' etc/yadifad.conf.example
+sed -i '/^[\ \t]*edns0[\ \t]*on/d' etc/yadifad.conf.example
+
+make %{?_smp_mflags}
+
+%install
+%if 0%{?el5}
+rm -rf %{buildroot}
+%endif
+make install DESTDIR=%{buildroot}
+install -Dpm 0644 etc/yadifad.conf.example %{buildroot}%{_sysconfdir}/yadifad.conf
+mkdir -p %{buildroot}%{_localstatedir}/log/yadifa
+rm -f %{buildroot}%{_libdir}/*.la
+# rhel6 workaround
+rm -rf %{buildroot}%{_defaultdocdir}/yadifa
+
+%if 0%{?_with_systemd}
+install -Dpm 0644 %{SOURCE1} %{buildroot}%{_unitdir}/yadifad.service
+%else
+install -Dpm 0755 %{SOURCE2} %{buildroot}%{_initrddir}/yadifad
+%endif
+
+install -Dpm 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/yadifa
+
+%if 0%{?el5}
+%clean
+rm -rf %{buildroot}
+%endif
+
+
+%post
+%if 0%{?_with_systemd}
+%systemd_post yadifad.service
+%else
+/sbin/chkconfig --add yadifad
+%endif
+exit 0
+
+%preun
+%if 0%{?_with_systemd}
+%systemd_preun yadifad.service
+%else
+if [ $1 = 0 ]; then
+	/sbin/service yadifad stop > /dev/null 2>&1
+	/sbin/chkconfig --del yadifad
+fi
+%endif
+exit 0
+
+%postun
+%if 0%{?_with_systemd}
+%systemd_postun_with_restart yadifad.service
+%else
+if [ "$1" -ge "1" ]; then
+	/sbin/service yadifad condrestart > /dev/null 2>&1
+fi
+%endif
+exit 0
+
+%post libs -p /sbin/ldconfig
+
+%postun libs -p /sbin/ldconfig
+
+
+%files
+%doc AUTHORS COPYING ChangeLog NEWS README TODO
+# rhel6 workaround
+%doc etc/*.conf.example
+%config(noreplace) %{_sysconfdir}/yadifad.conf
+%config(noreplace) %{_sysconfdir}/logrotate.d/yadifa
+%if 0%{?_with_systemd}
+%{_unitdir}/yadifad.service
+%else
+%{_initrddir}/yadifad
+%endif
+%{_localstatedir}/zones
+%{_localstatedir}/log/yadifa
+%{_sbindir}/yadifad
+%{_mandir}/man1/*.1*
+%{_mandir}/man5/*.5*
+
+%files libs
+%{_libdir}/libdnscore.so.0*
+%{_libdir}/libdnsdb.so.0*
+%{_libdir}/libdnszone.so.0*
+
+%files devel
+%{_includedir}/dnscore
+%{_includedir}/dnsdb
+%{_includedir}/dnszone
+%{_libdir}/libdnscore.so
+%{_libdir}/libdnsdb.so
+%{_libdir}/libdnszone.so
+
+
+%changelog
+* Thu Aug 28 2014 Denis Fateyev <denis at fateyev.com> - 1.0.3-2
+- Build options clarification
+- Minor specfile cleanup
+
+* Sat Aug 16 2014 Denis Fateyev <denis at fateyev.com> - 1.0.3-1
+- Initial Fedora RPM release
diff --git a/yadifad.init b/yadifad.init
new file mode 100755
index 0000000..0163ec8
--- /dev/null
+++ b/yadifad.init
@@ -0,0 +1,109 @@
+#!/bin/bash
+#
+# yadifad  This shell script takes care of starting and stopping
+#          yadifad on RedHat or other chkconfig-based system.
+#
+# chkconfig: - 13 87
+# processname: yadifad
+# config: /etc/yadifad.conf
+# pidfile: /var/run/yadifad.pid
+#
+# description: YADIFA is a name server implementation developed from \
+#              scratch by .eu. It is portable across multiple operating \
+#              systems and supports DNSSEC, TSIG, DNS notify, DNS update, IPv6.
+
+### BEGIN INIT INFO
+# Provides: yadifad
+# Required-Start: $network
+# Required-Stop: $network
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start and stop yadifad
+# Description: YADIFA is a name server implementation developed from \
+#              scratch by .eu. It is portable across multiple operating \
+#              systems and supports DNSSEC, TSIG, DNS notify, DNS update, IPv6.
+### END INIT INFO
+
+# Written by Denis Fateyev (denis at fateyev.com)
+# 2014.07.05
+
+# Source function library
+. /etc/init.d/functions
+
+# Source networking configuration
+[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
+
+start() {
+	[ "$EUID" != "0" ] && exit 4
+	[ "${NETWORKING}" = "no" ] && exit 1
+	[ -f /usr/sbin/yadifad ] || exit 5
+
+        # Start daemon
+        echo -n $"Starting yadifad: "
+        daemon /usr/sbin/yadifad >/dev/null 2>&1 && success || failure
+        RETVAL=$?
+        echo
+        [ $RETVAL = 0 ] && touch /var/lock/subsys/yadifad
+}
+
+stop() {
+	[ "$EUID" != "0" ] && exit 4
+
+        # Stop daemon
+        echo -n $"Shutting down yadifad: "
+        if [ -n "`pidfileofproc yadifad`" ] ; then
+	    killproc /usr/sbin/yadifad
+	else
+	    failure $"Shutting down yadifad"
+	fi
+	RETVAL=$?
+        echo
+        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/yadifad
+}
+
+restart() {
+	stop
+	start
+}
+
+reload() {
+	[ "$EUID" != "0" ] && exit 4
+
+        # Reload daemon
+        echo -n $"Reloading yadifad: "
+        if [ -n "`pidfileofproc yadifad`" ] ; then
+	    killproc /usr/sbin/yadifad -HUP
+	else
+	    failure $"Reloading yadifad"
+	fi
+	RETVAL=$?
+        echo
+}
+
+# See how we were called
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart)
+	restart
+	;;
+  reload)
+	reload
+	;;
+  condrestart|try-restart)
+	status yadifad > /dev/null || exit 0
+	restart
+	;;
+  status)
+	status yadifad
+	;;
+  *)
+	echo $"Usage: $0 {start|stop|restart|reload|status|condrestart|try-restart}"
+	exit 2
+esac
+
+exit $RETVAL
diff --git a/yadifad.service b/yadifad.service
new file mode 100644
index 0000000..eb6d356
--- /dev/null
+++ b/yadifad.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Yadifa DNS server
+After=network.target
+
+[Service]
+Type=simple
+PIDFile=/run/yadifad.pid
+ExecStart=/usr/sbin/yadifad
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target


More information about the scm-commits mailing list