added extra/cups

This commit is contained in:
Kevin Mihelich 2014-09-19 18:54:04 +00:00
parent b9a4c0d55c
commit 7532e0a64f
17 changed files with 973 additions and 0 deletions

211
extra/cups/PKGBUILD Normal file
View file

@ -0,0 +1,211 @@
# $Id$
# Maintainer: Andreas Radke <andyrtr@archlinux.org>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - drop valgrind makedepend
pkgbase="cups"
pkgname=('libcups' 'cups')
pkgver=1.7.5
pkgrel=1.1
arch=('i686' 'x86_64')
license=('GPL')
url="http://www.cups.org/"
makedepends=('libtiff>=4.0.0' 'libpng>=1.5.7' 'acl' 'pam' 'xdg-utils' 'krb5' 'openssl'
'cups-filters' 'bc' 'colord' 'xinetd' 'gzip' 'autoconf' 'libusb' 'dbus'
'avahi' 'hicolor-icon-theme' 'systemd' 'inetutils' 'libpaper')
source=(#http://mirror.easysw.com/pub/cups/${pkgver}/cups-${pkgver}-source.tar.bz2
http://www.cups.org/software/${pkgver}/cups-${pkgver}-source.tar.bz2{,.sig}
cups.logrotate cups.pam
# improve build and linking
cups-no-export-ssllibs.patch
cups-no-gcrypt.patch
cups-no-gzip-man.patch
# FC
cups-systemd-socket.patch
cups-res_init.patch
cups-avahi-address.patch
cups-enum-all.patch
cups-final-content-type.patch
# Gentoo
cups-1.6.0-fix-install-perms.patch
cups-1.6.2-statedir.patch
# Debian
cupsd-no-crash-on-avahi-threaded-poll-shutdown.patch
get-ppd-file-for-statically-configured-ipp-shared-queues.patch
ppd-poll-with-client-conf.patch)
md5sums=('5d893edc2957005f78e2b2423fdace2e'
'SKIP'
'26e9b4e65c0a4d76db5737c9b156fd80'
'96f82c38f3f540b53f3e5144900acf17'
'3ba9e3410df1dc3015463d615ef91b3b'
'cc4101beccb5ed6deb1c92707a575925'
'90c30380d4c8cd48a908cfdadae1ea24'
'8162e1d05947bd59fa29ba40ac565fec'
'8fe27d4248cacbc02824e7937cab4088'
'df0c367c0022e3c7d8e01827e8a6c5e7'
'f30c2a161caaf27854581507cde8cac6'
'a31b64ba25a985fbae65d8ddf311b08c'
'5117f65342fcc69c6a506529e4daca9e'
'451609db34f95209d64c38474de27ce1'
'cb58bf4e0b80eaee383712e5c84a1ab4'
'b578bcd17949a7203237ba1e31f78ef9'
'0becd6ab8782b97f19a02c1dc174c75e')
prepare() {
cd ${pkgbase}-${pkgver}
#return 1
# add systemd socket support - Fedora patch, also used in Gentoo
# modified now to the changes done by Gentoo in their svn ebuild
# http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-print/cups/files/cups-1.5.0-systemd-socket.patch?revision=1.1
patch -Np1 -i ${srcdir}/cups-systemd-socket.patch
# Do not export SSL libs in cups-config
patch -Np1 -i "${srcdir}/cups-no-export-ssllibs.patch"
patch -Np1 -i "${srcdir}/cups-no-gcrypt.patch"
# don't zip man pages in make install, let makepkg do that / Fedora
patch -Np1 -i ${srcdir}/cups-no-gzip-man.patch
# various bugfixes (upstream reports/SVN or Fedora/Debian
# Fixed crash which sometimes happens on shutdown of the CUPS daemon, caused by a wrong shutdown sequence for shutting down the Avahi threaded poll.
# patch -Np1 -i ${srcdir}/cupsd-no-crash-on-avahi-threaded-poll-shutdown.patch
# Applications could not get the PPD file for statically-configured IPP-shared print queues
patch -Np1 -i ${srcdir}/get-ppd-file-for-statically-configured-ipp-shared-queues.patch
# If an external server is used via client.conf and the DNS is inconsistent (ex: DNS gives "noname" for many IPs, reverse DNS gives one of these IPs
# for "noname") local PPDs can get polled for print queues instead of the PPDs of the external server Bug: http://www.cups.org/str.php?L2763
# patch -Np1 -i ${srcdir}/ppd-poll-with-client-conf.patch
# fix permissions on some files - alternative: cups-0755.patch by FC
patch -Np0 -i ${srcdir}/cups-1.6.0-fix-install-perms.patch
# move /var/run -> /run for pid file
patch -Np1 -i ${srcdir}/cups-1.6.2-statedir.patch
# Re-initialise the resolver on failure in httpAddrGetList()
patch -Np1 -i ${srcdir}/cups-res_init.patch
# Use IP address when resolving DNSSD URIs
patch -Np1 -i ${srcdir}/cups-avahi-address.patch
# Return from cupsEnumDests() once all records have been returned.
patch -Np1 -i ${srcdir}/cups-enum-all.patch
# Fix printing to some network printers fails - https://bugs.archlinux.org/task/37605
patch -Np1 -i ${srcdir}/cups-final-content-type.patch
# Rebuild configure script for not zipping man-pages.
aclocal -I config-scripts
autoconf -I config-scripts
}
build() {
cd ${pkgbase}-${pkgver}
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
--sbindir=/usr/bin \
--libdir=/usr/lib \
--with-systemdsystemunitdir=/usr/lib/systemd/system \
--with-logdir=/var/log/cups \
--with-docdir=/usr/share/cups/doc \
--with-cups-user=daemon \
--with-cups-group=lp \
--enable-pam=yes \
--enable-raw-printing \
--enable-dbus --with-dbusdir=/etc/dbus-1 \
--enable-ssl=yes --enable-openssl \
--enable-threads \
--enable-avahi\
--enable-libpaper \
--with-php=/usr/bin/php-cgi \
--with-optim="$CFLAGS"
make
}
check() {
cd ${pkgbase}-${pkgver}
make -k check || /bin/true
}
package_libcups() {
pkgdesc="The CUPS Printing System - client libraries and headers"
depends=('openssl' 'libtiff>=4.0.0' 'libpng>=1.5.7' 'krb5' 'avahi')
backup=(etc/cups/client.conf)
cd ${pkgbase}-${pkgver}
make BUILDROOT=${pkgdir} install-headers install-libs
# put this into the libs pkg to make other software find the libs(no pkg-config file included)
mkdir -p ${pkgdir}/usr/bin
install -m755 ${srcdir}/${pkgbase}-${pkgver}/cups-config ${pkgdir}/usr/bin/cups-config
# install client.conf man page and config file
install -dm755 ${pkgdir}/usr/share/man/man5
install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/man/client.conf.5 ${pkgdir}/usr/share/man/man5/
install -dm755 -g lp ${pkgdir}/etc/cups
touch ${pkgdir}/etc/cups/client.conf
echo "# see 'man client.conf'" >> ${pkgdir}/etc/cups/client.conf
echo "ServerName /var/run/cups/cups.sock # alternative: ServerName hostname-or-ip-address[:port] of a remote server" >> ${pkgdir}/etc/cups/client.conf
chgrp -R lp ${pkgdir}/etc/cups
}
package_cups() {
pkgdesc="The CUPS Printing System - daemon package"
install=cups.install
backup=(etc/cups/cupsd.conf
etc/cups/snmp.conf
etc/cups/printers.conf
etc/cups/classes.conf
etc/cups/cups-files.conf
etc/cups/subscriptions.conf
etc/dbus-1/system.d/cups.conf
etc/logrotate.d/cups
etc/pam.d/cups
etc/xinetd.d/cups-lpd)
depends=('acl' 'pam' "libcups>=${pkgver}" 'cups-filters' 'bc' 'colord'
'libusb' 'dbus' 'systemd' 'libpaper' 'hicolor-icon-theme')
optdepends=('xdg-utils: xdg .desktop file support')
cd ${pkgbase}-${pkgver}
make BUILDROOT=${pkgdir} install-data install-exec
# this one we ship in the libcups pkg
rm -f ${pkgdir}/usr/bin/cups-config
# kill the sysv stuff
rm -rf ${pkgdir}/etc/rc*.d
rm -rf ${pkgdir}/etc/init.d
install -D -m644 ../cups.logrotate ${pkgdir}/etc/logrotate.d/cups
install -D -m644 ../cups.pam ${pkgdir}/etc/pam.d/cups
# fix perms on /var/spool and /etc
chmod 755 ${pkgdir}/var/spool
chmod 755 ${pkgdir}/etc
# install ssl directory where to store the certs, solves some samba issues
install -dm700 -g lp ${pkgdir}/etc/cups/ssl
# remove directory from package, it will be recreated at each server start
rm -rf ${pkgdir}/run
# install some more configuration files that will get filled by cupsd
touch ${pkgdir}/etc/cups/printers.conf
touch ${pkgdir}/etc/cups/classes.conf
touch ${pkgdir}/etc/cups/subscriptions.conf
chgrp -R lp ${pkgdir}/etc/cups
# fix .desktop file
sed -i 's|^Exec=htmlview http://localhost:631/|Exec=xdg-open http://localhost:631/|g' ${pkgdir}/usr/share/applications/cups.desktop
# compress some driver files, adopted from Fedora
find ${pkgdir}/usr/share/cups/model -name "*.ppd" | xargs gzip -n9f
# remove client.conf man page
rm -f ${pkgdir}/usr/share/man/man5/client.conf.5
# remove files now part of cups-filters
rm -v ${pkgdir}/usr/share/cups/banners/*
rm -v ${pkgdir}/usr/share/cups/data/testprint
# comment out all conversion rules which use any of the removed filters
perl -p -i -e 's:^(.*\s+bannertops\s*)$:#\1:' $pkgdir/usr/share/cups/mime/mime.convs
# Provide native service for arch-daemons generator
ln -s cups.service "$pkgdir/usr/lib/systemd/system/cupsd.service"
}

View file

@ -0,0 +1,25 @@
Index: Makedefs.in
===================================================================
--- Makedefs.in (Revision 10520)
+++ Makedefs.in (Arbeitskopie)
@@ -40,14 +40,14 @@
# Installation programs...
#
-INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
-INSTALL_COMPDATA = $(INSTALL) -c -m 444 @INSTALL_GZIP@
+INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 755 @INSTALL_STRIP@
+INSTALL_COMPDATA = $(INSTALL) -c -m 644 @INSTALL_GZIP@
INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
-INSTALL_DATA = $(INSTALL) -c -m 444
+INSTALL_DATA = $(INSTALL) -c -m 644
INSTALL_DIR = $(INSTALL) -d
-INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
-INSTALL_MAN = $(INSTALL) -c -m 444
-INSTALL_SCRIPT = $(INSTALL) -c -m 555
+INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 755 @INSTALL_STRIP@
+INSTALL_MAN = $(INSTALL) -c -m 644
+INSTALL_SCRIPT = $(INSTALL) -c -m 755
#
# Default user, group, and system groups for the scheduler...

View file

@ -0,0 +1,12 @@
diff -ruN cups-1.6.2.orig/config-scripts/cups-directories.m4 cups-1.6.2/config-scripts/cups-directories.m4
--- cups-1.6.2.orig/config-scripts/cups-directories.m4 2012-10-01 03:55:23.000000000 +0200
+++ cups-1.6.2/config-scripts/cups-directories.m4 2013-04-02 00:11:41.000000000 +0200
@@ -420,7 +420,7 @@
;;
*)
# All others
- CUPS_STATEDIR="$localstatedir/run/cups"
+ CUPS_STATEDIR="/run/cups"
;;
esac])
AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR")

View file

@ -0,0 +1,75 @@
diff -up cups-1.6.2/cups/http-support.c.avahi-address cups-1.6.2/cups/http-support.c
--- cups-1.6.2/cups/http-support.c.avahi-address 2013-03-11 18:44:36.000000000 +0000
+++ cups-1.6.2/cups/http-support.c 2013-04-04 15:39:06.651847041 +0100
@@ -2121,7 +2121,7 @@ http_resolve_cb(
const char *type, /* I - Registration type */
const char *domain, /* I - Domain (unused) */
const char *hostTarget, /* I - Hostname */
- const AvahiAddress *address, /* I - Address (unused) */
+ const AvahiAddress *address, /* I - Address */
uint16_t port, /* I - Port number */
AvahiStringList *txt, /* I - TXT record */
AvahiLookupResultFlags flags, /* I - Lookup flags (unused) */
@@ -2253,36 +2253,37 @@ http_resolve_cb(
DEBUG_printf(("8http_resolve_cb: Looking up \"%s\".", hostTarget));
- snprintf(fqdn, sizeof(fqdn), "%d", ntohs(port));
- if ((addrlist = httpAddrGetList(hostTarget, AF_UNSPEC, fqdn)) != NULL)
+ int error = getnameinfo(&(address->data),
+ address->proto == AVAHI_PROTO_INET ?
+ sizeof (AvahiIPv4Address) :
+ (address->proto == AVAHI_PROTO_INET6 ?
+ sizeof (AvahiIPv6Address) :
+ sizeof (address->data)),
+ fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
+
+ if (!error)
{
- for (addr = addrlist; addr; addr = addr->next)
+ DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn));
+
+ if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
+ _cups_strcasecmp(hostptr, ".local"))
{
- int error = getnameinfo(&(addr->addr.addr),
- httpAddrLength(&(addr->addr)),
- fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
-
- if (!error)
- {
- DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn));
-
- if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
- _cups_strcasecmp(hostptr, ".local"))
- {
- hostTarget = fqdn;
- break;
- }
- }
+ hostTarget = fqdn;
+ }
+ }
#ifdef DEBUG
- else
- DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d",
- httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)),
- error));
+ else
+ DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d",
+ httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)),
+ error));
#endif /* DEBUG */
- }
+ } else {
+ /*
+ * Use the IP address that responded...
+ */
- httpAddrFreeList(addrlist);
- }
+ avahi_address_snprint (fqdn, sizeof (fqdn), address);
+ hostTarget = fqdn;
}
/*

View file

@ -0,0 +1,17 @@
diff -up cups-1.6.2/cups/dest.c.enum-all cups-1.6.2/cups/dest.c
--- cups-1.6.2/cups/dest.c.enum-all 2013-06-04 10:58:36.169786250 +0100
+++ cups-1.6.2/cups/dest.c 2013-06-04 10:59:02.147900811 +0100
@@ -2724,9 +2724,12 @@ cups_dnssd_browse_cb(
break;
case AVAHI_BROWSER_REMOVE:
- case AVAHI_BROWSER_ALL_FOR_NOW:
case AVAHI_BROWSER_CACHE_EXHAUSTED:
break;
+
+ case AVAHI_BROWSER_ALL_FOR_NOW:
+ avahi_simple_poll_quit(data->simple_poll);
+ break;
}
}

View file

@ -0,0 +1,18 @@
diff -up cups-1.6.4/scheduler/job.c.final-content-type cups-1.6.4/scheduler/job.c
--- cups-1.6.4/scheduler/job.c.final-content-type 2013-09-27 16:58:13.934775402 +0100
+++ cups-1.6.4/scheduler/job.c 2013-09-27 17:00:57.716549576 +0100
@@ -692,12 +692,7 @@ cupsdContinueJob(cupsd_job_t *job) /* I
if (!job->printer->remote)
{
- for (filter = (mime_filter_t *)cupsArrayLast(filters);
- filter && filter->dst;
- filter = (mime_filter_t *)cupsArrayPrev(filters))
- if (strcmp(filter->dst->super, "printer") ||
- strcmp(filter->dst->type, job->printer->name))
- break;
+ filter = (mime_filter_t *)cupsArrayLast(filters);
if (filter && filter->dst)
{

View file

@ -0,0 +1,12 @@
diff -up cups-1.5b1/config-scripts/cups-ssl.m4.no-export-ssllibs cups-1.5b1/config-scripts/cups-ssl.m4
--- cups-1.6.2/config-scripts/cups-ssl.m4.no-export-ssllibs 2011-05-11 02:52:08.000000000 +0200
+++ cups-1.6.2/config-scripts/cups-ssl.m4 2011-05-23 17:47:27.000000000 +0200
@@ -180,7 +180,7 @@
AC_SUBST(SSLFLAGS)
AC_SUBST(SSLLIBS)
-EXPORT_SSLLIBS="$SSLLIBS"
+EXPORT_SSLLIBS=""
AC_SUBST(EXPORT_SSLLIBS)
dnl

View file

@ -0,0 +1,40 @@
diff -ruN cups-1.4.7.orig//config-scripts/cups-ssl.m4 cups-1.4.7/config-scripts/cups-ssl.m4
--- cups-1.5.0.orig//config-scripts/cups-ssl.m4 2011-01-11 08:05:58.000000000 +0100
+++ cups-1.5.0/config-scripts/cups-ssl.m4 2011-08-02 10:44:26.011047900 +0200
@@ -96,7 +96,6 @@
dnl Then look for GNU TLS...
if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then
AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
- AC_PATH_PROG(LIBGCRYPTCONFIG,libgcrypt-config)
if $PKGCONFIG --exists gnutls; then
have_ssl=1
SSLLIBS=`$PKGCONFIG --libs gnutls`
@@ -108,18 +107,6 @@
AC_DEFINE(HAVE_GNUTLS)
fi
- if test $have_ssl = 1; then
- CUPS_SERVERCERT="ssl/server.crt"
- CUPS_SERVERKEY="ssl/server.key"
-
- if $PKGCONFIG --exists gcrypt; then
- SSLLIBS="$SSLLIBS `$PKGCONFIG --libs gcrypt`"
- SSLFLAGS="$SSLFLAGS `$PKGCONFIG --cflags gcrypt`"
- elif test "x$LIBGCRYPTCONFIG" != x; then
- SSLLIBS="$SSLLIBS `$LIBGCRYPTCONFIG --libs`"
- SSLFLAGS="$SSLFLAGS `$LIBGCRYPTCONFIG --cflags`"
- fi
- fi
fi
dnl Check for the OpenSSL library last...
--- cups-1.5.0.orig//cups/http-private.h 2011-01-22 01:07:22.000000000 +0100
+++ cups-1.5.0/cups/http-private.h 2011-08-02 10:42:43.341604107 +0200
@@ -93,7 +93,6 @@
# elif defined HAVE_GNUTLS
# include <gnutls/gnutls.h>
# include <gnutls/x509.h>
-# include <gcrypt.h>
# elif defined(HAVE_CDSASSL)
# include <CoreFoundation/CoreFoundation.h>
# include <Security/Security.h>

View file

@ -0,0 +1,18 @@
diff -up cups-1.5b1/config-scripts/cups-manpages.m4.no-gzip-man cups-1.5b1/config-scripts/cups-manpages.m4
--- cups-1.5b1/config-scripts/cups-manpages.m4.no-gzip-man 2011-05-12 07:21:56.000000000 +0200
+++ cups-1.5b1/config-scripts/cups-manpages.m4 2011-05-23 17:25:50.000000000 +0200
@@ -69,10 +69,10 @@ case "$uname" in
;;
Linux* | GNU* | Darwin*)
# Linux, GNU Hurd, and OS X
- MAN1EXT=1.gz
- MAN5EXT=5.gz
- MAN7EXT=7.gz
- MAN8EXT=8.gz
+ MAN1EXT=1
+ MAN5EXT=5
+ MAN7EXT=7
+ MAN8EXT=8
MAN8DIR=8
;;
*)

View file

@ -0,0 +1,26 @@
diff -up cups-1.6b1/cups/http-addr.c.res_init cups-1.6b1/cups/http-addr.c
--- cups-1.6b1/cups/http-addr.c.res_init 2012-05-17 00:57:03.000000000 +0200
+++ cups-1.6b1/cups/http-addr.c 2012-05-25 15:51:51.323916352 +0200
@@ -254,7 +254,8 @@ httpAddrLookup(
if (error)
{
- if (error == EAI_FAIL)
+ if (error == EAI_FAIL || error == EAI_AGAIN || error == EAI_NODATA ||
+ error == EAI_NONAME)
cg->need_res_init = 1;
return (httpAddrString(addr, name, namelen));
diff -up cups-1.6b1/cups/http-addrlist.c.res_init cups-1.6b1/cups/http-addrlist.c
--- cups-1.6b1/cups/http-addrlist.c.res_init 2012-04-23 19:26:57.000000000 +0200
+++ cups-1.6b1/cups/http-addrlist.c 2012-05-25 16:05:05.930377452 +0200
@@ -540,7 +540,8 @@ httpAddrGetList(const char *hostname, /*
}
else
{
- if (error == EAI_FAIL)
+ if (error == EAI_FAIL || error == EAI_AGAIN || error == EAI_NODATA ||
+ error == EAI_NONAME)
cg->need_res_init = 1;
_cupsSetError(IPP_INTERNAL_ERROR, gai_strerror(error), 0);

View file

@ -0,0 +1,404 @@
diff -up cups-1.7.2/config.h.in.systemd-socket cups-1.7.2/config.h.in
--- cups-1.7.2/config.h.in.systemd-socket 2014-02-27 16:57:59.000000000 +0100
+++ cups-1.7.2/config.h.in 2014-04-17 14:05:04.104472016 +0200
@@ -451,6 +451,13 @@
/*
+ * Do we have systemd support?
+ */
+
+#undef HAVE_SYSTEMD
+
+
+/*
* Various scripting languages...
*/
diff -up cups-1.7.2/config-scripts/cups-systemd.m4.systemd-socket cups-1.7.2/config-scripts/cups-systemd.m4
--- cups-1.7.2/config-scripts/cups-systemd.m4.systemd-socket 2014-04-17 14:05:04.104472016 +0200
+++ cups-1.7.2/config-scripts/cups-systemd.m4 2014-04-17 14:05:04.104472016 +0200
@@ -0,0 +1,36 @@
+dnl
+dnl "$Id$"
+dnl
+dnl systemd stuff for CUPS.
+
+dnl Find whether systemd is available
+
+SDLIBS=""
+AC_ARG_WITH([systemdsystemunitdir],
+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+ [], [with_systemdsystemunitdir=$($PKGCONFIG --variable=systemdsystemunitdir systemd)])
+if test "x$with_systemdsystemunitdir" != xno; then
+ AC_MSG_CHECKING(for libsystemd-daemon)
+ if $PKGCONFIG --exists libsystemd-daemon; then
+ AC_MSG_RESULT(yes)
+ SDCFLAGS=`$PKGCONFIG --cflags libsystemd-daemon`
+ SDLIBS=`$PKGCONFIG --libs libsystemd-daemon`
+ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+ AC_DEFINE(HAVE_SYSTEMD)
+ else
+ AC_MSG_RESULT(no)
+ fi
+fi
+
+if test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ; then
+ SYSTEMD_UNITS="cups.service cups.socket cups.path"
+else
+ SYSTEMD_UNITS=""
+fi
+
+AC_SUBST(SYSTEMD_UNITS)
+AC_SUBST(SDLIBS)
+
+dnl
+dnl "$Id$"
+dnl
diff -up cups-1.7.2/configure.in.systemd-socket cups-1.7.2/configure.in
--- cups-1.7.2/configure.in.systemd-socket 2013-07-08 23:15:13.000000000 +0200
+++ cups-1.7.2/configure.in 2014-04-17 14:05:04.104472016 +0200
@@ -33,6 +33,7 @@ sinclude(config-scripts/cups-pam.m4)
sinclude(config-scripts/cups-largefile.m4)
sinclude(config-scripts/cups-dnssd.m4)
sinclude(config-scripts/cups-launchd.m4)
+sinclude(config-scripts/cups-systemd.m4)
sinclude(config-scripts/cups-defaults.m4)
sinclude(config-scripts/cups-scripting.m4)
@@ -67,6 +68,9 @@ AC_OUTPUT(Makedefs
conf/snmp.conf
cups-config
data/testprint
+ data/cups.service
+ data/cups.socket
+ data/cups.path
desktop/cups.desktop
doc/help/ref-cups-files-conf.html
doc/help/ref-cupsd-conf.html
diff -up cups-1.7.2/cups/usersys.c.systemd-socket cups-1.7.2/cups/usersys.c
--- cups-1.7.2/cups/usersys.c.systemd-socket 2014-03-05 22:22:12.000000000 +0100
+++ cups-1.7.2/cups/usersys.c 2014-04-17 14:05:04.105472002 +0200
@@ -1050,7 +1050,7 @@ cups_read_client_conf(
struct stat sockinfo; /* Domain socket information */
if (!stat(CUPS_DEFAULT_DOMAINSOCKET, &sockinfo) &&
- (sockinfo.st_mode & S_IRWXO) == S_IRWXO)
+ (sockinfo.st_mode & (S_IROTH | S_IWOTH)) == (S_IROTH | S_IWOTH))
cups_server = CUPS_DEFAULT_DOMAINSOCKET;
else
#endif /* CUPS_DEFAULT_DOMAINSOCKET */
diff -up cups-1.7.2/data/cups.path.in.systemd-socket cups-1.7.2/data/cups.path.in
--- cups-1.7.2/data/cups.path.in.systemd-socket 2014-04-17 14:05:04.105472002 +0200
+++ cups-1.7.2/data/cups.path.in 2014-04-17 14:05:04.105472002 +0200
@@ -0,0 +1,8 @@
+[Unit]
+Description=CUPS Printer Service Spool
+
+[Path]
+PathExistsGlob=@CUPS_REQUESTS@/d*
+
+[Install]
+WantedBy=multi-user.target
diff -up cups-1.7.2/data/cups.service.in.systemd-socket cups-1.7.2/data/cups.service.in
--- cups-1.7.2/data/cups.service.in.systemd-socket 2014-04-17 14:05:04.105472002 +0200
+++ cups-1.7.2/data/cups.service.in 2014-04-17 14:05:04.105472002 +0200
@@ -0,0 +1,11 @@
+[Unit]
+Description=CUPS Printing Service
+
+[Service]
+Type=notify
+ExecStart=@sbindir@/cupsd -f
+PrivateTmp=true
+
+[Install]
+Also=cups.socket cups.path
+WantedBy=printer.target
diff -up cups-1.7.2/data/cups.socket.in.systemd-socket cups-1.7.2/data/cups.socket.in
--- cups-1.7.2/data/cups.socket.in.systemd-socket 2014-04-17 14:05:04.105472002 +0200
+++ cups-1.7.2/data/cups.socket.in 2014-04-17 14:05:04.105472002 +0200
@@ -0,0 +1,10 @@
+[Unit]
+Description=CUPS Printing Service Sockets
+
+[Socket]
+ListenStream=@CUPS_DEFAULT_DOMAINSOCKET@
+ListenStream=@DEFAULT_IPP_PORT@
+BindIPv6Only=ipv6-only
+
+[Install]
+WantedBy=sockets.target
diff -up cups-1.7.2/data/Makefile.systemd-socket cups-1.7.2/data/Makefile
--- cups-1.7.2/data/Makefile.systemd-socket 2013-05-29 13:51:34.000000000 +0200
+++ cups-1.7.2/data/Makefile 2014-04-17 14:05:04.106471988 +0200
@@ -100,6 +100,12 @@ install-data:
$(INSTALL_DATA) $$file $(DATADIR)/ppdc; \
done
$(INSTALL_DIR) -m 755 $(DATADIR)/profiles
+ if test "x$(SYSTEMD_UNITS)" != "x" ; then \
+ $(INSTALL_DIR) -m 755 $(SYSTEMDUNITDIR); \
+ for file in $(SYSTEMD_UNITS); do \
+ $(INSTALL_DATA) $$file $(SYSTEMDUNITDIR); \
+ done; \
+ fi
#
@@ -143,6 +149,9 @@ uninstall:
-$(RMDIR) $(DATADIR)/data
-$(RMDIR) $(DATADIR)/banners
-$(RMDIR) $(DATADIR)
+ for file in $(SYSTEMD_UNITS); do \
+ $(RM) $(SYSTEMDUNITDIR)/$$file; \
+ done
#
diff -up cups-1.7.2/Makedefs.in.systemd-socket cups-1.7.2/Makedefs.in
--- cups-1.7.2/Makedefs.in.systemd-socket 2014-04-17 14:05:04.092472182 +0200
+++ cups-1.7.2/Makedefs.in 2014-04-17 14:05:04.106471988 +0200
@@ -134,6 +134,7 @@ CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@
CXXLIBS = @CXXLIBS@
DBUS_NOTIFIER = @DBUS_NOTIFIER@
DBUS_NOTIFIERLIBS = @DBUS_NOTIFIERLIBS@
+SYSTEMD_UNITS = @SYSTEMD_UNITS@
DNSSD_BACKEND = @DNSSD_BACKEND@
DSOFLAGS = -L../cups @DSOFLAGS@
DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
@@ -141,6 +142,7 @@ DNSSDLIBS = @DNSSDLIBS@
IPPFIND_BIN = @IPPFIND_BIN@
IPPFIND_MAN = @IPPFIND_MAN@
LAUNCHDLIBS = @LAUNCHDLIBS@
+SDLIBS = @SDLIBS@
LDFLAGS = -L../cgi-bin -L../cups -L../filter -L../ppdc \
-L../scheduler @LDARCHFLAGS@ \
@LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
@@ -232,6 +234,7 @@ PAMFILE = @PAMFILE@
DEFAULT_LAUNCHD_CONF = @DEFAULT_LAUNCHD_CONF@
DBUSDIR = @DBUSDIR@
+SYSTEMDUNITDIR = $(BUILDROOT)@systemdsystemunitdir@
#
diff -up cups-1.7.2/scheduler/client.h.systemd-socket cups-1.7.2/scheduler/client.h
--- cups-1.7.2/scheduler/client.h.systemd-socket 2013-08-02 00:23:18.000000000 +0200
+++ cups-1.7.2/scheduler/client.h 2014-04-17 14:05:04.106471988 +0200
@@ -79,6 +79,9 @@ typedef struct
int fd; /* File descriptor for this server */
http_addr_t address; /* Bind address of socket */
http_encryption_t encryption; /* To encrypt or not to encrypt... */
+#ifdef HAVE_SYSTEMD
+ int is_systemd; /* Is this a systemd socket? */
+#endif /* HAVE_SYSTEMD */
} cupsd_listener_t;
diff -up cups-1.7.2/scheduler/listen.c.systemd-socket cups-1.7.2/scheduler/listen.c
--- cups-1.7.2/scheduler/listen.c.systemd-socket 2013-05-29 13:51:34.000000000 +0200
+++ cups-1.7.2/scheduler/listen.c 2014-04-17 14:05:04.107471974 +0200
@@ -401,7 +401,11 @@ cupsdStopListening(void)
lis;
lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
{
- if (lis->fd != -1)
+ if (lis->fd != -1
+#ifdef HAVE_SYSTEMD
+ && !lis->is_systemd
+#endif /* HAVE_SYSTEMD */
+ )
{
#ifdef WIN32
closesocket(lis->fd);
diff -up cups-1.7.2/scheduler/main.c.systemd-socket cups-1.7.2/scheduler/main.c
--- cups-1.7.2/scheduler/main.c.systemd-socket 2014-04-17 14:05:04.052472738 +0200
+++ cups-1.7.2/scheduler/main.c 2014-04-17 14:09:39.102634667 +0200
@@ -39,6 +39,10 @@
# endif /* !LAUNCH_JOBKEY_SERVICEIPC */
#endif /* HAVE_LAUNCH_H */
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#endif /* HAVE_SYSTEMD */
+
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
# include <malloc.h>
#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
@@ -64,6 +68,9 @@
static void launchd_checkin(void);
static void launchd_checkout(void);
#endif /* HAVE_LAUNCHD */
+#ifdef HAVE_SYSTEMD
+static void systemd_checkin(void);
+#endif /* HAVE_SYSTEMD */
static void parent_handler(int sig);
static void process_children(void);
static void sigchld_handler(int sig);
@@ -563,6 +570,13 @@ main(int argc, /* I - Number of comm
}
#endif /* HAVE_LAUNCHD */
+#ifdef HAVE_SYSTEMD
+ /*
+ * If we were started by systemd get the listen sockets file descriptors...
+ */
+ systemd_checkin();
+#endif /* HAVE_SYSTEMD */
+
/*
* Startup the server...
*/
@@ -654,6 +668,12 @@ main(int argc, /* I - Number of comm
"Scheduler started via launchd.");
else
#endif /* HAVE_LAUNCHD */
+#ifdef HAVE_SYSTEMD
+ sd_notifyf(0, "READY=1\n"
+ "STATUS=Scheduler is running...\n"
+ "MAINPID=%lu",
+ (unsigned long) getpid());
+#endif /* HAVE_SYSTEMD */
if (fg)
cupsdAddEvent(CUPSD_EVENT_SERVER_STARTED, NULL, NULL,
"Scheduler started in foreground.");
@@ -751,6 +771,15 @@ main(int argc, /* I - Number of comm
}
#endif /* HAVE_LAUNCHD */
+#ifdef HAVE_SYSTEMD
+ /*
+ * If we were started by systemd get the listen sockets file
+ * descriptors...
+ */
+
+ systemd_checkin();
+#endif /* HAVE_SYSTEMD */
+
/*
* Startup the server...
*/
@@ -1500,6 +1529,102 @@ launchd_checkout(void)
}
#endif /* HAVE_LAUNCHD */
+#ifdef HAVE_SYSTEMD
+static void
+systemd_checkin(void)
+{
+ int n, fd;
+
+ n = sd_listen_fds(0);
+ if (n < 0)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "systemd_checkin: Failed to acquire sockets from systemd - %s",
+ strerror(-n));
+ exit(EXIT_FAILURE);
+ return;
+ }
+
+ if (n == 0)
+ return;
+
+ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++)
+ {
+ http_addr_t addr;
+ socklen_t addrlen = sizeof (addr);
+ int r;
+ cupsd_listener_t *lis;
+ char s[256];
+
+ r = sd_is_socket(fd, AF_UNSPEC, SOCK_STREAM, 1);
+ if (r < 0)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "systemd_checkin: Unable to verify socket type - %s",
+ strerror(-r));
+ continue;
+ }
+
+ if (!r)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "systemd_checkin: Socket not of the right type");
+ continue;
+ }
+
+ if (getsockname(fd, (struct sockaddr*) &addr, &addrlen))
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "systemd_checkin: Unable to get local address - %s",
+ strerror(errno));
+ continue;
+ }
+
+ /*
+ * Try to match the systemd socket address to one of the listeners...
+ */
+
+ for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners);
+ lis;
+ lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
+ if (httpAddrEqual(&lis->address, &addr))
+ break;
+
+ if (lis)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "systemd_checkin: Matched existing listener %s with fd %d...",
+ httpAddrString(&(lis->address), s, sizeof(s)), fd);
+ }
+ else
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "systemd_checkin: Adding new listener %s with fd %d...",
+ httpAddrString(&addr, s, sizeof(s)), fd);
+
+ if ((lis = calloc(1, sizeof(cupsd_listener_t))) == NULL)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "systemd_checkin: Unable to allocate listener - "
+ "%s.", strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ cupsArrayAdd(Listeners, lis);
+
+ memcpy(&lis->address, &addr, sizeof(lis->address));
+ }
+
+ lis->fd = fd;
+ lis->is_systemd = 1;
+
+# ifdef HAVE_SSL
+ if (_httpAddrPort(&(lis->address)) == 443)
+ lis->encryption = HTTP_ENCRYPT_ALWAYS;
+# endif /* HAVE_SSL */
+ }
+}
+#endif /* HAVE_SYSTEMD */
/*
* 'parent_handler()' - Catch USR1/CHLD signals...
diff -up cups-1.7.2/scheduler/Makefile.systemd-socket cups-1.7.2/scheduler/Makefile
--- cups-1.7.2/scheduler/Makefile.systemd-socket 2013-05-29 13:51:34.000000000 +0200
+++ cups-1.7.2/scheduler/Makefile 2014-04-17 14:05:04.108471960 +0200
@@ -381,7 +381,7 @@ cupsd: $(CUPSDOBJS) $(LIBCUPSMIME) ../cu
$(CC) $(LDFLAGS) -o cupsd $(CUPSDOBJS) -L. -lcupsmime \
$(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \
$(LIBPAPER) $(LIBMALLOC) $(SERVERLIBS) $(DNSSDLIBS) $(LIBS) \
- $(LIBGSSAPI) $(LIBWRAP)
+ $(LIBGSSAPI) $(LIBWRAP) $(SDLIBS)
cupsd-static: $(CUPSDOBJS) libcupsmime.a ../cups/$(LIBCUPSSTATIC)
echo Linking $@...
@@ -389,7 +389,7 @@ cupsd-static: $(CUPSDOBJS) libcupsmime.a
$(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \
../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(LIBZ) $(LIBPAPER) \
$(LIBMALLOC) $(SERVERLIBS) $(DNSSDLIBS) $(LIBGSSAPI) \
- $(LIBWRAP)
+ $(LIBWRAP) $(SDLIBS)
tls.o: tls-darwin.c tls-gnutls.c tls-openssl.c

35
extra/cups/cups.install Normal file
View file

@ -0,0 +1,35 @@
post_install() {
if [ -x usr/bin/xdg-icon-resource ]; then
xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
fi
echo ">> If you use an HTTPS connection to CUPS, the first time you access"
echo ">> the interface it may take a very long time before the site comes up."
echo ">> This is because the first request triggers the generation of the CUPS"
echo ">> SSL certificates which can be a very time-consuming job."
}
post_upgrade() {
if [ -x usr/bin/xdg-icon-resource ]; then
xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
fi
if [ "`vercmp $2 1.6.0`" -lt 0 ]; then
# important upgrade notice
echo "* avahi-daemon should now run before you start cupsd for"
echo " printer Browsing support"
echo "* check your config with cupsd -t"
echo " and fix all Browsing related settings"
fi
if [ "`vercmp $2 1.6.1-3`" -lt 0 ]; then
# important upgrade notice
echo "> It's now safe to load usblp kernel module."
echo "> There's no more need to blacklist it."
fi
}
post_remove() {
if [ -x usr/bin/xdg-icon-resource ]; then
xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
fi
}

View file

@ -0,0 +1,4 @@
/var/log/cups/*_log {
missingok
notifempty
}

3
extra/cups/cups.pam Normal file
View file

@ -0,0 +1,3 @@
auth required pam_unix.so
account required pam_unix.so
session required pam_unix.so

View file

@ -0,0 +1,19 @@
Description: Fixed crash which sometimes happens on shutdown of the CUPS
daemon, caused by a wrong shutdown sequence for shutting down the Avahi
threaded poll.
Author: Till Kamppeter <till.kamppeter@gmail.com>
Bug-Upstream: http://cups.org/str.php?L4180
Bug-Upstream: http://cups.org/str.php?L4213
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1034045
Last-Updated: 2012-10-16
--- a/scheduler/dirsvc.c
+++ b/scheduler/dirsvc.c
@@ -1333,6 +1333,7 @@
DNSSDMaster = NULL;
# else /* HAVE_AVAHI */
+ avahi_threaded_poll_stop(DNSSDMaster);
avahi_client_free(DNSSDClient);
DNSSDClient = NULL;

