File netatalk.spec of Package netatalk

#
# spec file for package netatalk
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           netatalk
BuildRequires:  cups cups-devel db-devel openslp-devel openssl-devel pam-devel tcpd-devel zlib-devel
BuildRequires:  fdupes libavahi-devel libgcrypt-devel pkg-config
Url:            http://netatalk.sourceforge.net/
#
# --enable-fhs puts config files in /etc/netatalk
#
%define	netatalk_pkgconfdir	/etc/netatalk
#
License:        GPL v2 or later
Group:          Productivity/Networking/System
PreReq:         %insserv_prereq %fillup_prereq
Requires:       db-utils
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Version:        2.2.1
Release:        1
Summary:        AppleTalk for Linux
# http://belnet.dl.sourceforge.net/sourceforge/netatalk/netatalk-1.6.2.tar.bz2
Source:         ftp://ftp.sourceforge.net/pub/sourceforge/n/ne/netatalk/netatalk-%{version}.tar.bz2
Source1:        netatalk-latinize.pl
Source2:        rcnetatalk.sh
Source3:        netatalk-autogen.sh
Source4:        netatalk-rpmlintrc
Source6:        netatalk-upgrade_netatalk_AppleDB.sh
Patch1:         netatalk.papd.ppdfile.patch
Patch2:         netatalk-build.patch

%description
Netatalk is a freely-available Open Source AFP fileserver. It also
provides a kernel level implementation of the AppleTalk Protocol
Suite. A *NIX/*BSD system running Netatalk is capable of serving many
Macintosh clients simultaneously as an AppleShare file server (AFP),
AppleTalk router, *NIX/*BSD print server, and for accessing AppleTalk
printers via Printer Access Protocol (PAP). Included are a number of
minor printing and debugging utilities.


Authors:
--------
    Wesley Craig <netatalk@umich.edu>
    Ann Arbor <netatalk@umich.edu>
    and the netatalk team at sourceforge.net

%package devel
License:        GPL v2 or later
Summary:        Appletalk for Linux
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version} glibc-devel

%description devel
Netatalk is a freely-available Open Source AFP fileserver. It also
provides a kernel level implementation of the AppleTalk Protocol
Suite. A *NIX/*BSD system running Netatalk is capable of serving many
Macintosh clients simultaneously as an AppleShare file server (AFP),
AppleTalk router, *NIX/*BSD print server, and for accessing AppleTalk
printers via Printer Access Protocol (PAP). Included are a number of
minor printing and debugging utilities.


Authors:
--------
    Wesley Craig <netatalk-devel@umich.edu>
    Ann Arbor <netatalk-devel@umich.edu>
    and the netatalk team at sourceforge.net

%prep
%setup -q -n netatalk-%{version}
%patch1 -p1
%patch2 -p1
cp -avL %{SOURCE1} .
cp -avL %{SOURCE2} distrib/initscripts/rc.atalk.suse.tmpl
cat >> config/AppleVolumes.default.tmpl <<EOF
#
# the user home directory
# use the ISO-8859-15 for old installs, netatalk1 had ISO-8859-15 as the default
#~	options:mswindows volcharset:ISO-8859-15
# UTF-8 should be the default for everything new
#~	options:mswindows volcharset:UTF8
#
# example:
# /local/share	"project server"	options:mswindows volcharset:UTF8
#
EOF
sed -i 's/^ATALK_BGROUND=.*/ATALK_BGROUND=yes/' config/netatalk.conf
echo 'AFPD_OPTIONS=-t' >> config/netatalk.conf
cat  >> config/papd.conf <<EOF
# SuSE example configuration for PostScript level 1
# it requires a configured lpr or cups daemon
#
#"Netatalk Network Printer":pr=|/usr/bin/lpr -Plp:\\
#			:pd=/usr/share/a2ps/ppd/level1.ppd:\\
#			:op=root:
EOF
mkdir example-configs
# afpd.conf will be copied later
cp -av config/{AppleVolumes.default.tmpl,AppleVolumes.system,atalkd.conf,netatalk.conf,papd.conf} example-configs/

%build
sh %{SOURCE3}
LDFLAGS="-lpthread" \
CFLAGS="$RPM_OPT_FLAGS -Wall -g -pie -fpie" \
%configure --disable-static --with-pic\
	--without-logfile \
	--with-shadow \
	--with-pam \
	\
	--enable-pgp-uam \
	--enable-krb4-uam \
	--enable-timelord \
        --enable-ddp \
	--enable-suse \
	--enable-fhs \
	--enable-overwrite \
	--disable-quota \
	--with-spooldir=/var/spool/cups/tmp \
	\
	--libexecdir=%{_libdir}/netatalk
make %{?jobs:-j%jobs}

%install
%makeinstall
rm -fv $RPM_BUILD_ROOT%{_bindir}/acleandir.rc
ln -sf ../../etc/init.d/netatalk $RPM_BUILD_ROOT%{_sbindir}/rcnetatalk
cp -avL %{SOURCE6} $RPM_BUILD_ROOT%{_sbindir}/upgrade_netatalk_AppleDB.sh
#
# Conflicts with yudit
rm -f $RPM_BUILD_ROOT%{_bindir}/uniconv
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/uniconv.1*
#
cp -av config/afpd.conf example-configs/
ls -1 $RPM_BUILD_ROOT%{_sbindir}/* |
grep -v /usr/sbin/papd$ |
sed "s#^$RPM_BUILD_ROOT#%attr(755,root,root) #" > files.netatalk
#
mkdir -p $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/examples
cp -r AUTHORS CONTRIBUTORS COPYING COPYRIGHT doc/DEVELOPER doc/README.* NEWS services.atalk VERSION $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/
install -m755 netatalk-latinize.pl $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/examples/
#
find %{buildroot} -type f -name "*.la" | xargs rm -vf
%fdupes -s $RPM_BUILD_ROOT%{_mandir}

%pre
test -f etc/atalk/afpd.conf && {
echo 
echo "netatalk config files have been moved to /etc/netatalk"
echo "a backup can be found in /etc/atalk"
echo "please compare them before restarting the netatalk server"
}
exit 0

%preun
%stop_on_removal atalk

%post
%{fillup_and_insserv netatalk}

%postun
%restart_on_update
%insserv_cleanup

%files -f files.netatalk
%defattr (-,root,root)
%doc %{_defaultdocdir}/%{name}
%dir %{_libdir}/netatalk
%{_libdir}/netatalk/*
%{_mandir}/man?/*
#
%dir %{netatalk_pkgconfdir}
%dir %{_sysconfdir}/pam.d
%config (noreplace) %{netatalk_pkgconfdir}/AppleVolumes.*
%config (noreplace) %{netatalk_pkgconfdir}/*.conf
%config %{_sysconfdir}/pam.d/*
#
%attr(755,root,root) %{_sysconfdir}/init.d/netatalk
%attr(755,root,root) %{_bindir}/*
%attr(755,root,lp) %{_sbindir}/papd

%files devel
%defattr (-,root,root)
%{_libdir}/lib*
%dir %{_datadir}/aclocal
%dir %{_includedir}/atalk
%dir %{_includedir}/netatalk
%dir %{_datadir}/netatalk
%{_datadir}/aclocal/*
%{_includedir}/atalk/*
%{_includedir}/netatalk/*
%{_datadir}/netatalk/*

%changelog
openSUSE Build Service is sponsored by