]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blob - pdns/pdns.nm
pdns: Update to version 3.4.7
[people/amarx/ipfire-3.x.git] / pdns / pdns.nm
1 ###############################################################################
2 # IPFire.org - An Open Source Firewall Solution #
3 # Copyright (C) - IPFire Development Team <info@ipfire.org> #
4 ###############################################################################
5
6 name = pdns
7 version = 3.4.7
8 release = 1
9
10 groups = Networking/DNS
11 url = http://powerdns.com/
12 license = GPLv2
13 summary = A modern, advanced and high performance authoritative-only nameserver.
14
15 description
16 The PowerDNS Nameserver is a modern, advanced and high performance
17 authoritative-only nameserver. It is written from scratch and conforms
18 to all relevant DNS standards documents.
19 Furthermore, PowerDNS interfaces with almost any database.
20 end
21
22 source_dl = http://downloads.powerdns.com/releases/
23 sources = %{thisapp}.tar.bz2
24
25 build
26 requires
27 boost-devel
28 chrpath
29 gcc-c++
30 lua-devel
31 polarssl-devel
32 shadow-utils
33 sqlite-devel
34 zlib-devel
35 end
36
37 # No paralilelism build.
38 PARALLELISMFLAGS =
39
40 configure_options += \
41 --sysconfdir=%{sysconfdir}/pdns \
42 --with-system-polarssl \
43 --with-modules="" \
44 --with-dynmodules="pipe geo gsqlite3" \
45 --with-lua \
46 --enable-tools \
47 --disable-static \
48 --enable-unit-tests
49
50 prepare_cmds
51 %{create_user}
52 end
53
54 test
55 make -C pdns check
56 end
57
58 install_cmds
59 # Create directories for pdns sqlite db.
60 mkdir -p %{BUILDROOT}%{datadir}/pdns/
61 mkdir -p %{BUILDROOT}%{sharedstatedir}/pdns/
62
63 # Install shema for sqlite database.
64 install -m 0644 %{DIR_SOURCE}/pdns.table \
65 %{BUILDROOT}%{datadir}/pdns/pdns.table
66
67 # Install default configuration.
68 install -m 0644 %{DIR_SOURCE}/pdns.conf \
69 %{BUILDROOT}%{sysconfdir}/pdns/pdns.conf
70 rm -vf %{BUILDROOT}%{sysconfdir}/pdns/pdns.conf-dist
71
72 # Create empty database file.
73 touch %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
74
75 # Fix permissions and ownership from database.
76 chown -R pdns:pdns %{BUILDROOT}%{sharedstatedir}/pdns
77 chmod 660 %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
78
79 # Remove unneded binaries.
80 rm -vf %{BUILDROOT}%{bindir}/zone2ldap
81
82 # Remove rpath from binaries and backend libs.
83 chrpath --delete %{BUILDROOT}/usr/bin/pdns_control
84 chrpath --delete %{BUILDROOT}/usr/bin/zone2sql
85 chrpath --delete %{BUILDROOT}/usr/sbin/pdns_server
86 chrpath --delete %{BUILDROOT}%{libdir}/pdns/*.so
87 chrpath --delete %{BUILDROOT}/usr/bin/dnsreplay
88 chrpath --delete %{BUILDROOT}/usr/bin/pdnssec
89 end
90 end
91
92 create_user
93 getent group pdns >/dev/null || groupadd -r pdns
94 getent passwd pdns >/dev/null || \
95 useradd -r -g pdns -d %{sharedstatedir}/pdns -s /sbin/nologin \
96 -c "PowerDNS user" pdns
97 end
98
99 packages
100 package %{name}
101 prerequires
102 coreutils
103 shadow-utils
104 sqlite
105 end
106
107 configfiles
108 %{sysconfdir}/pdns/pdns.conf
109 end
110
111 datafiles
112 %{sharedstatedir}/pdns/pdns.db
113 end
114
115 script prein
116 %{create_user}
117 end
118
119 script postin
120 systemctl daemon-reload >/dev/null 2>&1 || :
121
122 # Check if DB allready exists. Create pdns sqlite database if not.
123 if [ ! -s "%{sharedstatedir}/pdns/pdns.db" ]; then
124 sqlite3 %{sharedstatedir}/pdns/pdns.db < %{datadir}/pdns/pdns.table
125 fi
126 end
127
128 script preun
129 systemctl --no-reload disable pdns.service >/dev/null 2>&1 || :
130 systemctl stop pdns.service >/dev/null 2>&1 || :
131
132 # Backup existing database.
133 mv %{sharedstatedir}/pdns/pdns.db{,.bak}
134 end
135
136 script postun
137 systemctl daemon-reload >/dev/null 2>&1 || :
138 end
139
140 script postup
141 systemctl daemon-reload >/dev/null 2>&1 || :
142 systemctl try-restart pdns.service >/dev/null 2>&1 || :
143 end
144 end
145
146 package %{name}-debuginfo
147 template DEBUGINFO
148 end
149 end