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