File phreebird.spec of Package phreebird
%if 0%{?suse_version} >= 1200 || 0%{?fedora} >= 16
%define systemdunitdir %(pkg-config --variable=systemdsystemunitdir systemd)
%endif
%if 0%{?suse_version} < 1000
%define defined() %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
%define undefined() %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
%endif
%if 0%{?fedora}
%define ext_man .gz
%endif
Summary: A DNSSEC proxy
Name: phreebird
Version: 1.02
Release: 1
License: BSD, GPL, LGPL
Group: Productivity/Networking/DNS/Servers
URL: http://dankaminsky.com/phreebird/
#Original Source: http://s3.amazonaws.com/dmk/phreebird_suite_%%{version}.tar.gz
Source: phreebird_suite_%{version}.tar.bz2
# Own creation (from init.d/skeleton), LGPL
Source1: rc.%{name}
# Own creation, GPL
Source2: sysconf.%{name}
# Own creation, GPL
Source3: phreebird.socket
# Own creation, GPL
Source4: phreebird.service
# Own creation, GPL
Source5: apparmor.phreebird
# GPL
Source6: COPYING
# PATCH-FIX-UPSTREAM conrad@quisquis.de
Patch: phreebird-missing-return.patch
# PATCH-FIX-UPSTREAM conrad@quisquis.de
Patch1: phreebird-unused-vars.patch
# PATCH-FIX-UPSTREAM conrad@quisquis.de
Patch2: phreebird-formats.patch
# PATCH-FIX-UPSTREAM conrad@quisquis.de
Patch3: phreebird-types.patch
# PATCH-FIX-UPSTREAM conrad@quisquis.de
Patch4: phreebird-init.patch
# PATCH-FIX-UPSTREAM conrad@quisquis.de
Patch5: phreebird-memleak.patch
# PATCH-FIX-UPSTREAM conrad@quisquis.de
Patch6: phreebird-bucketuse.patch
# PATCH-FEATURE-UPSTREAM conrad@quisquis.de
Patch7: phreebird-systemd.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires: dos2unix libevent-devel >= 2.0 libghthash-devel openssl-devel
Requires(pre): pwdutils
%if %{defined fillup_prereq}
Requires(pre): %fillup_prereq
%endif
%if 0%{?suse_version} > 1130 || 0%{?sles_version} >= 11
# Avoid unowned directory warning
BuildRequires: apparmor-profiles
%endif
%if 0%{?suse_version} > 1140
BuildRequires: ldns-devel
%endif
%if 0%{?suse_version} <= 1140
BuildRequires: libldns-devel
%endif
%if %{defined systemdunitdir}
BuildRequires: systemd-devel
%endif
%if %{undefined systemdunitdir}
Requires: daemontools
Requires(pre): %insserv_prereq
%endif
%if 0%{?suse_version} >= 1100 && 0%{?suse_version} < 1150
Requires: licenses
BuildRequires: licenses
%endif
%description
Phreebird is a DNSSEC proxy that operates in front of an existing DNS server
(such as BIND, Unbound, PowerDNS, Microsoft DNS, or QIP) and supplements its
records with DNSSEC responses. Features of Phreebird include automatic key
generation, realtime record signing, support for arbitrary responses, zero
configuration, NSEC3 "White Lies", caching and rate limiting to deter DoS
attacks, and experimental support for both Coarse Time over DNS and HTTP
Virtual Channels.
THIS VERSION IS NOT RECOMMENDED FOR PRODUCTION USE!
# The suite also contains a large amount of sample code,
# including support for federated identity over OpenSSH. Finally, "Phreeload"
# enhances existing OpenSSL applications with DNSSEC support.
%prep
%setup -n phreebird_suite_%{version}
%patch -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%if %{defined systemdunitdir}
%patch7 -p1
%endif
%build
dos2unix *.txt
chmod 0644 *.txt
%if %{defined systemdunitdir}
EXTRALIBS=-lsystemd-daemon
%endif
make CC="gcc %{optflags} -DPB_VERSION=\\\"%{version}\\\"" EXTRALIBS="$EXTRALIBS" %{?_smp_mflags} phreebird
lic="`md5sum "%{S:6}" | cut -d' ' -f 1`"
if [ -r "/usr/share/doc/licenses/md5/$lic" ]; then
%__ln_s /usr/share/doc/licenses/md5/"$lic" COPYING
else
%__cp "%{S:6}" COPYING
fi
%install
mkdir -p "%{buildroot}%{_sbindir}"
install -m 0755 bin/phreebird "%{buildroot}%{_sbindir}"
mkdir -p "%{buildroot}%{_localstatedir}/adm/fillup-templates/"
%__install -m 0644 "%{S:2}" "%{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}"
%if 0%{?fedora} == 0
%__mkdir_p "%{buildroot}%{_sysconfdir}/apparmor.d"
%__install -m 0644 "%{S:5}" "%{buildroot}%{_sysconfdir}/apparmor.d/usr.sbin.phreebird"
%endif
mkdir -p "%{buildroot}%{_sysconfdir}/%{name}"
%if %{undefined systemdunitdir}
# SYSV-Init
mkdir -p "%{buildroot}%{_initrddir}"
install -m 0755 %{S:1} "%{buildroot}%{_initrddir}/%{name}"
ln -s "../../%{_initrddir}/%{name}" "%{buildroot}%{_sbindir}/rc%{name}"
mkdir -p "%{buildroot}%{_localstatedir}/log/%{name}"
# /SYSV-Init
%endif
%if %{defined systemdunitdir}
# systemd-init
%__mkdir_p "%{buildroot}%{systemdunitdir}"
%__install -m 0644 "%{S:3}" "%{S:4}" "%{buildroot}%{systemdunitdir}"
# /systemd-init
%endif
%__debug_install_post
%pre
getent group named >/dev/null || groupadd -r named
getent passwd named >/dev/null || useradd -r -g named -d "%{_sysconfdir}/%{name}" -s /sbin/nologin -c "user for phreebird" named
exit 0
%post
%if %{undefined systemdunitdir}
%fillup_and_insserv phreebird
%restart_on_update phreebird
%endif
%if %{defined systemdunitdir}
%fillup_only phreebird
test -n "$FIRST_ARG" || FIRST_ARG=$1
if test "$FIRST_ARG" -ge 1 ; then
/bin/systemctl enable phreebird.socket >/dev/null 2>&1 || :
fi
%endif
%preun
%if %{undefined systemdunitdir}
%stop_on_removal phreebird
%endif
%if %{defined systemdunitdir}
test -n "$FIRST_ARG" || FIRST_ARG=$1
if test "$FIRST_ARG" -lt 1 ; then
/bin/systemctl --no-reload disable phreebird.socket >/dev/null 2>&1 || :
/bin/systemctl stop phreebird.socket >/dev/null 2>&1 || :
/bin/systemctl stop phreebird.service >/dev/null 2>&1 || :
fi
%endif
%postun
%if %{undefined systemdunitdir}
%restart_on_update phreebird
%insserv_cleanup
%endif
%if %{defined systemdunitdir}
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
test -n "$FIRST_ARG" || FIRST_ARG=$1
if test "$FIRST_ARG" -ge 1 ; then
/bin/systemctl try-restart phreebird.socket >/dev/null 2>&1 || :
fi
%endif
%clean
[ "%{buildroot}" = "/" ] || rm -rf "%{buildroot}"
%files
%defattr(-,root,root,-)
%doc CHANGELOG.txt HACKING.txt INSTALL.txt README.txt LICENCE COPYING
%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
%if 0%{?fedora} == 0
%config %{_sysconfdir}/apparmor.d/usr.sbin.phreebird
%endif
%attr(0700,named,named) %{_sysconfdir}/%{name}
%{_sbindir}/phreebird
%if %{undefined systemdunitdir}
%{_sbindir}/rc%{name}
%{_initrddir}/%{name}
%attr(0755,daemon,daemon) %{_localstatedir}/log/%{name}
%endif
%if %{defined systemdunitdir}
%{systemdunitdir}/phreebird.service
%{systemdunitdir}/phreebird.socket
%endif
%changelog