File netatalk.spec of Package netatalk

#
# spec file for package netatalk (Version 2.0.3)
#
# Copyright (c) 2009 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
Url:            http://netatalk.sourceforge.net/
%define myrelease %(date +%s)
%define netatalk_realversion	2.0.3
#
# --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.0.3
Release:        246.<RELEASE11>
#Release:      %{myrelease}
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-%{netatalk_realversion}.tar.bz2
Source1:        netatalk-latinize.pl
Source2:        rcnetatalk.sh
Source3:        netatalk-autogen.sh
Source4:        netatalk-rpmlintrc
Source6:        netatalk-upgrade_netatalk_AppleDB.sh
Patch0:         netatalk-branch-netatalk-2-0.patch.bz2
Patch1:         netatalk.papd.vars.patch
Patch2:         netatalk.papd.quote-vars.patch
Patch3:         netatalk.papd.quote-vars.fixed.patch
Patch4:         netatalk.papd.stderr.patch
Patch10:        netatalk-1.6-suse.patch
Patch11:        netatalk-la_libdir.patch
Patch12:        netatalk.pie-flags.patch
Patch100:       netatalk.ad_hf_mode.patch
Patch101:       netatalk-asingle-outofbounds.patch

%description
Netatalk is an implementation of the AppleTalk Protocol Suite for Unix
and Linux systems. The current release contains support for Ethertalk
phase I and II, DDP, RTMP, NBP, ZIP, AEP, ATP, PAP, ASP, and AFP. It
provides AppleTalk file printing and routing services on Solaris 2.5,
Linux, FreeBSD, SunOS 4.1, and Ultrix 4. It also supports AFP 2.1 and
2.2 (AppleShare IP).



Authors:
--------
    Wesley Craig <netatalk@umich.edu>
    Ann Arbor <netatalk@umich.edu>

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

%description devel
netatalk is an implementation of the AppleTalk Protocol Suite for UNIX
and Linux systems. The current release contains support for Ethertalk
Phase I and II, DDP, RTMP, NBP, ZIP, AEP, ATP, PAP, ASP, and AFP. It
provides Appletalk file printing and routing services on Solaris 2.5,
Linux, FreeBSD, SunOS 4.1, and Ultrix 4. It also supports AFP 2.1 and
2.2 (Appleshare IP).



Authors:
--------
    Wesley Craig <netatalk-devel@umich.edu>
    Ann Arbor <netatalk-devel@umich.edu>

%prep
%setup -q -n netatalk-%{netatalk_realversion}
%patch0
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch10
%patch11 -p1
%patch12 -p1
%patch100 -p1
%patch101 -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" \
%configure \
	--without-logfile \
	--with-tcp-wrappers \
	--with-shadow \
	--with-pam \
	--with-ssl \
	--with-mangling \
	\
	--enable-pgp-uam \
	--enable-krb4-uam \
	--enable-timelord \
	--enable-suse \
	--enable-fhs \
	--enable-overwrite \
	--disable-quota \
	\
	--libexecdir=%{_libdir}/netatalk
make %{?jobs:-j%jobs}

