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