Summary: The LPRng print spooler.
Name: LPRng
Version: 3.8.19
Release: 3
License: GPL and Artistic
Group: System Environment/Daemons
Source0: ftp://ftp.lprng.com/pub/LPRng/LPRng/%{name}-%{version}.tgz
Source1: lpd.init
Patch0: LPRng-3.8.4-nonblock.patch
Patch1: LPRng-3.7.4-lpd-perms.patch
Patch2: LPRng-3.8.15-krb5.patch
Patch3: LPRng-3.8.19-destdir.patch
URL: http://www.lprng.com
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
Obsoletes: lpr
Provides: lpr
Prereq: /etc/rc.d/init.d, mktemp, fileutils, textutils, gawk
PreReq: /usr/sbin/alternatives
# Alternatives is provided by chkconfig at the moment.  1.3.4 is the
# minimum we need (see bug #62342).
PreReq: chkconfig >= 1.3.4-1
BuildPreReq: gettext ed autoconf
%{!?nokerberos:BuildPrereq: krb5-devel}

# We don't ship these files, but create symlinks to them.  Other
# packages aren't to know though.
Provides: %{_bindir}/lp
Provides: %{_bindir}/lpq
Provides: %{_bindir}/lpr
Provides: %{_bindir}/lprm
Provides: %{_bindir}/lpstat
Provides: %{_bindir}/cancel
Provides: %{_sbindir}/lpc

%description
LPRng is an enhanced, extended, and portable implementation of the
Berkeley LPR print spooler functionality. LPRng provides the same
interface and meeting RFC1179 requirements, but the implementation is
completely new and provides support for the following features:
lightweight (no databases needed) lpr, lpc, and lprm programs; dynamic
redirection of print queues; automatic job holding; highly verbose
diagnostics; multiple printers serving a single queue; client programs
do not need to run SUID root; greatly enhanced security checks; and a
greatly improved permission and authorization mechanism.

LPRng is compatible with other print spoolers and network printers
that use the LPR interface and meet RFC1179 requirements. LPRng
provides emulation packages for the SVR4 lp and lpstat programs,
eliminating the need for another print spooler package. These
emulation packages can be modified according to local requirements, in
order to support vintage printing systems.

For users who require secure and/or authenticated printing support,
LPRng supports Kerberos V, MIT Kerberos IV Print Support, and PGP
authentication. Additional authentication support is extremely simple
to add.

%prep
%setup -q
%patch0 -p1 -b .nonblock
# Remove remote job submissions
%patch1 -p1 -b .lpd-perms
%patch2 -p1 -b .krb5
%patch3 -p1 -b .destdir

%build
test -f /usr/share/libtool/config.guess && cp /usr/share/libtool/config.guess .
test -f /usr/share/libtool/config.sub   && cp /usr/share/libtool/config.sub .
CFLAGS="$RPM_OPT_FLAGS" ; export CFLAGS
PSHOWALL="-ax" ; export PSHOWALL # So that we don't need /proc mounted
%configure --enable-nls \
        --with-userid=lp \
        --with-groupid=lp \
        --disable-gdbm \
        --disable-strip \
        --disable-werror \
%{!?nokerberos:--enable-kerberos}
make MAKEPACKAGE=YES

%install
rm -rf %{buildroot}
make SUID_ROOT_PERMS=" 04755" DESTDIR=${RPM_BUILD_ROOT} MAKEPACKAGE=YES mandir=%{_mandir} install
%__cp src/monitor ${RPM_BUILD_ROOT}%{_prefix}/sbin/monitor

