Blob Blame History Raw
Name:		maradns
Version:	1.3.07.09
Release:	4%{?dist}
Summary:	Authoritative and recursive DNS server made with security in mind

Source0:	http://www.maradns.org/download/1.3/%{version}/%{name}-%{version}.tar.lzma
Source1:	maradns.init
Source2:	zoneserver.init
Group:		System Environment/Daemons
License:	BSD
URL:		http://www.maradns.org/

BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

# lzma for decompressing in EL-5
BuildRequires:		lzma
Requires(pre):		shadow-utils
Requires(post):		/sbin/chkconfig
Requires(preun):	/sbin/chkconfig
Requires(preun):	/sbin/service
Requires:		initscripts

%description
MaraDNS is a package that implements the Domain Name Service (DNS), an
essential internet service. MaraDNS has the following advantages:
	* Secure.
	* Supported.
	* Easy to use.
	* Small.
	* Open Source.

%prep
%setup -q

# wrong permissions
chmod 0644 doc/en/man/make.pdf
chmod 0644 doc/en/tutorial/make.index
chmod 0644 doc/en/webpage/make.page

# wrong EOL encoding
pushd doc
sed -i 's/\r//' pt_br/source/compile.ej
sed -i 's/\r//' pt_br/source/authoritative.ej
sed -i 's/\r//' pt_br/source/dangling.ej
sed -i 's/\r//' pt_br/source/zoneserver.ej
sed -i 's/\r//' pt_br/source/csv2.ej
popd

# wrong char encoding
pushd doc/pt_br/source
for file in *; do
	iconv -f iso8859-1 -t utf-8 $file > $file.new && mv $file.new $file
done
popd


%build

# We don't use %%configure here because this is a homebrew configure not generated by autoconf

./configure
%{__make} %{?_smp_mflags} FLAGS="%{optflags} -DSELECT_PROBLEM"


%install
%{__rm} -rf %{buildroot}

# create /etc/maradns and /etc/mararc first
%{__install} -d -m 0755 %{buildroot}%{_sysconfdir}/maradns/logger/
%{__install} -D -m 0644 build/rpm.mararc %{buildroot}%{_sysconfdir}/mararc

# sbin files
%{__install} -D -m 0755 server/maradns %{buildroot}%{_sbindir}/maradns
%{__install} -D -m 0755 tcp/zoneserver %{buildroot}%{_sbindir}/zoneserver

# bin files
%{__install} -D -m 0755 tcp/getzone %{buildroot}%{_bindir}/getzone
%{__install} -D -m 0755 tcp/fetchzone %{buildroot}%{_bindir}/fetchzone
%{__install} -D -m 0755 tools/askmara %{buildroot}%{_bindir}/askmara
%{__install} -D -m 0755 tools/duende %{buildroot}%{_bindir}/duende

# man pages
%{__install} -d -m 0755 %{buildroot}%{_mandir}/man{1,5,8}
%{__install} -D -m 0644 -t %{buildroot}%{_mandir}/man1/ \
	doc/en/man/askmara.1 \
	doc/en/man/getzone.1 \
	doc/en/man/fetchzone.1
%{__install} -D -m 0644 -t %{buildroot}%{_mandir}/man5/ \
	doc/en/man/csv1.5 \
	doc/en/man/csv2.5 \
	doc/en/man/csv2_txt.5 \
	doc/en/man/mararc.5
%{__install} -D -m 0644 -t %{buildroot}%{_mandir}/man8/ \
	doc/en/man/maradns.8 \
	doc/en/man/zoneserver.8 \
	doc/en/man/duende.8

# init files
%{__install} -D -m 0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/maradns
%{__install} -D -m 0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/init.d/maradns-zoneserver

%{__rm} CHANGELOG CREDITS FAQ
ln -fs en/changelog.txt CHANGELOG
ln -fs en/credits.txt CREDITS
ln -fs en/faq.txt FAQ


%clean
%{__rm} -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc CHANGELOG COPYING CREDITS FAQ doc/*
%doc maradns.gpg.key

%config(noreplace) %{_sysconfdir}/mararc
%attr(-,maradns,maradns) %{_sysconfdir}/maradns/
%{_sysconfdir}/init.d/maradns
%{_sysconfdir}/init.d/maradns-zoneserver

%{_bindir}/askmara
%{_bindir}/duende
%{_bindir}/fetchzone
%{_bindir}/getzone
%{_sbindir}/maradns
%{_sbindir}/zoneserver

%{_mandir}/man1/askmara.1*
%{_mandir}/man1/getzone.1*
%{_mandir}/man1/fetchzone.1*
%{_mandir}/man5/csv1.5*
%{_mandir}/man5/csv2.5*
%{_mandir}/man5/csv2_txt.5*
%{_mandir}/man5/mararc.5*
%{_mandir}/man8/maradns.8*
%{_mandir}/man8/zoneserver.8*
%{_mandir}/man8/duende.8*


%pre
if [ $1 -eq 1 ]; then
	getent group maradns >/dev/null || groupadd -r maradns
	getent passwd maradns >/dev/null || \
	useradd -r -g maradns -d /etc/maradns -s /sbin/nologin \
		-c "MaraDns chroot user" maradns
	exit 0
fi


%post
if [ $1 -eq 1 ]; then
	echo maradns_uid=$(id -u maradns) >> %{_sysconfdir}/mararc
	echo maradns_gid=$(id -g maradns) >> %{_sysconfdir}/mararc
	/sbin/chkconfig --add maradns
	/sbin/chkconfig --add maradns-zoneserver
fi


%preun
if [ $1 -eq 0 ]; then
	/sbin/service maradns stop &>/dev/null || :
	/sbin/chkconfig --del maradns
	/sbin/service maradns-zoneserver stop &>/dev/null || :
	/sbin/chkconfig --del maradns-zoneserver
fi

%postun
if [ $1 -eq 1 ]; then
	/sbin/service maradns condrestart &>/dev/null || :
	/sbin/service maradns-zoneserver condrestart &>/dev/null || :
fi


%changelog
* Wed Aug 12 2009 Ville Skyttä <ville.skytta@iki.fi> - 1.3.07.09-4
- Use lzma compressed upstream tarball.

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.07.09-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.07.09-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sun Feb 22 2009 Michael Fleming <mfleming+rpm@enlartenment.com> - 1.3.07.09-1
- Updated to 1.3.07.09
- Fix condrestart issues in initscripts (bz#483471)

* Mon Jan 28 2008 Brandon Holbrook <fedora at theholbrooks.org> - 1.3.07.08-1
- Updated to 1.3.07.08

* Mon Oct  1 2007 Brandon Holbrook <fedora at theholbrooks.org> - 1.2.12.08-1
- Updated to 1.2.12.08
- Converted non-UTF8-encoded files to UTF8

* Thu Aug 23 2007 Brandon Holbrook <fedora at theholbrooks.org> - 1.2.12.07-1
- Updated to 1.2.12.07
- Added a maradns user/group for chroot

* Thu Jun 28 2007 Brandon Holbrook <fedora at theholbrooks.org> - 1.2.12.06-3
- fix some tarball permissions and line endings
- Created new init scripts with more functions

* Sun Jun 24 2007 Brandon Holbrook <fedora at theholbrooks.org> - 1.2.12.06-2
- manually run ./configure and make rather than the included ./compile.sh
	to preserve optflags
- Add dependency on chkconfig and initscripts

* Sat Jun 23 2007 Brandon Holbrook <fedora at theholbrooks.org> - 1.2.12.06-1
- Release 1.2.12.06
- Rewritten to call install manually instead of 'make install'