# # spec file for package cups # # Copyright (c) 2014 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: cups BuildRequires: dbus-1-devel BuildRequires: fdupes BuildRequires: gcc-c++ # Use krb5-mini-devel to avoid this cycle in the build system: # cups -> krb5 -> python-Jinja2 -> vim -> gtk2 -> cups # Because krb5-mini-devel is not available for SLE11 # krb5-devel must be used for SLE11 builds, see # http://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto # for the appropriate suse_version value: %if 0%{?suse_version} > 1110 BuildRequires: krb5-mini-devel %else BuildRequires: krb5-devel %endif BuildRequires: libjpeg-devel BuildRequires: libpng-devel BuildRequires: libtiff-devel # Have libtool as explicit buildrequirement to no longer depend # on a "hidden" buildrequirement in the OBS project definition: BuildRequires: libtool BuildRequires: openldap2-devel BuildRequires: openslp-devel BuildRequires: openssl-devel BuildRequires: pam-devel BuildRequires: pkgconfig # The "BuildRequires: poppler-tools" installs /usr/bin/pdftops for the # check in config-scripts/cups-pdf.m4 regarding HAVE_PDFTOPS_WITH_ORIGPAGESIZE # see https://www.cups.org/str.php?L3689 # If the installed /usr/bin/pdftops in the build system is new enough # to support the "-origpagesizes" option it results that the CUPS filter # /usr/lib/cups/filter/pdftops is built so that it uses "-origpagesizes" # when calling /usr/bin/pdftops otherwise it falls back to not use "-origpagesizes" # but those fallback would result wrong PostScript output since poppler > 0.18.0 # see https://bugzilla.novell.com/show_bug.cgi?id=776080 BuildRequires: poppler-tools BuildRequires: tcpd-devel BuildRequires: update-desktop-files BuildRequires: zlib-devel # See http://en.opensuse.org/openSUSE:Systemd_packaging_guidelines # that reads as of this writing (Thu Feb 13 12:20:32 CET 2014) # where here the RPM macro percentage sign is replaced with '@' to be safe: # Starting with openSUSE 12.1, several RPM macros # must be used to package systemd services files # Build Requirement # You should add : # @if 0@{?suse_version} >= 1210 # BuildRequires: systemd # @endif # as Build Requires. # Requires # Add # @{?systemd_requires} # to ensure the needed dependencies are added to your package %if 0%{?suse_version} >= 1210 %define have_systemd 1 %endif %if 0%{?have_systemd} BuildRequires: pkgconfig(systemd) %{?systemd_requires} # _tmpfilesdir is not defined in systemd macros up to openSUSE 12.3 and # in openSUSE 13.1 "rpm --eval @{_tmpfilesdir}" results /usr/lib/tmpfiles.d # (above the RPM macro percentage sign is replaced with '@' to be safe): %{!?_tmpfilesdir: %global _tmpfilesdir /usr/lib/tmpfiles.d } %else PreReq: %insserv_prereq PreReq: %fillup_prereq %endif # sysvinit(syslog) is first provided in openSUSE:Factory (i.e. openSUSE 11.4): %if 0%{?suse_version} > 1130 PreReq: sysvinit(syslog) %endif PreReq: /usr/sbin/groupadd PreReq: fileutils PreReq: sh-utils PreReq: textutils Url: http://www.cups.org/ Summary: The Common UNIX Printing System License: SUSE-GPL-2.0-with-openssl-exception and LGPL-2.1 Group: Hardware/Printing Version: 1.5.4 Release: 0 # Source0...Source9 is for sources from upstream: # URL for Source0: http://www.cups.org/software/1.5.4/cups-1.5.4-source.tar.bz2 # MD5 sum for Source0 on http://www.cups.org/software.php de3006e5cf1ee78a9c6145ce62c4e982 # The Source0 URL must be valid, otherwise the factory-auto check script errors out # with "Failed to download ... Source URLs are not valid.": Source0: http://www.cups.org/software/%{version}/cups-%{version}-source.tar.bz2 # Require the exact matching version-release of the cups-libs sub-package because # non-matching CUPS libraries may let CUPS software crash (e.g. segfault) # because all CUPS software is built from the one same CUPS source tar ball # so that there are CUPS-internal dependencies via CUPS private API calls # (which do not happen for third-party software which uses only the CUPS public API). # The exact matching version-release of the cups-libs sub-package is available # on the same package repository where the cups package is because # all are built simulaneously from the same cups source package # and all required packages are provided on the same repository: Requires: cups-libs = %{version}-%{release} # Strictly speaking the cupsd in the package cups could run without the client tools # but this would be a too crippled use case so that a strict RPM Requires is justified: Requires: cups-client = %{version} # Inherited RPM Requires from the past but I (jsmeix@suse.de) do not know the reason for it: Requires: util-linux # The Ghostscript device "cups" is needed by several CUPS filters # (in particular the "rasterto..." filters) which might justify a RPM Requires. # But a RPM requirement for ghostscript would cause a build dependency cycle because # cups Requires ghostscript which BuildRequires cups-devel which Requires cups-libs # and cups-libs is a sub-package of cups so that there is an implicit build dependency # cycle between the main-packages cups and ghostscript. # Furthermore Ghostscript is not needed on a system where those CUPS filters are not used # (e.g. on client systems in the network where the filtering hapens on a CUPS server # or on a CUPS server with only "raw" queues) so that a weak Recommends fits better: Recommends: ghostscript # The CUPS filter /usr/lib/cups/filter/pdftops is a wrapper which calls /usr/bin/pdftops # (see the configure setting '--with-pdftops=pdftops') so that this # might justify a RPM Requires but this CUPS filter is not used on all systems # (e.g. on client systems in the network where the filtering hapens on a CUPS server # or on a CUPS server with only "raw" queues) so that a weak Recommends is sufficient: Recommends: /usr/bin/pdftops # Our Source105 PSLEVEL1.PPD.bz2 and Source106 PSLEVEL2.PPD.bz2 need foomatic-rip # but this does not justify a RPM Requires so that a weak Recommends is sufficient: Recommends: foomatic-filters # Conflicts with other print spoolers which provide same binaries like /usr/bin/lp and so on # or which may listen on the same port (e.g. cups-lpd versus traditional lpd on port 515): Conflicts: lprng Conflicts: lprold Conflicts: plp # Patch0...Patch9 is for patches from upstream: # Source10...Source99 is for sources from Novell/openSUSE which are intended for upstream: # Patch10...Patch99 is for patches from Novell/openSUSE which are intended for upstream: # Patch10 adds 'smb://...' URIs to templates/choose-uri.tmpl: Patch10: cups-1.2rc1-template.patch # Patch11 changes the default path whereto the web content is installed # from /usr/share/doc/cups to /usr/share/cups/webcontent because the # files of the CUPS web content are no documentation, see CUPS STR #3578 # and http://bugzilla.novell.com/show_bug.cgi?id=546023#c6 and subsequent comments: Patch11: cups-1.4.3-default-webcontent-path.patch # Source100...Source999 is for private sources from Novell/openSUSE which are not intended for upstream: Source101: cups.init Source102: postscript.ppd.bz2 Source103: cups.sysconfig Source104: cups.xinetd Source105: PSLEVEL1.PPD.bz2 Source106: PSLEVEL2.PPD.bz2 Source108: cups-client.conf Source109: baselibs.conf # Patch100...Patch999 is for private patches from Novell/openSUSE which are not intended for upstream: # Patch100 adds conf/pam.suse regarding support for PAM for Novell/openSUSE: Patch100: cups-pam.diff # Patch101 adds 'Allow 127.0.0.2' to cupsd.conf # to allow access for the loopback IP address 127.0.0.2 # which is set for the hostname by Novell/openSUSE in /etc/hosts Patch101: cups-1.3.6-access_conf.patch # Patch102 changes desktop/cups.desktop according to what Novell/openSUSE needs: Patch102: cups-1.3.9-desktop_file.patch # Patch103 reverts the change which was added by Michael Sweet in Jan 2007 # which strips the word "recommended" from NickName in PPDs because # at least yast2-printer in Novell/openSUSE needs it, compare the # 'Why not "recommend" PPDs in the NickName?' and the subsequent # 'RFC: New Driver Rating/Information Attributes' mail thread on cups@easysw.com: Patch103: cups-1.4-do_not_strip_recommended_from_PPDs.patch # Patch104 adds the 'allowallforanybody' policy to cupsd.conf # see https://fate.novell.com/303515 Patch104: cups-1.5-additional_policies.patch # Patch105 adds complete systemd support (see http://www.cups.org/str.php?L3917): Patch105: cups-0001-systemd-add-systemd-socket-activation-and-unit-files.patch # Patch106 fixes option --libs in cups-config script: Patch106: cups-config-libs.patch # Patch107 provides cupsd.service in cups.service Patch107: cups-provides-cupsd-service.patch # Patch108 cups-move-everything-to-run.patch (move pid, socket and lock files to /run) # Explanation that I got via mail from Robert Milasan (quotation): # the changes are due to systemd. Systemd needs /run and in our case # openSUSE we bind /run to /var/run which at boot time can created # issues, meaning /var/run is used before being binded to /run. # All apps should use /run and /run/lock instead of /var/run and /var/lock. # In other distro's they links /run to /var/run and /run/lock # to /var/lock, but we don't, so it's better to move everything # and yes upstream should do the same. Please also check: # http://lists.opensuse.org/opensuse-factory/2013-01/msg00578.html Patch108: cups-move-everything-to-run.patch # Patch109 fixes STR #4190: Send-Document failure ignored # (also applies to client-error-not-authorized) Patch109: str4190.patch # Patch110 avoids any possible busy loop in cups-polld in case of unusual issues # by sleeping interval seconds see https://bugzilla.novell.com/show_bug.cgi?id=828228 Patch110: cups-polld_avoid_busy_loop.patch # Patch111 fixes the cups.socket systemd unit file from Patch105 to be more secure # so that systemd listens only on localhost (i.e. where the cupsd itself listens by default) # see https://bugzilla.novell.com/show_bug.cgi?id=857372#c24 # Patch111 must be applied on top of Patch105. Patch111: cups-0002-systemd-listen-only-on-localhost-for-socket-activation.patch # Patch112 changes the cups.service systemd unit file from Patch105 to be more secure # and to let the cupsd again work as it did all the time for printing in a network # see https://bugzilla.novell.com/show_bug.cgi?id=857372#c61 # Patch111 must be applied on top of Patch105. Patch112: cups-0003-systemd-secure-cups.service-unit-file.patch # Patch113 adds protection against privilege escalation by non-root users # who have been allowed by root to do CUPS configuration changes # (CUPS STR#4223 CVE-2012-5519 Novell/Suse Bugzilla bnc#789566): Patch113: cups-1.5.4-CVE-2012-5519.patch # Patch114 fixes STR #4351: cups-lpd hugh jobs (>2G) fail Patch114: str4351.patch # Patch115 fixes STR #4388: no or malformed output from lpstat in charset other than utf-8 Patch115: cups-1.5.4-strftime.patch # Install into this non-root directory (required when norootforbuild is used): BuildRoot: %{_tmppath}/%{name}-%{version}-build %description The Common UNIX Printing System (CUPS) is the standards-based, open source printing system. See http://www.cups.org %package libs Summary: Libraries for CUPS License: SUSE-GPL-2.0-with-openssl-exception and LGPL-2.1 Group: Hardware/Printing # Prerequire /sbin/ldconfig which is used in the traditional bash scriptlets for post/postun: PreReq: /sbin/ldconfig # https://bugzilla.novell.com/show_bug.cgi?id=437293 %ifarch ppc64 Obsoletes: cups-libs-64bit %endif %description libs The Common UNIX Printing System (CUPS) is the standards-based, open source printing system. See http://www.cups.org This package contains libraries needed by CUPS and other packages. %package client Summary: CUPS Client Programs License: SUSE-GPL-2.0-with-openssl-exception Group: Hardware/Printing # Conflicts with other print spoolers which provide same binaries like /usr/bin/lp and so on: Conflicts: lprng Conflicts: lprold Conflicts: plp # Require the exact matching version-release of the cups-libs sub-package because # non-matching CUPS libraries may let CUPS software crash (e.g. segfault) # because all CUPS software is built from the one same CUPS source tar ball # so that there are CUPS-internal dependencies via CUPS private API calls # (which do not happen for third-party software which uses only the CUPS public API). # The exact matching version-release of the cups-libs sub-package is available # on the same package repository where the cups package is because # all are built simulaneously from the same cups source package # and all required packages are provided on the same repository: Requires: cups-libs = %{version}-%{release} %description client The Common UNIX Printing System (CUPS) is the standards-based, open source printing system. See http://www.cups.org This package contains all programs needed for running a CUPS client, not a server. %package devel Summary: Development Environment for CUPS License: SUSE-GPL-2.0-with-openssl-exception Group: Development/Libraries/C and C++ # Do not require the exact matching version-release of cups-libs # but only a cups-libs package with matching version because # for building third-party software which uses only the CUPS public API # there are no CUPS-internal dependencies via CUPS private API calls # (the latter would require the exact matching cups-libs version-release): Requires: cups-libs = %{version} Requires: glibc-devel # https://bugzilla.novell.com/show_bug.cgi?id=437293 %ifarch ppc64 Obsoletes: cups-devel-64bit %endif %description devel The Common UNIX Printing System (CUPS) is the standards-based, open source printing system. See http://www.cups.org This is the development package. %package ddk Summary: CUPS Driver Development Kit License: SUSE-GPL-2.0-with-openssl-exception Group: Hardware/Printing Requires: cups = %{version} Requires: cups-devel = %{version} # Since CUPS 1.4 the CUPS Driver Development Kit (DDK) is bundled with CUPS. # For CUPS 1.2.x and 1.3.x, the DDK was separated software # which we provided (up to openSUSE 11.1 / SLE11) in our cupsddk package: Provides: cupsddk = %{version} Obsoletes: cupsddk < %{version} %description ddk The Common UNIX Printing System (CUPS) is the standards-based, open source printing system. See http://www.cups.org The CUPS Driver Development Kit (DDK) provides a suite of standard drivers, a PPD file compiler, and other utilities that can be used to develop printer drivers for CUPS. %prep # Be quiet when unpacking: %setup -q -n cups-%{version} # Patch0...Patch9 is for patches from upstream: # Patch10...Patch99 is for patches from Novell/openSUSE which are intended for upstream: # Patch10 adds 'smb://...' URIs to templates/choose-uri.tmpl: %patch10 -p1 # Patch11 changes the default path whereto the web content is installed # from /usr/share/doc/cups to /usr/share/cups/webcontent because the # files of the CUPS web content are no documentation, see CUPS STR #3578 # and http://bugzilla.novell.com/show_bug.cgi?id=546023#c6 and subsequent comments: %patch11 # Patch100...Patch999 is for private patches from Novell/openSUSE which are not intended for upstream: # Patch100 adds conf/pam.suse regarding support for PAM for Novell/openSUSE: %patch100 # Patch101 adds 'Allow 127.0.0.2' to cupsd.conf: %patch101 -p1 # Patch102 changes desktop/cups.desktop according to what Novell/openSUSE needs: %patch102 # Patch103 reverts the change which strips the word "recommended" from NickName in PPDs: %patch103 # Patch104 adds the 'allowallforanybody' policy to cupsd.conf: %patch104 # Patch105 adds complete systemd support (see http://www.cups.org/str.php?L3917): %patch105 # Patch106 fixes option --libs in cups-config script: %patch106 # Patch107 provides cupsd.service in cups.service %patch107 -p1 %if %suse_version > 1220 # Patch108 moves everything to /run %patch108 -p1 %endif # Patch109: STR #4190 %patch109 # Patch110 avoids any possible busy loop in cups-polld %patch110 # Patch111 fixes the cups.socket systemd unit file from Patch105 to be more secure # so that systemd listens only on localhost (i.e. where the cupsd itself listens by default) # see https://bugzilla.novell.com/show_bug.cgi?id=857372#c24 # Patch111 must be applied on top of Patch105. %patch111 # Patch112 changes the cups.service systemd unit file from Patch105 to be more secure # and to let the cupsd again work as it did all the time for printing in a network # see https://bugzilla.novell.com/show_bug.cgi?id=857372#c61 # Patch111 must be applied on top of Patch105. %patch112 # Patch113 adds protection against privilege escalation by non-root users # who have been allowed by root to do CUPS configuration changes # (CUPS STR#4223 CVE-2012-5519 Novell/Suse Bugzilla bnc#789566): %patch113 # Patch114 fixes STR #4351: cups-lpd hugh jobs (>2G) fail %patch114 # Patch115 fixes STR #4388: no or malformed output from lpstat in charset other than utf-8 %patch115 -p1 %build # Disable SILENT run of make so that make runs verbose as usual: sed -i -e 's/^\.SILENT:/# .SILENT:/' Makedefs.in libtoolize --force aclocal autoconf export CXXFLAGS="$CXXFLAGS $RPM_OPT_FLAGS -O2 -fstack-protector" export CFLAGS="$RPM_OPT_FLAGS -fstack-protector -DLDAP_DEPRECATED" export CXX=g++ # As long as cups-1.4.3-default-webcontent-path.patch is applied # configure --with-docdir=... would be no longer needed # because cups-1.4.3-default-webcontent-path.patch changes the # default with-docdir path whereto the web content is installed # from /usr/share/doc/cups to /usr/share/cups/webcontent because the # files of the CUPS web content are no documentation, see CUPS STR #3578 # and http://bugzilla.novell.com/show_bug.cgi?id=546023#c6 and subsequent comments # so that the new default could be used as is but upstream may accept # cups-1.4.3-default-webcontent-path.patch in general but change its default # so that with-docdir is explicitly set here to be future proof: ./configure \ --mandir=%{_mandir} \ --sysconfdir=%{_sysconfdir} \ --libdir=%{_libdir} \ --datadir=%{_datadir} \ --with-docdir=%{_datadir}/cups/webcontent \ --with-cups-user=lp \ --with-cups-group=lp \ --with-system-groups=root \ --enable-debug \ --enable-relro \ --enable-gssapi \ --disable-static \ --without-rcdir \ --enable-dbus \ --enable-ldap \ --with-java \ --with-php \ --with-python \ --with-cachedir=/var/cache/cups \ --with-pdftops=pdftops \ %if 0%{?have_systemd} --with-systemdsystemunitdir=%{_unitdir} \ %endif --prefix=/ make %{?_smp_mflags} CXX=g++ %install make BUILDROOT=%{buildroot} install # Use CUPS' own fonts (i.e. make CUPS work again in compliance with upstream). # In ancient times (see the RPM changelog entry dated "Thu Aug 16 17:05:19 CEST 2001") # there was the general opinion it would be a great idea to deviate from CUPS upstream # and save some disk space and do not install CUPS' own fonts in CUPS' own font directory. # Therefore CUPS' own fonts were removed and the CUPS font directory was replaced # by a symbolic link /usr/share/cups/fonts -> ../ghostscript/fonts # because at that times the Ghostscript fonts had been the same as CUPS' own fonts. # In any case such a link is a fragile non-future-proof interference because when either # the Ghostscript fonts or CUPS' own fonts change, linking them as same is wrong. # Meanwhile (I don't know exactly since when but since a long time) the Ghostscript fonts # do no longer work for CUPS' particular needs (CUPS has its own fonts because it needs them). # Nobody noticed it until 2014 via https://bugzilla.novell.com/show_bug.cgi?id=856731 # But it is not possible with RPM to replace a directory by a symbolic link or vice versa # see https://bugzilla.novell.com/show_bug.cgi?id=856731#c7 # and https://bugzilla.novell.com/show_bug.cgi?id=856731#c8 # This means /usr/share/cups/fonts must stay forever as a symbolic link # and the only way out is to move CUPS' own fonts to an artificial # surrogate directory /usr/share/cups/CUPSfonts and have the # symbolic link /usr/share/cups/fonts -> /usr/share/cups/CUPSfonts: pushd %{buildroot}/usr/share/cups/ mv fonts CUPSfonts && ln -s CUPSfonts fonts popd # Source103: cups.sysconfig install -d -m755 %{buildroot}/var/adm/fillup-templates install -m 644 %{SOURCE103} %{buildroot}/var/adm/fillup-templates/sysconfig.cups # Make directory for ssl files: mkdir -p %{buildroot}%{_sysconfdir}/cups/ssl # Add a client.conf as template (Source108: cups-client.conf): install -m644 %{SOURCE108} %{buildroot}%{_sysconfdir}/cups/client.conf %if %suse_version > 1220 sed -i -e 's|/var/run|/run|g' %{buildroot}%{_sysconfdir}/cups/client.conf %endif # Source104: cups.xinetd mkdir -p %{buildroot}%{_sysconfdir}/xinetd.d install -m 644 -D %{SOURCE104} %{buildroot}%{_sysconfdir}/xinetd.d/cups-lpd # Make the libraries accessible also via generic named links: ln -sf libcupsimage.so.2 %{buildroot}%{_libdir}/libcupsimage.so ln -sf libcups.so.2 %{buildroot}%{_libdir}/libcups.so # Add missing usual directories: install -d -m755 %{buildroot}%{_datadir}/cups/drivers install -d -m755 %{buildroot}/var/cache/cups # Add conf/pam.suse regarding support for PAM (see Patch100: cups-pam.diff): install -m 644 -D conf/pam.suse %{buildroot}/etc/pam.d/cups # Add missing usual documentation: install -d -m755 %{buildroot}/%{_defaultdocdir}/cups for f in CHANGES*.txt CREDITS.txt INSTALL.txt LICENSE.txt README.txt do install -m 644 "$f" %{buildroot}%{_defaultdocdir}/cups/ done # Source102: postscript.ppd.bz2 bzip2 -cd < %{SOURCE102} > %{buildroot}%{_datadir}/cups/model/Postscript.ppd # Source105: PSLEVEL1.PPD.bz2 bzip2 -cd < %{SOURCE105} > %{buildroot}%{_datadir}/cups/model/Postscript-level1.ppd # Source106: PSLEVEL2.PPD.bz2 bzip2 -cd < %{SOURCE106} > %{buildroot}%{_datadir}/cups/model/Postscript-level2.ppd find %{buildroot}/usr/share/cups/model -name "*.ppd" | while read FILE do # Change default paper size from Letter to A4 if possible # https://bugzilla.novell.com/show_bug.cgi?id=suse30662 # and delete trailing whitespace: perl -pi -e 's:^(\*Default.*)Letter\s*$:$1A4\n:; \ s:^(\*ImageableArea A4.*\:\s+)"0 0 595 842":$1"24 48 571 818":; \ s:^(\*ImageableArea Letter.*\:\s+)"0 0 612 792":$1"24 48 588 768":; \ s:\s\n:\n:' "$FILE" gzip -9 "$FILE" done # Add files for desktop menu: rm -f %{buildroot}/usr/share/applications/cups.desktop %suse_update_desktop_file -i cups PrintingUtility 2>/dev/null mkdir %{buildroot}/usr/share/pixmaps install -m 644 %{buildroot}/usr/share/icons/hicolor/64x64/apps/cups.png %{buildroot}/usr/share/pixmaps rm -rf %{buildroot}/usr/share/icons # Norwegian is "nb", "zh" is probably "zh_CN": mv %{buildroot}/usr/share/locale/{no,nb} mv %{buildroot}/usr/share/locale/{zh,zh_CN} # Save /etc/cups/cupsd.conf and /etc/cups/cupsd.conf.default from becoming hardlinked # via the fdupes run below, see https://bugzilla.novell.com/show_bug.cgi?id=773971 # by making their content different and at the same time fix the misleading comment. # Intentionally let the build fail if 'grep' does not find what 'sed' should change # because if upstream changed it 'sed' would silently no longer change the files # so that fdupes would make /etc/cups/cupsd.conf and /etc/cups/cupsd.conf.default hardlinked: grep -q '^# Sample configuration ' %{buildroot}/%{_sysconfdir}/cups/cupsd.conf sed -i -e 's/^# Sample configuration /# Configuration /' %{buildroot}/%{_sysconfdir}/cups/cupsd.conf grep -q '^# Sample configuration ' %{buildroot}/%{_sysconfdir}/cups/cupsd.conf.default sed -i -e 's/^# Sample configuration /# Default configuration /' %{buildroot}/%{_sysconfdir}/cups/cupsd.conf.default # Begin how cupsd is launched (via SysVinit or systemd): %if 0%{?have_systemd} # Begin launch cupsd via systemd: # See http://en.opensuse.org/openSUSE:Systemd_packaging_guidelines # Move the installed cups.socket and cups.path into a documentation directory # so that experienced admins can make their own individual systemd unit files # for socket activation and/or path activation as they need it for their particular cases # see https://bugzilla.novell.com/show_bug.cgi?id=857372#c61 mkdir %{buildroot}/%{_defaultdocdir}/cups/systemd mv %{buildroot}/%{_unitdir}/cups.path %{buildroot}/%{_defaultdocdir}/cups/systemd/cups.path mv %{buildroot}/%{_unitdir}/cups.socket %{buildroot}/%{_defaultdocdir}/cups/systemd/cups.socket # Install /usr/lib/tmpfiles.d/cups.conf mkdir -p %{buildroot}%{_tmpfilesdir} cat > %{buildroot}%{_tmpfilesdir}/cups.conf < /etc/init.d/FOO # /usr/sbin/service exists only since openSUSE 12.3: %if 0%{?suse_version} > 1220 ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rccups %else ln -s /sbin/service %{buildroot}%{_sbindir}/rccups %endif # For information only: # When cupsd is launched via systemd there must no longer be any /etc/init.d/cups script # (e.g. as an attempt to provide backward compatibility e.g. via "exec /usr/sbin/rccups $@") # because systemd would recognize /etc/init.d/cups as another way to launch cupsd # in addition to the actual unit file /usr/lib/systemd/system/cups.service # which means calling "/etc/init.d/cups [start|stop|status]" does no longer work, # see http://www.freedesktop.org/wiki/Software/systemd/Incompatibilities/ # End launch cupsd via systemd %else # Begin launch cupsd via SysVinit: # Source101: cups.init install -d -m755 %{buildroot}/etc/init.d install -m755 %{SOURCE101} %{buildroot}/etc/init.d/cups ln -sf ../../etc/init.d/cups %{buildroot}/usr/sbin/rccups %if %suse_version > 1220 # Adapt init script according to Patch108 that moves everything to /run sed -i -e 's|/var/run|/run|g' %{buildroot}/etc/init.d/cups sed -i -e 's|/var/lock|/run/lock|g' %{buildroot}/etc/init.d/cups %endif # End launch cupsd via SysVinit %endif # End how cupsd is launched (via SysVinit or systemd) # Run fdupes: # The RPM macro fdupes runs /usr/bin/fdupes that links files with identical content. # Never run fdupes carelessly over the whole buildroot directory # because in older openSUSE and SLE11 versions fdupes # links files with different owner, group, or permissions # see https://bugzilla.novell.com/show_bug.cgi?id=784670 # and even in current openSUSE versions fdupes links across sub-package boundaries, # compare https://bugzilla.novell.com/show_bug.cgi?id=784869 # so that fdupes can only run for specific directories where linking files is safe. # Using fdupes -s, which will create symlinks that are easier to grasp for rpm and # rpmlint will give a "dangling symlink" error if the file and link ended up in different packages: %fdupes -s %{buildroot}/%{_datadir}/cups %pre # Use a real bash script with an explicit "exit 0" at the end to be by default fail safe # an explicit "exit 1" must be use to enforce package install/upgrade/erase failure where needed # see the "Shared_libraries" section in http://en.opensuse.org/openSUSE:Packaging_scriptlet_snippets %if 0%{?have_systemd} # Cleaning up obsolete systemd units cups.path and cups.socket is only needed up to openSUSE 13.1 # because cups.path and cups.socket are only provided from openSUSE 12.2 up to openSUSE 13.1 # see bnc#857372 starting at https://bugzilla.novell.com/show_bug.cgi?id=857372#c61 %if 0%{?suse_version} <= 1310 # Begin clean up obsolete systemd units cups.path and cups.socket # Stop and disable systemd units that have been provided by a previous package version but are no longer provided by this package. # Do this in any case because YaST only supprts cups.service but not cups.socket or cups.path # see https://bugzilla.novell.com/show_bug.cgi?id=857372#c120 # and if cups.socket or cups.path would be actuve YaST would mess up the systemd setup for CUPS # see https://bugzilla.novell.com/show_bug.cgi?id=857372#c115 # which is one more reason that cups.socket and cups.path are completely disabled and removed # see https://bugzilla.novell.com/show_bug.cgi?id=857372#c61 for u in cups.path cups.socket do # (without "|| :" build fails with "Failed to get D-Bus connection: No connection to service manager. preinstall script ... failed"): systemctl --quiet stop $u || : systemctl --quiet disable $u || : done # End clean up obsolete systemd units cups.path and cups.socket %endif # Begin service_add_pre cups.service %service_add_pre cups.service # End service_add_pre cups.service %endif # See https://bugzilla.novell.com/show_bug.cgi?id=suse45719 # and attr(0775,root,ntadmin) for /usr/share/cups/drivers/ in the files section below # and the samba.spec file in openSUSE:13.1 for the used command there to be in sync with Samba # (without "|| :" build fails on SLE_11 and SLE_11_SP1 with "build_patchrpmcheck_scr: line 7: groupadd: command not found"): getent group ntadmin >/dev/null || groupadd -g 71 -o -r ntadmin || : exit 0 %post # Use a real bash script with an explicit "exit 0" at the end to be by default fail safe # an explicit "exit 1" must be use to enforce package install/upgrade/erase failure where needed # see the "Shared_libraries" section in http://en.opensuse.org/openSUSE:Packaging_scriptlet_snippets %if 0%{?have_systemd} # Begin service_add_post cups.service %service_add_post cups.service # End service_add_post cups.service # Begin refresh systemd unit cups.service # Be on the safe side and enforce systemd to use the cups.service file in this package # ("reenable" does not implicitly stop a running cupsd which is exactly correct here): if systemctl --quiet is-enabled cups.service then # (without "|| :" build fails with "Failed to get D-Bus connection: No connection to service manager. postinstall script ... failed"): systemctl --quiet reenable cups.service || : fi # End refresh systemd unit cups.service %else # Begin fillup_and_insserv -ny cups cups %{fillup_and_insserv -ny cups cups} # End fillup_and_insserv -ny cups cups %endif exit 0 %preun # Use a real bash script with an explicit "exit 0" at the end to be by default fail safe # an explicit "exit 1" must be use to enforce package install/upgrade/erase failure where needed # see the "Shared_libraries" section in http://en.opensuse.org/openSUSE:Packaging_scriptlet_snippets %if 0%{?have_systemd} # Begin service_del_preun cups.service %service_del_preun cups.service # End service_del_preun cups.service %else # Begin stop_on_removal cups %stop_on_removal cups # End stop_on_removal cups %endif exit 0 %postun # Use a real bash script with an explicit "exit 0" at the end to be by default fail safe # an explicit "exit 1" must be use to enforce package install/upgrade/erase failure where needed # see the "Shared_libraries" section in http://en.opensuse.org/openSUSE:Packaging_scriptlet_snippets %if 0%{?have_systemd} # Begin service_del_postun cups.service %service_del_postun cups.service # End service_del_postun cups.service %else # Begin restart_on_update cups %restart_on_update cups # End restart_on_update cups # Begin insserv_cleanup %{insserv_cleanup} # End insserv_cleanup %endif exit 0 %post libs # Use a real bash script with an explicit "exit 0" at the end to be by default fail safe # an explicit "exit 1" must be use to enforce package install/upgrade/erase failure where needed # see the "Shared_libraries" section in http://en.opensuse.org/openSUSE:Packaging_scriptlet_snippets /sbin/ldconfig exit 0 %postun libs # Use a real bash script with an explicit "exit 0" at the end to be by default fail safe # an explicit "exit 1" must be use to enforce package install/upgrade/erase failure where needed # see the "Shared_libraries" section in http://en.opensuse.org/openSUSE:Packaging_scriptlet_snippets /sbin/ldconfig exit 0 %files # The files sections list all mandatory files explicitly one by one. # In particular all executables are listed explicitly. # This avoids that CUPS' configure magic might silently # not build and install an executable when whatever condition # for configure's automated tests is not fulfilled in the build system, # for example see https://bugzilla.novell.com/show_bug.cgi?id=526847#c9 # When all mandatory files are explicitly listed, # the build fails intentionally if a mandatory file was not built # which ensures that already existing correctly built binary RPMs # are not overwritten by broken RPMs where mandatory files are missing. %defattr(-,root,root) %config(noreplace) %attr(640,root,lp) %{_sysconfdir}/cups/cupsd.conf %{_sysconfdir}/cups/cupsd.conf.default %config(noreplace) %attr(640,root,lp) %{_sysconfdir}/cups/snmp.conf %config(noreplace) %attr(755,lp,lp) %{_sysconfdir}/cups/interfaces %config(noreplace) %{_sysconfdir}/xinetd.d/cups-lpd %config %{_sysconfdir}/pam.d/cups %config %{_sysconfdir}/dbus-1/system.d/cups.conf %dir %attr(700,root,lp) %{_sysconfdir}/cups/ssl %dir %attr(755,root,lp) %{_sysconfdir}/cups/ppd /var/adm/fillup-templates/sysconfig.cups %if 0%{?have_systemd} %{_unitdir}/cups.service %{_tmpfilesdir}/cups.conf %else %config %attr(0755,root,root) %{_sysconfdir}/init.d/cups %endif %{_bindir}/cupstestppd %{_sbindir}/cupsaddsmb %{_sbindir}/cupsctl %{_sbindir}/cupsd %{_sbindir}/cupsfilter %{_sbindir}/rccups %dir /usr/lib/cups %dir /usr/lib/cups/backend /usr/lib/cups/backend/http /usr/lib/cups/backend/https /usr/lib/cups/backend/ipp /usr/lib/cups/backend/ipps /usr/lib/cups/backend/lpd /usr/lib/cups/backend/parallel /usr/lib/cups/backend/serial /usr/lib/cups/backend/snmp /usr/lib/cups/backend/socket /usr/lib/cups/backend/usb %dir /usr/lib/cups/cgi-bin /usr/lib/cups/cgi-bin/admin.cgi /usr/lib/cups/cgi-bin/classes.cgi /usr/lib/cups/cgi-bin/help.cgi /usr/lib/cups/cgi-bin/jobs.cgi /usr/lib/cups/cgi-bin/printers.cgi %dir /usr/lib/cups/daemon /usr/lib/cups/daemon/cups-deviced /usr/lib/cups/daemon/cups-driverd /usr/lib/cups/daemon/cups-exec /usr/lib/cups/daemon/cups-lpd /usr/lib/cups/daemon/cups-polld %dir /usr/lib/cups/driver %dir /usr/lib/cups/filter /usr/lib/cups/filter/bannertops /usr/lib/cups/filter/commandtoescpx /usr/lib/cups/filter/commandtopclx /usr/lib/cups/filter/commandtops /usr/lib/cups/filter/gziptoany /usr/lib/cups/filter/imagetops /usr/lib/cups/filter/imagetoraster /usr/lib/cups/filter/pdftops /usr/lib/cups/filter/pstops /usr/lib/cups/filter/rastertodymo /usr/lib/cups/filter/rastertoepson /usr/lib/cups/filter/rastertoescpx /usr/lib/cups/filter/rastertohp /usr/lib/cups/filter/rastertolabel /usr/lib/cups/filter/rastertopclx /usr/lib/cups/filter/rastertopwg /usr/lib/cups/filter/texttops %dir /usr/lib/cups/monitor /usr/lib/cups/monitor/bcp /usr/lib/cups/monitor/tbcp %dir /usr/lib/cups/notifier /usr/lib/cups/notifier/dbus /usr/lib/cups/notifier/mailto /usr/lib/cups/notifier/rss %dir %attr(0775,root,ntadmin) %{_datadir}/cups/drivers %{_datadir}/applications/cups.desktop %{_datadir}/pixmaps/cups.png %doc %{_defaultdocdir}/cups %doc %{_mandir}/man1/cupstestppd.1.gz %doc %{_mandir}/man5/classes.conf.5.gz %doc %{_mandir}/man5/client.conf.5.gz %doc %{_mandir}/man5/cups-snmp.conf.5.gz %doc %{_mandir}/man5/cupsd.conf.5.gz %doc %{_mandir}/man5/mailto.conf.5.gz %doc %{_mandir}/man5/mime.convs.5.gz %doc %{_mandir}/man5/mime.types.5.gz %doc %{_mandir}/man5/printers.conf.5.gz %doc %{_mandir}/man5/subscriptions.conf.5.gz %doc %{_mandir}/man7/backend.7.gz %doc %{_mandir}/man7/filter.7.gz %doc %{_mandir}/man7/notifier.7.gz %doc %{_mandir}/man8/cups-deviced.8.gz %doc %{_mandir}/man8/cups-driverd.8.gz %doc %{_mandir}/man8/cups-lpd.8.gz %doc %{_mandir}/man8/cups-polld.8.gz %doc %{_mandir}/man8/cupsaddsmb.8.gz %doc %{_mandir}/man8/cupsctl.8.gz %doc %{_mandir}/man8/cupsd.8.gz %doc %{_mandir}/man8/cupsfilter.8.gz %{_datadir}/cups/ %exclude %{_datadir}/cups/ppdc/ %files client # Set explicite owner, group, and permissions for lppasswd # to enforce to have the upstream owner, group, and permissions in the RPM # because otherwise our build magic /usr/sbin/Check sets them to lp:lp 2755 # according to /etc/permissions.secure in the build system, # see https://bugzilla.novell.com/show_bug.cgi?id=574336#c12 # and subsequent comments up to comment #17 therein. # Even if /etc/permissions.secure in the openSUSE:Factory build system might be # already fixed, it must also work for build systems for released products. %defattr(-,root,root) %{_bindir}/cancel %{_bindir}/cupstestdsc %{_bindir}/ipptool %{_bindir}/lp %{_bindir}/lpoptions %attr(0555,root,root) %{_bindir}/lppasswd %{_bindir}/lpq %{_bindir}/lpr %{_bindir}/lprm %{_bindir}/lpstat %{_sbindir}/accept %{_sbindir}/cupsaccept %{_sbindir}/cupsdisable %{_sbindir}/cupsenable %{_sbindir}/cupsreject %{_sbindir}/lpadmin %{_sbindir}/lpc %{_sbindir}/lpinfo %{_sbindir}/lpmove %{_sbindir}/reject %doc %{_mandir}/man1/cancel.1.gz %doc %{_mandir}/man1/cupstestdsc.1.gz %doc %{_mandir}/man1/ipptool.1.gz %doc %{_mandir}/man1/lp.1.gz %doc %{_mandir}/man1/lpoptions.1.gz %doc %{_mandir}/man1/lppasswd.1.gz %doc %{_mandir}/man1/lpq.1.gz %doc %{_mandir}/man1/lpr.1.gz %doc %{_mandir}/man1/lprm.1.gz %doc %{_mandir}/man1/lpstat.1.gz %doc %{_mandir}/man5/ipptoolfile.5.gz %doc %{_mandir}/man8/accept.8.gz %doc %{_mandir}/man8/cupsaccept.8.gz %doc %{_mandir}/man8/cupsdisable.8.gz %doc %{_mandir}/man8/cupsenable.8.gz %doc %{_mandir}/man8/cupsreject.8.gz %doc %{_mandir}/man8/lpadmin.8.gz %doc %{_mandir}/man8/lpc.8.gz %doc %{_mandir}/man8/lpinfo.8.gz %doc %{_mandir}/man8/lpmove.8.gz %doc %{_mandir}/man8/reject.8.gz %files devel %defattr(-,root,root) %{_includedir}/cups/ %{_libdir}/libcups.so %{_libdir}/libcupsimage.so %{_libdir}/libcupscgi.so %{_libdir}/libcupsdriver.so %{_libdir}/libcupsmime.so %{_libdir}/libcupsppdc.so %{_datadir}/cups/ppdc/ %files ddk %defattr(-,root,root) %{_bindir}/ppdc %{_bindir}/ppdhtml %{_bindir}/ppdi %{_bindir}/ppdmerge %{_bindir}/ppdpo %doc %{_mandir}/man1/ppdc.1.gz %doc %{_mandir}/man1/ppdhtml.1.gz %doc %{_mandir}/man1/ppdi.1.gz %doc %{_mandir}/man1/ppdmerge.1.gz %doc %{_mandir}/man1/ppdpo.1.gz %doc %{_mandir}/man5/ppdcfile.5.gz %files libs %defattr(-,root,root) %config(noreplace) %{_sysconfdir}/cups/client.conf %dir %attr(0710,root,lp) %{_var}/spool/cups %dir %attr(1770,root,lp) %{_var}/spool/cups/tmp %dir %attr(0755,lp,lp) %{_var}/log/cups/ %dir %attr(0775,lp,lp) %{_var}/cache/cups %{_bindir}/cups-config %{_libdir}/libcups.so.* %{_libdir}/libcupscgi.so.* %{_libdir}/libcupsdriver.so.* %{_libdir}/libcupsimage.so.* %{_libdir}/libcupsmime.so.* %{_libdir}/libcupsppdc.so.* %{_datadir}/locale/*/cups_* %doc %{_mandir}/man1/cups-config.1.gz %changelog