]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blame - pdns/pdns.nm
Merge remote-tracking branch 'stevee/compat-xz'
[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
3e486aa4 7version = 3.3.1
ac85a00a 8release = 2
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
1c3d8873 30 polarssl-devel
476b248c 31 shadow-utils
802ea3af
MT
32 sqlite-devel
33 zlib-devel
34 end
35
476b248c 36 # No paralilelism build.
802ea3af
MT
37 PARALLELISMFLAGS =
38
39 configure_options += \
476b248c 40 --sysconfdir=%{sysconfdir}/pdns \
aa429b66 41 --libdir=%{libdir}/powerdns \
3e486aa4 42 --with-system-polarssl \
802ea3af 43 --with-modules="" \
476b248c 44 --with-dynmodules="pipe geo gsqlite3" \
802ea3af 45 --with-lua \
3e486aa4 46 --enable-tools \
802ea3af
MT
47 --disable-static
48
476b248c
SS
49 prepare_cmds
50 %{create_user}
51 end
52
802ea3af 53 install_cmds
476b248c
SS
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
3078b82b 65 rm -vf %{BUILDROOT}%{sysconfdir}/pdns/pdns.conf-dist
476b248c
SS
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.
802ea3af 78 chrpath --delete %{BUILDROOT}/usr/bin/pdns_control
802ea3af
MT
79 chrpath --delete %{BUILDROOT}/usr/bin/zone2sql
80 chrpath --delete %{BUILDROOT}/usr/sbin/pdns_server
aa429b66 81 chrpath --delete %{BUILDROOT}%{libdir}/powerdns/*.so
802ea3af 82 chrpath --delete %{BUILDROOT}/usr/bin/dnsreplay
aa429b66 83 chrpath --delete %{BUILDROOT}/usr/bin/pdnssec
802ea3af
MT
84 end
85end
86
476b248c
SS
87create_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
92end
93
802ea3af
MT
94packages
95 package %{name}
476b248c
SS
96 prerequires
97 coreutils
98 shadow-utils
99 sqlite
100 end
3078b82b 101
476b248c 102 configfiles
3078b82b 103 %{sysconfdir}/pdns/pdns.conf
476b248c
SS
104 end
105
e8e9e8e7
SS
106 datafiles
107 %{sharedstatedir}/pdns/pdns.db
108 end
109
476b248c
SS
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
1f9bc2f0
MT
140
141 package %{name}-debuginfo
142 template DEBUGINFO
143 end
802ea3af 144end