]> git.ipfire.org Git - ipfire-3.x.git/blob - pdns/pdns.nm
git: Update to 2.23.0
[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 = 4.0.1
8 release = 1
9 thisapp = %{name}-%{version}
10
11 groups = Networking/DNS
12 url = http://powerdns.com/
13 license = GPLv2
14 summary = A modern, advanced and high performance authoritative-only nameserver.
15
16 description
17 The PowerDNS Nameserver is a modern, advanced and high performance
18 authoritative-only nameserver. It is written from scratch and conforms
19 to all relevant DNS standards documents.
20 Furthermore, PowerDNS interfaces with almost any database.
21 end
22
23 source_dl = http://downloads.powerdns.com/releases/
24 sources = %{thisapp}.tar.bz2
25
26 build
27 requires
28 /usr/bin/hostname
29 boost-devel >= 1.60.0
30 bison
31 flex
32 gcc-c++
33 libsodium-devel
34 lua-devel
35 openssl-devel
36 shadow-utils
37 sqlite-devel
38 systemd-devel
39 zlib-devel
40 end
41
42 # No paralilelism build.
43 PARALLELISMFLAGS =
44
45 configure_options += \
46 --sysconfdir=%{sysconfdir}/pdns \
47 --libdir=%{libdir}/powerdns \
48 --with-modules="" \
49 --with-dynmodules="pipe gsqlite3" \
50 --with-lua \
51 --with-sqlite3 \
52 --enable-libsodium \
53 --enable-systemd \
54 --enable-tools \
55 --enable-unit-tests \
56 --disable-static
57
58 prepare_cmds
59 %{create_user}
60 end
61
62 test
63 make -C pdns check
64 end
65
66 install_cmds
67 # Create directories for pdns sqlite db.
68 mkdir -p %{BUILDROOT}%{datadir}/pdns/
69 mkdir -p %{BUILDROOT}%{sharedstatedir}/pdns/
70
71 # Install shema for sqlite database.
72 install -m 0644 %{DIR_SOURCE}/pdns.table \
73 %{BUILDROOT}%{datadir}/pdns/pdns.table
74
75 # Install default configuration.
76 install -m 0644 %{DIR_SOURCE}/pdns.conf \
77 %{BUILDROOT}%{sysconfdir}/pdns/pdns.conf
78 rm -vf %{BUILDROOT}%{sysconfdir}/pdns/pdns.conf-dist
79
80 # Create empty database file.
81 touch %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
82
83 # Fix permissions and ownership from database.
84 chown -R pdns:pdns %{BUILDROOT}%{sharedstatedir}/pdns
85 chmod 660 %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
86
87 # Remove unneded binaries.
88 rm -vf %{BUILDROOT}%{bindir}/zone2ldap
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