]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blame - pdns/pdns.nm
Sanitize pdns and pdns-recursor package.
[people/amarx/ipfire-3.x.git] / pdns / pdns.nm
CommitLineData
1e42f23e 1###############################################################################
802ea3af
MT
2# IPFire.org - An Open Source Firewall Solution #
3# Copyright (C) - IPFire Development Team <info@ipfire.org> #
1e42f23e
MT
4###############################################################################
5
802ea3af 6name = pdns
dfe7386f 7version = 3.1
3078b82b 8release = 3
1e42f23e 9
802ea3af
MT
10groups = Networking/DNS
11url = http://powerdns.com/
12license = GPLv2
13summary = A modern, advanced and high performance authoritative-only nameserver.
1e42f23e 14
802ea3af
MT
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.
1e42f23e 19 Furthermore, PowerDNS interfaces with almost any database.
802ea3af
MT
20end
21
aa429b66 22source_dl = http://downloads.powerdns.com/releases/
802ea3af
MT
23
24build
25 requires
26 boost-devel
27 chrpath
28 gcc-c++
29 lua-devel
476b248c 30 shadow-utils
802ea3af
MT
31 sqlite-devel
32 zlib-devel
33 end
34
476b248c 35 # No paralilelism build.
802ea3af
MT
36 PARALLELISMFLAGS =
37
38 configure_options += \
476b248c 39 --sysconfdir=%{sysconfdir}/pdns \
aa429b66 40 --libdir=%{libdir}/powerdns \
802ea3af 41 --with-modules="" \
476b248c 42 --with-dynmodules="pipe geo gsqlite3" \
802ea3af
MT
43 --with-lua \
44 --disable-static
45
476b248c
SS
46 prepare_cmds
47 %{create_user}
48 end
49
802ea3af 50 install_cmds
476b248c
SS
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
3078b82b 62 rm -vf %{BUILDROOT}%{sysconfdir}/pdns/pdns.conf-dist
476b248c
SS
63
64 # Create empty database file.
65 touch %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
66
67 # Fix permissions and ownership from database.
68 chown -R pdns:pdns %{BUILDROOT}%{sharedstatedir}/pdns
69 chmod 660 %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
70
71 # Remove unneded binaries.
72 rm -vf %{BUILDROOT}%{bindir}/zone2ldap
73
74 # Remove rpath from binaries and backend libs.
802ea3af 75 chrpath --delete %{BUILDROOT}/usr/bin/pdns_control
802ea3af
MT
76 chrpath --delete %{BUILDROOT}/usr/bin/zone2sql
77 chrpath --delete %{BUILDROOT}/usr/sbin/pdns_server
aa429b66 78 chrpath --delete %{BUILDROOT}%{libdir}/powerdns/*.so
802ea3af 79 chrpath --delete %{BUILDROOT}/usr/bin/dnsreplay
aa429b66 80 chrpath --delete %{BUILDROOT}/usr/bin/pdnssec
802ea3af
MT
81 end
82end
83
476b248c
SS
84create_user
85 getent group pdns >/dev/null || groupadd -r pdns
86 getent passwd pdns >/dev/null || \
87 useradd -r -g pdns -d %{sharedstatedir}/pdns -s /sbin/nologin \
88 -c "PowerDNS user" pdns
89end
90
802ea3af
MT
91packages
92 package %{name}
476b248c
SS
93 prerequires
94 coreutils
95 shadow-utils
96 sqlite
97 end
3078b82b
MT
98
99 requires
100 pdns-recursor >= 3.3-8
101 end
476b248c
SS
102
103 configfiles
3078b82b 104 %{sysconfdir}/pdns/pdns.conf
476b248c
SS
105 end
106
107 script prein
108 %{create_user}
109 end
110
111 script postin
112 systemctl daemon-reload >/dev/null 2>&1 || :
113
114 # Check if DB allready exists. Create pdns sqlite database if not.
115 if [ ! -s "%{sharedstatedir}/pdns/pdns.db" ]; then
116 sqlite3 %{sharedstatedir}/pdns/pdns.db < %{datadir}/pdns/pdns.table
117 fi
118 end
119
120 script preun
121 systemctl --no-reload disable pdns.service >/dev/null 2>&1 || :
122 systemctl stop pdns.service >/dev/null 2>&1 || :
123
124 # Backup existing database.
125 mv %{sharedstatedir}/pdns/pdns.db{,.bak}
126 end
127
128 script postun
129 systemctl daemon-reload >/dev/null 2>&1 || :
130 end
131
132 script postup
133 systemctl daemon-reload >/dev/null 2>&1 || :
134 systemctl try-restart pdns.service >/dev/null 2>&1 || :
135 end
136 end
1f9bc2f0
MT
137
138 package %{name}-debuginfo
139 template DEBUGINFO
140 end
802ea3af 141end