View file

@ -0,0 +1,31 @@
Description: Applications could not get the PPD file for
statically-configured IPP-shared print queues
Author: Till Kamppeter <till.kamppeter@gmail.com>
Bug-Upstream: http://cups.org/str.php?L4178
Last-Updated: 2012-09-19
--- a/cups/util.c
+++ b/cups/util.c
@@ -1731,6 +1731,22 @@
return (1);
}
+ else if (device_uri &&
+ (!strncmp(device_uri, "ipp:", 4) != NULL ||
+ !strncmp(device_uri, "ipps:", 5) != NULL))
+ {
+ /*
+ * Statically-configured IPP shared printer.
+ */
+
+ httpSeparateURI(HTTP_URI_CODING_ALL,
+ device_uri,
+ scheme, sizeof(scheme), username, sizeof(username),
+ host, hostsize, port, resource, resourcesize);
+ ippDelete(response);
+
+ return (1);
+ }
else if ((attr = ippFindAttribute(response, "member-uris",
IPP_TAG_URI)) != NULL)
{

View file

@ -0,0 +1,23 @@
Description: If an external server is used via client.conf and the DNS is inconsistent (ex: DNS gives "noname" for many IPs, reverse DNS gives one of these IPs for "noname") local PPDs can get polled for print queues instead of the PPDs of the external server
Bug: http://www.cups.org/str.php?L2763
--- a/cups/util.c
+++ b/cups/util.c
@@ -1085,11 +1085,13 @@
http2 = http;
else if ((http2 = httpConnectEncrypt(hostname, port,
cupsEncryption())) == NULL)
- {
- DEBUG_puts("1cupsGetPPD3: Unable to connect to server");
+ if ((http2 = httpConnectEncrypt(http_hostname, http_port,
+ cupsEncryption())) == NULL)
+ {
+ DEBUG_puts("1cupsGetPPD3: Unable to connect to server");
- return (HTTP_SERVICE_UNAVAILABLE);
- }
+ return (HTTP_SERVICE_UNAVAILABLE);
+ }
/*
* Get a temp file...