# Remove files we don't ship
rm -f %{buildroot}%{_sysconfdir}/*.sample
rm -f %{buildroot}%{_sysconfdir}/printcap
rm -f %{buildroot}%{_libdir}/liblpr.*a
rm -f %{buildroot}%{_sbindir}/lprng_{index_,}certs

# install init script
mkdir -p %{buildroot}%{_sysconfdir}/rc.d/init.d
install -m755 %{SOURCE1} %{buildroot}%{_sysconfdir}/rc.d/init.d/lpd

# Adjust defaults
cat << EOF | ed %{buildroot}%{_sysconfdir}/lpd.conf
/default mc=/a
mc#128
.
wq
EOF

# Alternatives, to avoid conflicting with cups.
for f in %{_bindir}/{cancel,lp,lp{q,r,rm,stat}} %{_sbindir}/lpc
do
  mv %{buildroot}${f} %{buildroot}${f}.LPRng
done
for f in cancel lp lpq lpr lprm lpstat
do
  mv %{buildroot}%{_mandir}/man1/${f}.1 %{buildroot}%{_mandir}/man1/${f}-LPRng.1
done
mv %{buildroot}%{_mandir}/man8/lpc.8 %{buildroot}%{_mandir}/man8/lpc-LPRng.8

%find_lang %{name}

%clean
rm -rf %{buildroot}

%post
/sbin/ldconfig
/sbin/chkconfig --add lpd
if [ -w /etc/printcap ] ; then
  TMP1=`mktemp /etc/printcap.XXXXXX`
  gawk '
    BEGIN { first = 1; cont = 0; last = "" }
    /^[:space:]*#/      { if(cont) sub("\\\\$", "", last)}
    { if(first == 0) print last }
    { first = 0 }
    { last = $0 }
    { cont = 0 }
    /\\$/ { cont = 1 }
    END {sub("\\\\$", "", last); print last}
  ' /etc/printcap > ${TMP1} && cat ${TMP1} > /etc/printcap && rm -f ${TMP1}
fi

# Alternatives
/usr/sbin/alternatives \
 --install %{_bindir}/lpr print %{_bindir}/lpr.LPRng 30 \
 --slave %{_mandir}/man1/lpr.1.gz print-lprman %{_mandir}/man1/lpr-LPRng.1.gz \
 --slave %{_bindir}/lp print-lp %{_bindir}/lp.LPRng \
 --slave %{_mandir}/man1/lp.1.gz print-lpman %{_mandir}/man1/lp-LPRng.1.gz \
 --slave %{_bindir}/lpq print-lpq %{_bindir}/lpq.LPRng \
 --slave %{_mandir}/man1/lpq.1.gz print-lpqman %{_mandir}/man1/lpq-LPRng.1.gz \
 --slave %{_bindir}/lprm print-lprm %{_bindir}/lprm.LPRng \
 --slave %{_mandir}/man1/lprm.1.gz print-lprmman \
                                        %{_mandir}/man1/lprm-LPRng.1.gz \
 --slave %{_bindir}/lpstat print-lpstat %{_bindir}/lpstat.LPRng \
 --slave %{_mandir}/man1/lpstat.1.gz print-lpstatman \
                                        %{_mandir}/man1/lpstat-LPRng.1.gz \
 --slave %{_bindir}/cancel print-cancel %{_bindir}/cancel.LPRng \
 --slave %{_mandir}/man1/cancel.1.gz print-cancelman \
                                        %{_mandir}/man1/cancel-LPRng.1.gz \
 --slave %{_sbindir}/lpc print-lpc %{_sbindir}/lpc.LPRng \
 --slave %{_mandir}/man8/lpc.8.gz print-lpcman %{_mandir}/man8/lpc-LPRng.8.gz \
 --initscript lpd

%preun
if [ "$1" = 0 ]; then
  %{_sysconfdir}/rc.d/init.d/lpd stop >/dev/null 2>&1
  /sbin/chkconfig --del lpd
  /usr/sbin/alternatives --remove print %{_bindir}/lpr.LPRng
fi

%postun
/sbin/ldconfig
if [ "$1" -ge "1" ]; then
  %{_sysconfdir}/rc.d/init.d/lpd condrestart >/dev/null 2>&1
fi

%triggerpostun -- LPRng < 3.8.5-2
# Deal with pre-alternatives packages
/usr/sbin/alternatives --auto print

%files -f %{name}.lang
%defattr(-,root,root)
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/lpd.conf
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/lpd.perms
%config %{_sysconfdir}/rc.d/init.d/lpd
%{_libdir}/*.so.*
%attr(755,lp,lp) %{_bindir}/lpq.LPRng
%attr(755,lp,lp) %{_bindir}/lprm.LPRng
%attr(755,lp,lp) %{_bindir}/lpr.LPRng
%attr(755,lp,lp) %{_bindir}/lpstat.LPRng
%{_bindir}/lp.LPRng
%{_bindir}/cancel.LPRng
%attr(755,lp,lp) %{_sbindir}/lpc.LPRng
%attr(755,root,root)  %{_sbindir}/lpd
%attr(755,root,root)  %{_sbindir}/checkpc
%attr(755,root,root)  %{_sbindir}/monitor
%attr(755,root,root)  /usr/libexec/filters/*
%dir /usr/libexec/filters
%{_mandir}/*/*
%doc CHANGES CONTRIBUTORS COPYRIGHT INSTALL LICENSE
%doc README* VERSION Y2KCompliance
%doc HOWTO/*.html HOWTO/*.jpg

%changelog
* Thu Jan 23 2003 Tim Waugh <twaugh@redhat.com> 3.8.19-3
- Fix localedir (bug #82492).

* Wed Jan 22 2003 Tim Powers <timp@redhat.com> 3.8.19-2
- rebuilt

* Thu Jan 16 2003 Tim Waugh <twaugh@redhat.com> 3.8.19-1
- 3.8.19 (bug #81970).
- No longer need werror patch.

* Tue Jan  7 2003 Nalin Dahyabhai <nalin@redhat.com> 3.8.15-4
- Rebuild

* Fri Dec 20 2002 Tim Waugh <twaugh@redhat.com> 3.8.15-3
- Make 'service lpd reload' update the configuration first (bug #79953).

* Fri Dec  6 2002 Tim Waugh <twaugh@redhat.com> 3.8.15-2
- Change build requirement from autoconf253 to autoconf.

* Thu Nov  7 2002 Tim Waugh <twaugh@redhat.com> 3.8.15-1
- Updated krb5 patch.
- 3.8.15.
- Removed manpage, jobfilescan, pr patches: no longer needed.
- Updated werror patch.
- Don't install files not shipped.
- Use %%find_lang.

* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Mon Jun 17 2002 Tim Waugh <twaugh@redhat.com> 3.8.9-5
- Rebuild in new environment.

* Thu May 16 2002 Tim Waugh <twaugh@redhat.com> 3.8.9-4
- Reject remote job submissions by default.

* Tue Apr  2 2002 Tim Waugh <twaugh@redhat.com> 3.8.9-3
- PreReq chkconfig 1.3.4-1 or later (bug #62342).
- Don't strip binaries by default during build/install.

* Tue Mar 12 2002 Tim Waugh <twaugh@redhat.com> 3.8.9-2
- AC_C_VOLATILE comes from autoconf 2.52.  Use it.

* Mon Mar 11 2002 Tim Waugh <twaugh@redhat.com> 3.8.9-1
- 3.8.9.
- Patch to fix bug #55376 reverted (documentation now corrected).
- Remove AC_C_VOLATILE (doesn't seem to be defined).
- Conflict with chkconfig < 1.3.1 (alternatives --initscript).

* Fri Mar  8 2002 Bill Nottingham <notting@redhat.com> 3.8.7-3
- use alternatives --initscript support

* Thu Feb 28 2002 Bill Nottingham <notting@redhat.com> 3.8.7-2
- agree with cups about alternative name for lpr man page
- move alternatives removal to %preun

* Mon Feb 25 2002 Tim Waugh <twaugh@redhat.com> 3.8.7-1
- 3.8.7.
- No longer need coredump patch.

* Thu Feb 21 2002 Tim Waugh <twaugh@redhat.com> 3.8.5-4
- Rebuild in new environment.

* Wed Feb 13 2002 Tim Waugh <twaugh@redhat.com> 3.8.5-3
- Better default for maximum copies (bug #59433).
- Skip over non-existent entries, like the documentation says we
  do (bug #55376).

* Wed Jan 30 2002 Tim Waugh <twaugh@redhat.com> 3.8.5-2
- Don't conflict with other print spoolers.

* Tue Jan 29 2002 Tim Waugh <twaugh@redhat.com> 3.8.5-1
- 3.8.5.
- Stop lpstat from dumping core.

* Mon Jan 21 2002 Tim Waugh <twaugh@redhat.com> 3.8.4-1
- 3.8.4 (bug #35636, bug #47865).
- Drop explicit 'Requires: krb5', since it is picked up automatically
  (bug #57458).
- Patches no longer needed: lockfile, nointl, inet_ntop, shutdown, direct,
  setgroup, s390,
- Fix path to pr (bug #39130).
- HOWTO GIFs now replaced by JPEGs.

* Wed Jan 09 2002 Tim Powers <timp@redhat.com> 3.7.4-30
- automated rebuild

* Wed Jan 02 2002 Florian La Roche <Florian.LaRoche@redhat.de> 3.7.4-29
- require krb5 instead of krb5-libs

* Fri Aug 10 2001 Crutcher Dunnavant <crutcher@redhat.com> 3.7.4-28
- disabled gdbm support, changed CFLAGS; #41652

* Thu Aug  9 2001 Crutcher Dunnavant <crutcher@redhat.com> 3.7.4-27
- ownz /usr/libexec/filters; #51158
- make checkpc nonblocking on its tests; #37995

* Thu Aug  2 2001 Crutcher Dunnavant <crutcher@redhat.com> 3.7.4-26
- added gdbm-devel dep; #44885

* Fri Jun 29 2001 Bernhard Rosenkraenzer <bero@redhat.com>
- Fix build on s390

* Sun Jun 24 2001 Elliot Lee <sopwith@redhat.com>
- Bump release + rebuild.

* Thu Jun 07 2001 Crutcher Dunnavant <crutcher@redhat.com>
- setgroups droping patch

* Thu Mar 29 2001 Crutcher Dunnavant <crutcher@redhat.com>
- told checkpc to only Check_file() job files. (keeping it from zapping the master-filter)

* Fri Mar  9 2001 Crutcher Dunnavant <crutcher@redhat.com>
- applied elliot's patch (which i got idependently from the lprng list as well)
- that fixes a thinko that killed LPRng on 64 arches.

* Fri Mar  9 2001 Crutcher Dunnavant <crutcher@redhat.com>
- fixed the URLs for the LPRng project

* Thu Mar  8 2001 Crutcher Dunnavant <crutcher@redhat.com>
- reverted the shutdown call in Local_job to make device filters work.
- all your base are belong to us

* Wed Mar 07 2001 Philipp Knirsch <pknirsch@redhat.de>
- Removed the shutdown patch for common/linksupport:Link_close() as ii
generated a deadlock between lpr and lpd for none existing printers.

* Sun Feb 25 2001 Crutcher Dunnavant <crutcher@redhat.com>
- hacked out the shutdown(sock, 1) calls that killed stupid network printers.

* Wed Feb 15 2001 Crutcher Dunnavant <crutcher@redhat.com>
- tweak to ldp.init's display messages

* Fri Feb  9 2001 Crutcher Dunnavant <crutcher@redhat.com>
- man page tweak

* Thu Feb  8 2001 Crutcher Dunnavant <crutcher@redhat.com>
- (yet) further tweaks to lpd.init's display format.

* Tue Feb  6 2001 Crutcher Dunnavant <crutcher@redhat.com>
- further tweaks to lpd.init's display format.

* Tue Feb  6 2001 Crutcher Dunnavant <crutcher@redhat.com>
- cleaned up lpd.init to do translations correctly, and stop screwing up
- result values.

* Thu Feb  1 2001 Crutcher Dunnavant <crutcher@redhat.com>
- added lpd init back (ick!)

* Wed Jan 24 2001 Crutcher Dunnavant <crutcher@redhat.com>
- removed req for printconf (It should go the other way)

* Thu Jan 18 2001 Crutcher Dunnavant <crutcher@redhat.com>
- fixed file list

* Thu Jan 18 2001 Crutcher Dunnavant <crutcher@redhat.com>
- removed lpd.init, set requirement of printconf

* Thu Jan 11 2001 Crutcher Dunnavant <crutcher@redhat.com>
- upgraded to LPRng-3.7.4

* Tue Dec 12 2000 Crutcher Dunnavant <crutcher@redhat.com>
- rebuild for kerb

* Mon Oct 23 2000 Crutcher Dunnavant <crutcher@redhat.com>
- Upgraded to LPRng-3.6.26
- Removed syslog patch, as .24 fixes the problem

* Mon Sep 25 2000 Crutcher Dunnavant <crutcher@redhat.com>
- Patched use_syslog to avoid a format string exploit.
- Resolves bug #17756

* Mon Sep 18 2000 Crutcher Dunnavant <crutcher@redhat.com>
- Upgraded to LPRng-3.6.24

* Mon Sep 11 2000 Crutcher Dunnavant <crutcher@redhat.com>
- Added gettext to the BuildPreReq list

* Mon Sep 11 2000 Crutcher Dunnavant <crutcher@redhat.com>
- Fixed lpd.init to use /etc/rc.d/init.d/, instead of /etc/init.d

* Mon Sep 11 2000 Crutcher Dunnavant <crutcher@redhat.com>
- changed the prereq: /etc/init.d to: /etc/rc.d/init.d
- we are not changing that over (yet?)

* Mon Aug 14 2000 Crutcher Dunnavant <crutcher@redhat.com>
- removed the sticky bit from lpc

* Mon Aug 14 2000 Crutcher Dunnavant <crutcher@redhat.com>
- removed the sticky bit from the client programs (LPRng doesn't need them)

* Sat Aug 05 2000 Bill Nottingham <notting@redhat.com>
- condrestart fixes

* Fri Aug  4 2000 Bill Nottingham <notting@redhat.com>
- triggerpostun on lpr

* Sun Jul 30 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 3.6.22 (some fixes)

* Tue Jul 25 2000 Bill Nottingham <notting@redhat.com>
- fix prereq

* Sat Jul 22 2000 Nalin Dahyabhai <nalin@redhat.com>
- fix bogus checkpc error messages when the lockfile doesn't exist because
  init scripts clear /var/run (#14472)

* Tue Jul 18 2000 Nalin Dahyabhai <nalin@redhat.com>
- fix chkconfig comments in the init script

* Mon Jul 17 2000 Nalin Dahyabhai <nalin@redhat.com>
- move the init script to /etc/rc.d/init.d
- fix perms on setuid binaries

* Fri Jul 14 2000 Nalin Dahyabhai <nalin@redhat.com>
- patch checkpc to not complain when filter is executable and in the
  spool directory
- remove --disable-force_localhost from configure invocation for better
  compatibility with BSD LPR and rhs-printfilters
- change group back to lp, which is what printtool expects

* Thu Jul 13 2000 Nalin Dahyabhai <nalin@redhat.com>
- change default group to 'daemon' to match 6.2
- enable NLS support
- remove Prefix: tag
- break init script out into a separate file
- fix up broken printcaps in post-install
- run checkpc -f at start-time

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Tue Jul 11 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 3.6.21
- get rid of the notypedef patch - gcc has been fixed at last.

* Mon Jun 26 2000 Preston Brown <pbrown@redhat.com>
- sample config files removed from /etc.
- initscript moved to /etc/init.d

* Wed Jun 21 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 3.6.18

* Sat Jun 17 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 3.6.16
- adapt Kerberos and fixmake patches
- get rid of CFLAGS="-O"; gcc has been fixed
- fix build with glibc 2.2

* Mon Jun 05 2000 Preston Brown <pbrown@redhat.com>
- ifdef 0 is illegal, changed to if 0.
- work around compiler typdef bug.

* Thu Jun 01 2000 Preston Brown <pbrown@redhat.com>
- start, stop, and restart are functions not switch statements now.
  reduces overhead.
- patch to allow autoconf to choose which user/group to run as

* Wed May 31 2000 Preston Brown <pbrown@redhat.com>
- remove init.d symbolic links.
- remove txt/ps/info versions of the HOWTO from the pkg
- use new fhs paths

* Thu May 25 2000 Nalin Dahyabhai <nalin@redhat.com>
- change free() to krb5_free_data_contents() when patching for Kerberos 5
- detect libcrypto or libk5crypto when looking for Kerberos 5

* Tue May 16 2000 Nalin Dahyabhai <nalin@redhat.com>
- enable Kerberos support
- remove extra defattr in files list
- add --disable-force_localhost to configure invocation
- remove "-o root" at install-time

* Tue May 16 2000 Matt Wilson <msw@redhat.com>
- add Prereq of /sbin/chkconfig
- fix broken conflicting declaration on alpha

* Tue Apr 18 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- initial Red Hat packaging, fix up the spec file

* Mon Sep 13 1999 Patrick Powell <papowell@astart.com>
- resolved problems with symbolic links to /etc/init.d
  files - used the chkconfig facility

* Sat Sep  4 1999 Patrick Powell <papowell@astart.com>
- did ugly things to put the script in the spec file

* Sat Aug 28 1999 Giulio Orsero <giulioo@tiscalinet.it>
- 3.6.8

* Fri Aug 27 1999 Giulio Orsero <giulioo@tiscalinet.it>
- 3.6.7 First RPM build.