]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blame_incremental - pdns/pdns.nm
pdns: Don't overwrite database file on update.
[people/amarx/ipfire-3.x.git] / pdns / pdns.nm
... / ...
CommitLineData
1###############################################################################
2# IPFire.org - An Open Source Firewall Solution #
3# Copyright (C) - IPFire Development Team <info@ipfire.org> #
4###############################################################################
5
6name = pdns
7version = 3.1
8release = 5
9
10groups = Networking/DNS
11url = http://powerdns.com/
12license = GPLv2
13summary = A modern, advanced and high performance authoritative-only nameserver.
14
15description
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.
20end
21
22source_dl = http://downloads.powerdns.com/releases/
23
24build
25 requires
26 autoconf
27 automake
28 boost-devel
29 chrpath
30 gcc-c++
31 libtool
32 lua-devel
33 polarssl-devel
34 shadow-utils
35 sqlite-devel
36 zlib-devel
37 end
38
39 # No paralilelism build.
40 PARALLELISMFLAGS =
41
42 configure_options += \
43 --sysconfdir=%{sysconfdir}/pdns \
44 --libdir=%{libdir}/powerdns \
45 --with-modules="" \
46 --with-dynmodules="pipe geo gsqlite3" \
47 --with-lua \
48 --disable-static
49
50 prepare_cmds
51 # Regenerate build system.
52 autoreconf -vfi
53
54 %{create_user}
55 end
56
57 install_cmds
58 # Create directories for pdns sqlite db.
59 mkdir -p %{BUILDROOT}%{datadir}/pdns/
60 mkdir -p %{BUILDROOT}%{sharedstatedir}/pdns/
61
62 # Install shema for sqlite database.
63 install -m 0644 %{DIR_SOURCE}/pdns.table \
64 %{BUILDROOT}%{datadir}/pdns/pdns.table
65
66 # Install default configuration.
67 install -m 0644 %{DIR_SOURCE}/pdns.conf \
68 %{BUILDROOT}%{sysconfdir}/pdns/pdns.conf
69 rm -vf %{BUILDROOT}%{sysconfdir}/pdns/pdns.conf-dist
70
71 # Create empty database file.
72 touch %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
73
74 # Fix permissions and ownership from database.
75 chown -R pdns:pdns %{BUILDROOT}%{sharedstatedir}/pdns
76 chmod 660 %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
77
78 # Remove unneded binaries.
79 rm -vf %{BUILDROOT}%{bindir}/zone2ldap
80
81 # Remove rpath from binaries and backend libs.
82 chrpath --delete %{BUILDROOT}/usr/bin/pdns_control
83 chrpath --delete %{BUILDROOT}/usr/bin/zone2sql
84 chrpath --delete %{BUILDROOT}/usr/sbin/pdns_server
85 chrpath --delete %{BUILDROOT}%{libdir}/powerdns/*.so
86 chrpath --delete %{BUILDROOT}/usr/bin/dnsreplay
87 chrpath --delete %{BUILDROOT}/usr/bin/pdnssec
88 end
89end
90
91create_user
92 getent group pdns >/dev/null || groupadd -r pdns
93 getent passwd pdns >/dev/null || \
94 useradd -r -g pdns -d %{sharedstatedir}/pdns -s /sbin/nologin \
95 -c "PowerDNS user" pdns
96end
97
98packages
99 package %{name}
100 prerequires
101 coreutils
102 shadow-utils
103 sqlite
104 end
105
106 requires
107 pdns-recursor >= 3.3-8
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
152end