summaryrefslogtreecommitdiff
path: root/src/knot.spec
blob: 5856aab5eec6668d6fd1f2b3a09b87f545f1670b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Summary: KNOT DNS daemon
Name: knot
Version: 0.9.1
Release: 1
License: GPL
Group: Networking/Daemons
Source: http://public.nic.cz/files/knot-dns/knot-%{version}.tar.gz
Source1: %{name}.sysconfig
Source2: %{name}.service
Patch: %{name}.diff
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-build
Url: http://www.knot-dns.cz
BuildRequires: flex userspace-rcu-devel openssl-devel bison

%description
KNOT DNS is a high-performance authoritative DNS server implementation.

%prep
%setup -n %{name}-%{version}
%patch -p1


%build
./configure --prefix=%{_prefix} --sysconfdir=%{_sysconfdir}/%{name} --localstatedir=%{_var}/lib --libexecdir=%{_libexecdir}/%{name}
make -C samples %{name}.sample.conf
make


%install
rm -rf %{buildroot}/*
make install prefix=%{buildroot}/%{_prefix} sysconfdir=%{buildroot}/%{_sysconfdir}/%{name} localstatedir=%{buildroot}/%{_var}/lib mandir=%{buildroot}/%{_mandir} libexecdir=%{buildroot}/%{_libexecdir}/%{name}

install -d %{buildroot}/%{_sysconfdir}/sysconfig
install $RPM_SOURCE_DIR/%{name}.sysconfig %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
install -d %{buildroot}/%{_var}/lib/%{name}
install -d %{buildroot}/lib/systemd/system/
install $RPM_SOURCE_DIR/%{name}.service %{buildroot}/lib/systemd/system/%{name}.service

%post
# run after an installation
if [ $1 -eq 1 ] ; then
    # Initial installation
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi

%preun
# run before a package is removed
if [ $1 -eq 0 ]; then
    /bin/systemctl --no-reload disable %{name}.service >/dev/null 2>&1 || :
    /bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
fi

%postun
# run after a package is removed
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ]; then
    /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
fi

%triggerun -- knot < 0.9
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply %{name}
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save %{name}

/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
/bin/systemctl daemon-reload >/dev/null 2>&1 || :



%files
%defattr(-,root,root,-)
%config %attr(644,root,root) %{_sysconfdir}/%{name}/*
%{_sbindir}/*
%{_libexecdir}/%{name}/*
%dir %{_var}/lib/%{name}/
%doc %{_mandir}/man8/*
%attr(0644,root,root) /lib/systemd/system/%{name}.service
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}



%changelog
* Mon Jan 16 2012 - feela@network.cz
- Support for systemd.
- Specfile cleanup

* Thu Nov 3 2011 - feela@network.cz
- Initial version