%install
%makeinstall
rm -fv $RPM_BUILD_ROOT/usr/bin/acleandir.rc
mkdir -p $RPM_BUILD_ROOT/etc/pam.d
cp -av config/netatalk.pamd $RPM_BUILD_ROOT/etc/pam.d/netatalk
ln -sf ../../etc/init.d/atalk $RPM_BUILD_ROOT/usr/sbin/rcatalk
cp -avL %{SOURCE6} $RPM_BUILD_ROOT/usr/sbin/upgrade_netatalk_AppleDB.sh
#
# Conflicts with yudit
rm -f $RPM_BUILD_ROOT/usr/bin/uniconv
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/uniconv.1*
#
cp -av config/afpd.conf example-configs/
ls -1 $RPM_BUILD_ROOT/usr/sbin/* |
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 services.atalk README* C* TODO doc/FAQ doc/README.* contrib/macusers/README* example-configs $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/
install -m755 netatalk-latinize.pl $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/examples/
#
%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 atalk}

%postun
%insserv_cleanup

%files -f files.netatalk
%defattr (-,root,root)
%doc %{_defaultdocdir}/%{name}
%dir /usr/share/netatalk
%dir %{_libdir}/netatalk
/usr/share/netatalk/*
%{_libdir}/netatalk/*
%exclude %{_libdir}/netatalk/*.a
%{_mandir}/man?/*
#
%dir %{netatalk_pkgconfdir}
%dir /etc/pam.d
%config (noreplace) %{netatalk_pkgconfdir}/AppleVolumes.*
%config (noreplace) %{netatalk_pkgconfdir}/*.conf
%config /etc/pam.d/*
#
%attr(755,root,root) /etc/init.d/atalk
%attr(755,root,root) /usr/bin/*
%attr(755,root,lp) /usr/sbin/papd

%files devel
%defattr (-,root,root)
%{_libdir}/lib*
%dir /usr/share/aclocal
%dir /usr/include/atalk
%dir /usr/include/netatalk
/usr/share/aclocal/*
/usr/include/atalk/*
/usr/include/netatalk/*
%{_libdir}/netatalk/*.a

%changelog
* Wed Jan 28 2009 olh@suse.de
- quote more chars in popen variables expansion (still bnc#463575)
* Fri Jan 09 2009 olh@suse.de
- papd fixes from 2.0.4 (bnc#463575 - CVE-2008-5718):
  quote chars in popen variables expansion
  papd -d doesn't write to stderr. From Martin Nagy
  vars use %% not $
* Tue Sep 16 2008 lrupp@suse.de
- fix other rpmlint warnings/failures
* Wed Aug 27 2008 olh@suse.de
- add Should-Stop to rcatalk
  move dependencies from Required-Start to Should-Start
* Fri Mar 30 2007 olh@suse.de
- add zlib-devel to buildrequires
* Thu Mar 23 2006 olh@suse.de
- add AFPD_OPTIONS to netatalk.conf and start afpd with -t (160167)
* Tue Mar 21 2006 olh@suse.de
- store UTF8 per default on the server side
* Mon Mar 20 2006 olh@suse.de
- add upgrade_netatalk_AppleDB.sh to simplify upgrade of cnid.db
* Thu Mar 16 2006 olh@suse.de
- only run rcatalk as root (158466)
* Wed Feb 22 2006 olh@suse.de
- start slpd before atalk
- remove the 'mswindows' option from AppleVolumes.default,
  it appears now as volume name
- fix out-of-bounds access in asingle (151539)
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Fri Oct 21 2005 olh@suse.de
- update to current branch-netatalk-2-0 status
- link db4 with pthread
* Thu Sep 22 2005 olh@suse.de
- update to current branch-netatalk-2-0 status
  remove source dir from .la files
* Tue Jul 12 2005 olh@suse.de
- build with --disable-quota, librpcsvc.a is not compiled with -fPIC
  move -fpie/-pie flags from global CFLAGS to every subdir with
  binaries
* Tue Jun 21 2005 olh@suse.de
- update to netatalk 2.0.3
  build with -fpie/-pie
* Thu Mar 10 2005 olh@suse.de
- remove non-utf8 char from Applevolumes.default file (#71258)
  remove iso8859-1 encoding from AppleVolumes.default
* Sat Feb 05 2005 olh@suse.de
- update to current cvs netatalk-2.0 branch
* Tue Jan 25 2005 olh@suse.de
- Update to netatalk 2.0.2, enable openslp and cups
* Sat Nov 20 2004 schwab@suse.de
- Remove uniconv.
* Tue Nov 16 2004 schwab@suse.de
- Update to netatalk 2.0.1.
* Mon Nov 15 2004 kukuk@suse.de
- Use common-* PAM config files
* Thu Mar 18 2004 olh@suse.de
- add netatalk-1.6.4.etc2ps_tmpfile.patch,
  better tmpfile handling (#36371)
* Sat Jan 24 2004 olh@suse.de
- update to 1.6.5rc1
* Sat Jan 10 2004 adrian@suse.de
- add %%defattr
* Mon Sep 01 2003 olh@suse.de
- mark /usr/sbin/papd as root.lp in file list to match permissions
  (#29064)
* Sat Aug 09 2003 olh@suse.de
- update for struct quota renames, remove bogus casts
* Sat Jul 05 2003 olh@suse.de
- update to 1.6.3
* Sat May 10 2003 olh@suse.de
- handle Linux 2.5 struct renames
* Tue Apr 22 2003 olh@suse.de
- update to 1.6.2
* Wed Mar 19 2003 olh@suse.de
- update to 1.6.1
* Wed Feb 19 2003 olh@suse.de
- update to 1.6.1rc2, fixes for files without ressource fork:
  -It leaks a system file descriptor each time you open a data fork RW .
  -you can't open the missing ressource fork RW.
* Mon Feb 10 2003 olh@suse.de
- update to current branch-netatalk-1-6 branch
* Fri Feb 07 2003 kukuk@suse.de
- Use pam_unix2.so instead of pam_unix.so
- Change example password configuration from passwd.
* Tue Jan 28 2003 olh@suse.de
- do not install /usr/include/netatalk/at.h, conflicts with glibc
* Sun Jan 26 2003 olh@suse.de
- fix syslog output in etc/afpd/auth.c:login
  fix assignment in etc/afpd/filedir.c
  define _XOPEN_SOURCE in etc/uams/uams_pgp.c for crypt()
  update version number in README
  fix rcatalk path in /usr/bin/cnid_maint
  apply default settings to papd.conf and afpd.conf
  requiress db-utils for CNID DB
  do not use logfile feature
  provide example-configs in doc dir
  print hint in preinstall about changed path to config files
  correct path to netatalk.conf in rcatalk
* Tue Jan 21 2003 olh@suse.de
- update to 1.6.0
  enable CNID DB, enable filename mangling
  write logfile to /var/log/netatalk.log
* Wed Sep 18 2002 ro@suse.de
-  removed bogus self-provides
* Tue Sep 17 2002 olh@suse.de
- remove $netdaemons from required start
  not needed, disables inetd dependency
* Thu Aug 22 2002 olh@suse.de
- remove sgid from papd, not needed anymore with cups
* Tue Aug 20 2002 olh@suse.de
- add netatalk-1.5.3.1-papd_confoverflow.diff
  fixes buffer overflow in papd config file reading (#18103)
* Fri Aug 09 2002 olh@suse.de
- devel requires basepackage
* Wed Jul 31 2002 olh@suse.de
- add PreReq insserv_prereq  fillup_prereq
* Tue Jul 16 2002 olh@suse.de
- update to current 1.5.4 cvs, add libtatalk/pap to makerules
  rcnetatalk is now a separate file
* Fri May 24 2002 olh@suse.de
- add pap from current cvs
* Tue May 14 2002 olh@suse.de
- remove /usr/bin/acleandir.rc (what ever it is, it is evil)
* Fri May 10 2002 olh@suse.de
- add latinize.pl for easier migration to native Linux filenames
* Sat May 04 2002 olh@suse.de
- update to 1.5.3.1
* Mon Apr 29 2002 olh@suse.de
- move /etc/atalk/uams to /usr/lib/netatalk/
  use libdir for -devel pacakge
* Tue Mar 12 2002 draht@suse.de
- Don't run appletalk by default after installation.
* Fri Feb 15 2002 olh@suse.de
- make startup scripts LSB conform (#13288)
* Mon Feb 11 2002 olh@suse.de
- fix startup scripts for real
* Mon Feb 11 2002 olh@suse.de
- fix startup scripts
  print hint on atalkd startup failure
* Mon Feb 11 2002 olh@suse.de
- update to 1.5.1.1
* Tue Jan 15 2002 olh@suse.de
- update to 1.5.0
* Tue Jan 15 2002 egmont@suselinux.hu
- removed colons from startup/shutdown messages
* Fri Nov 23 2001 olh@suse.de
- update to current CVS, implement new startup scheme
* Sat Oct 06 2001 olh@suse.de
- provide a default printer in papd.conf
* Sat Oct 06 2001 olh@suse.de
- update to 1.5pre8 + CVS
* Tue Oct 02 2001 olh@suse.de
- start netatalk in background per default
* Fri Sep 28 2001 olh@suse.de
- really fix the startup script
  * libatalk/cnid/cnid_open.c: Set internal deadlock detection
* Sat Sep 22 2001 olh@suse.de
- fix startup scripts
  make nls codepage
* Sat Sep 22 2001 olh@suse.de
- fix codepage conversion (#10828)
* Fri Sep 21 2001 olh@suse.de
- update to current CVS, seems to fix netatalk MacOS X connects
* Sat Sep 01 2001 olh@suse.de
- fix initscript to not use "" in server name argument
* Sat Sep 01 2001 olh@suse.de
- update to current CVS
* Sat Sep 01 2001 olh@suse.de
- fix build, rm acinclude.m4
* Thu Aug 30 2001 olh@suse.de
- update to 1.5pre7, use db3/db.h
* Mon Aug 20 2001 olh@suse.de
- update to current CVS version
* Fri Jul 20 2001 olh@suse.de
- update to current CVS version
* Mon Jun 25 2001 olh@suse.de
- more info about remote quark ...
* Mon Jun 25 2001 olh@suse.de
- fix Makefile.am
* Sun Jun 24 2001 olh@suse.de
- update README.SuSE with some Quark stuff, update rc script
* Thu Jun 21 2001 olh@suse.de
- update to current CVS version, seems to work...
* Wed May 09 2001 olh@suse.de
- disable --enable-debug option, useless for production
  fills up the logfiles ...
* Thu Mar 29 2001 schwab@suse.de
- Use $(CC) instead of $(LD).
* Tue Jan 23 2001 olh@suse.de
- build with --enable-lastdid
* Wed Jan 17 2001 olh@suse.de
- fix filelist
* Wed Jan 17 2001 olh@suse.de
- move /lib/security/* to /etc/pam.d/*
* Thu Jan 11 2001 olh@suse.de
- use --with-flock-locks, seems to fix bugs when you edit files in
  Quark Express on the server volume
- add ATALK_AFPD_OPTIONS in rc.config to pass options to the afpd
* Mon Dec 11 2000 olh@suse.de
- --enable-debug, noreplace for config files (#4501)
* Tue Dec 05 2000 olh@suse.de
- disable suseupdateconfig for now
* Mon Dec 04 2000 ro@suse.de
- avoid conflict with glibc-devel
* Tue Nov 28 2000 ro@suse.de
- fixed Makefiles ... needs further testing
* Tue Nov 28 2000 ro@suse.de
- update to 1.4.99
- initscript to etc/init.d
* Wed May 24 2000 uli@suse.de
- moved docs to /usr/share
* Sat Apr 29 2000 kukuk@suse.de
- Add tcpd to need for build, fix quota prototypes
* Thu Mar 02 2000 olh@suse.de
- add some extensions, fix .pdf files
* Wed Mar 01 2000 werner@suse.de
- Fix config.guess selection
* Tue Jan 18 2000 cep@suse.de
- fit to new man path /usr/share/man
* Thu Dec 02 1999 olh@suse.de
- set papd g+s lp to correct the permissions of the spool files
* Tue Oct 26 1999 cep@suse.de
- enabled PAM support, tested against MacOS 8.5
* Mon Sep 13 1999 bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
* Tue Jun 15 1999 ro@suse.de
- create nls-dir before make install
* Thu Jun 10 1999 cep@suse.de
- updated to recent version netatalk-1.4b2+asun2.1.3, checked with
  Mac OS D1-8.5.1, Mac OS Rom D1 - 1.2
- added entry eth0 to /etc/atalk/atalkd.conf
* Wed Feb 03 1999 ro@suse.de
- use lcrypt on alpha as well
* Fri Jan 08 1999 cep@suse.de
- modified /sbin/init.d/atalk due to very long startup time of atalkd
* Fri Dec 11 1998 tmg@suse.de
- changed START_ATALK default to no
* Tue Dec 08 1998 ro@suse.de
- updated init-script and added rc-link
* Tue Oct 06 1998 ro@suse.de
- link with -lcrypt where necessary
- only include sys/types in at.h for glibc
* Sun Jul 26 1998 bs@suse.de
- install at.h as at.netatalk.h.
* Fri Jul 17 1998 reinhold@suse.de
- AFP 2.2 (Appleshare TCPIP) support included (asun2.0a18.2-0 patch)
* Sun Mar 01 1998 reinhold@suse.de
- README.SuSE updated
* Fri Feb 20 1998 reinhold@suse.de
- support for shadow included
* Wed Dec 03 1997 bs@suse.de
- install /usr/include/netatalk/at.h as at.netatalk.h (at.h ist also
  in libc)
* Tue Aug 19 1997 reinhold@suse.de
- war heiss heute