File netatalk.spec of Package netatalk

#
# spec file for package netatalk
#
# Copyright (c) 2012 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/
#



Name:           netatalk
BuildRequires:  cups
BuildRequires:  cups-devel
BuildRequires:  db-devel
BuildRequires:  fdupes
BuildRequires:  krb5-devel
BuildRequires:  libacl-devel
BuildRequires:  libavahi-devel
BuildRequires:  libgcrypt-devel
BuildRequires:  libtool
BuildRequires:  openldap2-devel
BuildRequires:  openslp-devel
BuildRequires:  openssl-devel
BuildRequires:  pam-devel
BuildRequires:  pkg-config
BuildRequires:  tcpd-devel
BuildRequires:  zlib-devel
%if 0%{?suse_version} > 1140
BuildRequires:  systemd
%endif
Url:            http://netatalk.sourceforge.net/
#
# --enable-fhs puts config files in /etc/netatalk
#
%define	netatalk_pkgconfdir	/etc/netatalk
#
PreReq:         %insserv_prereq %fillup_prereq
Requires:       db-utils libldap-2_4-2 cyrus-sasl
%if 0%{?suse_version} > 1140
##Requires:       %{?systemd_requires}
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Version:        2.2.2
Release:        0
Summary:        AppleTalk for Linux
License:        GPL-2.0+
Group:          Productivity/Networking/System
# 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

%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
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
cp -avL %{SOURCE1} .
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-ldap \
        --enable-acls \
	--enable-pgp-uam \
	--enable-krb4-uam \
        --enable-krbV-uam \
	--enable-timelord \
        --enable-ddp \
	--enable-suse-systemd \
	--enable-fhs \
	--enable-overwrite \
	--enable-quota \
	--with-spooldir=/var/spool/cups/tmp \
	\
	--libexecdir=%{_libdir}/netatalk
make %{?jobs:-j%jobs}

%install
%makeinstall
rm -fv $RPM_BUILD_ROOT%{_bindir}/acleandir.rc
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d/
install -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/netatalk
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"
}
%if 0%{?suse_version} > 1140
%service_add_pre netatalk.service
%endif
exit 0

%preun
%stop_on_removal netatalk
%if 0%{?suse_version} > 1140
%service_del_preun netatalk.service
%endif

%post
%{fillup_and_insserv netatalk}
%restart_on_update netatalk
%if 0%{?suse_version} > 1140
%service_add_post netatalk.service
%endif

%postun
%insserv_cleanup
%if 0%{?suse_version} > 1140
%service_del_postun netatalk.service
%endif

%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
/lib/systemd/system/netatalk.service
%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