###############################################################################
name = pdns
-version = 3.0
+version = 4.0.1
release = 1
+thisapp = %{name}-%{version}
groups = Networking/DNS
url = http://powerdns.com/
Furthermore, PowerDNS interfaces with almost any database.
end
-source_dl =
+source_dl = http://downloads.powerdns.com/releases/
+sources = %{thisapp}.tar.bz2
build
requires
- boost-devel
- chrpath
+ /usr/bin/hostname
+ boost-devel >= 1.60.0
+ bison
+ flex
gcc-c++
+ libsodium-devel
lua-devel
- openldap-devel
+ openssl-devel
+ shadow-utils
sqlite-devel
+ systemd-devel
zlib-devel
end
- CPPFLAGS = -DLDAP_DEPRECATED
-
+ # No paralilelism build.
PARALLELISMFLAGS =
configure_options += \
- --sysconfdir=/etc/pdns \
- --libdir=/usr/lib/powerdns \
+ --sysconfdir=%{sysconfdir}/pdns \
+ --libdir=%{libdir}/powerdns \
--with-modules="" \
- --with-dynmodules="pipe geo ldap gsqlite3" \
+ --with-dynmodules="pipe gsqlite3" \
--with-lua \
+ --with-sqlite3 \
+ --enable-libsodium \
+ --enable-systemd \
+ --enable-tools \
+ --enable-unit-tests \
--disable-static
+ prepare_cmds
+ %{create_user}
+ end
+
+ test
+ make -C pdns check
+ end
+
install_cmds
- chrpath --delete %{BUILDROOT}/usr/bin/pdns_control
- chrpath --delete %{BUILDROOT}/usr/bin/zone2ldap
- chrpath --delete %{BUILDROOT}/usr/bin/zone2sql
- chrpath --delete %{BUILDROOT}/usr/sbin/pdns_server
- chrpath --delete %{BUILDROOT}/usr/lib/powerdns/*.so
- chrpath --delete %{BUILDROOT}/usr/bin/dnsreplay
- chrpath --delete %{BUILDROOT}//usr/bin/pdnssec
+ # Create directories for pdns sqlite db.
+ mkdir -p %{BUILDROOT}%{datadir}/pdns/
+ mkdir -p %{BUILDROOT}%{sharedstatedir}/pdns/
+
+ # Install shema for sqlite database.
+ install -m 0644 %{DIR_SOURCE}/pdns.table \
+ %{BUILDROOT}%{datadir}/pdns/pdns.table
+
+ # Install default configuration.
+ install -m 0644 %{DIR_SOURCE}/pdns.conf \
+ %{BUILDROOT}%{sysconfdir}/pdns/pdns.conf
+ rm -vf %{BUILDROOT}%{sysconfdir}/pdns/pdns.conf-dist
+
+ # Create empty database file.
+ touch %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
+
+ # Fix permissions and ownership from database.
+ chown -R pdns:pdns %{BUILDROOT}%{sharedstatedir}/pdns
+ chmod 660 %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
+
+ # Remove unneded binaries.
+ rm -vf %{BUILDROOT}%{bindir}/zone2ldap
end
end
+create_user
+ getent group pdns >/dev/null || groupadd -r pdns
+ getent passwd pdns >/dev/null || \
+ useradd -r -g pdns -d %{sharedstatedir}/pdns -s /sbin/nologin \
+ -c "PowerDNS user" pdns
+end
+
packages
package %{name}
+ prerequires
+ coreutils
+ shadow-utils
+ sqlite
+ end
+
+ configfiles
+ %{sysconfdir}/pdns/pdns.conf
+ end
+
+ datafiles
+ %{sharedstatedir}/pdns/pdns.db
+ end
+
+ script prein
+ %{create_user}
+ end
+
+ script postin
+ systemctl daemon-reload >/dev/null 2>&1 || :
+
+ # Check if DB allready exists. Create pdns sqlite database if not.
+ if [ ! -s "%{sharedstatedir}/pdns/pdns.db" ]; then
+ sqlite3 %{sharedstatedir}/pdns/pdns.db < %{datadir}/pdns/pdns.table
+ fi
+ end
+
+ script preun
+ systemctl --no-reload disable pdns.service >/dev/null 2>&1 || :
+ systemctl stop pdns.service >/dev/null 2>&1 || :
+
+ # Backup existing database.
+ mv %{sharedstatedir}/pdns/pdns.db{,.bak}
+ end
+
+ script postun
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ end
+
+ script postup
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ systemctl try-restart pdns.service >/dev/null 2>&1 || :
+ end
+ end
package %{name}-debuginfo
template DEBUGINFO