]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blob - pdns/pdns.nm
3c25e9d46e2e1face392573b249c738b4ea07b09
[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.3.1
8 release = 2
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
24 build
25 requires
26 boost-devel
27 chrpath
28 gcc-c++
29 lua-devel
30 polarssl-devel
31 shadow-utils
32 sqlite-devel
33 zlib-devel
34 end
35
36 # No paralilelism build.
37 PARALLELISMFLAGS =
38
39 configure_options += \
40 --sysconfdir=%{sysconfdir}/pdns \
41 --libdir=%{libdir}/powerdns \
42 --with-system-polarssl \
43 --with-modules="" \
44 --with-dynmodules="pipe geo gsqlite3" \
45 --with-lua \
46 --enable-tools \
47 --disable-static
48
49 prepare_cmds
50 %{create_user}
51 end
52
53 install_cmds
54 # Create directories for pdns sqlite db.
55 mkdir -p %{BUILDROOT}%{datadir}/pdns/
56 mkdir -p %{BUILDROOT}%{sharedstatedir}/pdns/
57
58 # Install shema for sqlite database.
59 install -m 0644 %{DIR_SOURCE}/pdns.table \
60 %{BUILDROOT}%{datadir}/pdns/pdns.table
61
62 # Install default configuration.
63 install -m 0644 %{DIR_SOURCE}/pdns.conf \
64 %{BUILDROOT}%{sysconfdir}/pdns/pdns.conf
65 rm -vf %{BUILDROOT}%{sysconfdir}/pdns/pdns.conf-dist
66
67 # Create empty database file.
68 touch %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
69
70 # Fix permissions and ownership from database.
71 chown -R pdns:pdns %{BUILDROOT}%{sharedstatedir}/pdns
72 chmod 660 %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
73
74 # Remove unneded binaries.
75 rm -vf %{BUILDROOT}%{bindir}/zone2ldap
76
77 # Remove rpath from binaries and backend libs.
78 chrpath --delete %{BUILDROOT}/usr/bin/pdns_control
79 chrpath --delete %{BUILDROOT}/usr/bin/zone2sql
80 chrpath --delete %{BUILDROOT}/usr/sbin/pdns_server
81 chrpath --delete %{BUILDROOT}%{libdir}/powerdns/*.so
82 chrpath --delete %{BUILDROOT}/usr/bin/dnsreplay
83 chrpath --delete %{BUILDROOT}/usr/bin/pdnssec
84 end
85 end
86
87 create_user
88 getent group pdns >/dev/null || groupadd -r pdns
89 getent passwd pdns >/dev/null || \
90 useradd -r -g pdns -d %{sharedstatedir}/pdns -s /sbin/nologin \
91 -c "PowerDNS user" pdns
92 end
93
94 packages
95 package %{name}
96 prerequires
97 coreutils
98 shadow-utils
99 sqlite
100 end
101
102 configfiles
103 %{sysconfdir}/pdns/pdns.conf
104 end
105
106 datafiles
107 %{sharedstatedir}/pdns/pdns.db
108 end
109
110 script prein
111 %{create_user}
112 end
113
114 script postin
115 systemctl daemon-reload >/dev/null 2>&1 || :
116
117 # Check if DB allready exists. Create pdns sqlite database if not.
118 if [ ! -s "%{sharedstatedir}/pdns/pdns.db" ]; then
119 sqlite3 %{sharedstatedir}/pdns/pdns.db < %{datadir}/pdns/pdns.table
120 fi
121 end
122
123 script preun
124 systemctl --no-reload disable pdns.service >/dev/null 2>&1 || :
125 systemctl stop pdns.service >/dev/null 2>&1 || :
126
127 # Backup existing database.
128 mv %{sharedstatedir}/pdns/pdns.db{,.bak}
129 end
130
131 script postun
132 systemctl daemon-reload >/dev/null 2>&1 || :
133 end
134
135 script postup
136 systemctl daemon-reload >/dev/null 2>&1 || :
137 systemctl try-restart pdns.service >/dev/null 2>&1 || :
138 end
139 end
140
141 package %{name}-debuginfo
142 template DEBUGINFO
143 end
144 end