initial import
This commit is contained in:
195
cups/PKGBUILD
Normal file
195
cups/PKGBUILD
Normal file
@@ -0,0 +1,195 @@
|
||||
# Maintainer: Jesus E. <heckyel@riseup.net>
|
||||
|
||||
pkgbase=cups
|
||||
pkgname=('libcups' 'cups')
|
||||
pkgver=2.3.3
|
||||
_debver=$pkgver
|
||||
_debrel=3
|
||||
pkgrel=6
|
||||
arch=('i686' 'x86_64')
|
||||
license=('custom:Apache-2.0+CUPS-Exceptions')
|
||||
url='https://www.cups.org/'
|
||||
makedepends=('libtiff' 'libpng' 'acl' 'xdg-utils' 'krb5' 'gnutls'
|
||||
'cups-filters' 'bc' 'gzip' 'autoconf' 'libusb'
|
||||
'hicolor-icon-theme' 'libxcrypt' 'libpaper' 'quilt')
|
||||
source=("${pkgbase}-${pkgver}.tar.gz::https://deb.debian.org/debian/pool/main/c/cups/cups_${pkgver}op2.orig.tar.gz"
|
||||
"https://security.debian.org/pool/updates/main/c/cups/cups_${_debver}op2-${_debrel}+deb11u9.debian.tar.xz"
|
||||
"cups.logrotate"
|
||||
# improve build and linking
|
||||
"cups-no-export-ssllibs.patch"
|
||||
"cups-1.6.2-statedir.patch"
|
||||
"guid.patch"
|
||||
"cupsd.initd"
|
||||
"cupsd.run"
|
||||
"install-server-executables-in-usrlibexeccups.patch")
|
||||
sha512sums=('db27dd6fb616bd7ad895b2bdf4ea7b010501358a50dc8f2e7e29558d1cfc088a572b1b35ac512654d3ed410c84df87dc34ca636533a4499117253915d4763117'
|
||||
'c3091522c0a1ce31636771a1bf80ee8a24d6637832e6ce235d02c1d40d8c115744cd92c2a4165ed0f7265200cb5a8ceebda0e9ab1eb684c5e9c896bad40675e5'
|
||||
'6a3bec9b9d7625b1c364446afa8e5794934e56cbe8385f53759247702777d257cc229634ce8a8e5d1abe93494c19ac513f559d5c1b115897d1adb44ce0cd66c0'
|
||||
'7a8cd9ac33b0dd4627c72df4275db8ccd7cf8e201bce3833719b42f532f526bb347b842e3ea1ef0d61855b5c6e1088b5d20b68942f2c2c0acf504d8d9728efd3'
|
||||
'486295ae3a3404241034aeb8667667b663966c560f37b5b005eaef189b114f1829dfc427464856f68c263a82d201b9cb4ae3f4b0f3b3dc25b22f90d68cbea705'
|
||||
'1d079c9f0372bd2435ccdc5b1e6ca6edaee8bdd2f7cc116a0787fa50e4d116b2a33f63fd89621e455b3058bfea315bf15b7440142f01f3c18fea3bc334cd8953'
|
||||
'e635cd76ea5797a33951b62acb8747174abbe9bb309573864a4620df6a097619718122029e2fa8f0f99fbd4f09b0696324d971436653df72736d4e9984e75425'
|
||||
'bd2f7f8c8961bd7dab70ca03e169ac68f8c092644aaa3f703d4f4ee2fadc88888b72c202d363bdddfba2c4f153334fd03936d9951105ea95ce0513e831c22eb8'
|
||||
'bb79002f365539d380f5865aaa4e109168fb4a00dffce7dbdd8b17125625b0c182d9f9aa44febac5e6b53ccddfaddc0beba85c91068affa510cb54b1dafc594c')
|
||||
|
||||
prepare() {
|
||||
mv "${pkgbase}-${pkgver}op2" "${pkgbase}-${pkgver}"
|
||||
cd ${pkgbase}-${pkgver}
|
||||
|
||||
if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
|
||||
# Debian patches
|
||||
export QUILT_PATCHES=debian/patches
|
||||
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
|
||||
export QUILT_DIFF_ARGS='--no-timestamps'
|
||||
|
||||
mv "$srcdir"/debian .
|
||||
|
||||
# Doesn't apply
|
||||
rm -v debian/patches/0004-Apple-AirPrint-support.patch || true
|
||||
rm -v debian/patches/0006-Debian-Set-LogFileGroup-to-adm.patch || true
|
||||
rm -v debian/patches/0010-Debian-Use-dpkg-architecture-in-cups-config-to-make-.patch || true
|
||||
rm -v debian/patches/0015-Debian-po4a-infrastructure-and-translations-for-manp.patch || true
|
||||
|
||||
quilt push -av
|
||||
fi
|
||||
|
||||
# improve build and linking
|
||||
# Do not export SSL libs in cups-config
|
||||
patch -Np1 -i ${srcdir}/cups-no-export-ssllibs.patch
|
||||
# move /var/run -> /run for pid file
|
||||
patch -Np1 -i ${srcdir}/cups-1.6.2-statedir.patch
|
||||
|
||||
# bug fixes
|
||||
# FS#56818 - https://github.com/apple/cups/issues/5236
|
||||
patch -Np1 -i "${srcdir}"/guid.patch
|
||||
|
||||
# set MaxLogSize to 0 to prevent using cups internal log rotation
|
||||
sed -i -e '5i\ ' conf/cupsd.conf.in
|
||||
sed -i -e '6i# Disable cups internal logging - use logrotate instead' conf/cupsd.conf.in
|
||||
sed -i -e '7iMaxLogSize 0' conf/cupsd.conf.in
|
||||
|
||||
# install server executables in /usr/libexec/cups to make it FHS compliant
|
||||
patch -Np1 -i "${srcdir}"/install-server-executables-in-usrlibexeccups.patch
|
||||
|
||||
# additional path corrections needed for prefix
|
||||
# https://bugs.gentoo.org/show_bug.cgi?id=597728
|
||||
sed -e "s:ICONDIR.*:ICONDIR = /usr/share/icons:" \
|
||||
-e "s:INITDIR.*:INITDIR = /etc:" \
|
||||
-e "s:MENUDIR.*:MENUDIR = /usr/share/applications:" \
|
||||
-i Makedefs.in
|
||||
|
||||
# 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 \
|
||||
--libdir=/usr/lib \
|
||||
--with-logdir=/var/log/cups \
|
||||
--with-docdir=/usr/share/cups/doc \
|
||||
--with-cups-user=daemon \
|
||||
--with-cups-group=lp \
|
||||
--disable-pam \
|
||||
--enable-raw-printing \
|
||||
--disable-dbus \
|
||||
--enable-ssl=yes \
|
||||
--enable-threads \
|
||||
--disable-avahi \
|
||||
--disable-dnssd \
|
||||
--enable-libpaper \
|
||||
--with-optim="$CFLAGS" #--help
|
||||
make
|
||||
}
|
||||
|
||||
check() {
|
||||
cd ${pkgbase}-${pkgver}
|
||||
#make -k check || /bin/true
|
||||
}
|
||||
|
||||
package_libcups() {
|
||||
pkgdesc="The CUPS Printing System - client libraries and headers"
|
||||
depends=('gnutls' 'libtiff>=4.0.0' 'libpng>=1.5.7' 'krb5' 'libusb' 'libxcrypt')
|
||||
|
||||
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 licenses
|
||||
for i in LICENSE NOTICE; do
|
||||
install -Dm644 $i $pkgdir/usr/share/licenses/$pkgname/$i
|
||||
done
|
||||
}
|
||||
|
||||
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/logrotate.d/cups)
|
||||
depends=('acl' "libcups>=${pkgver}" 'cups-filters' 'bc'
|
||||
'libpaper' 'hicolor-icon-theme')
|
||||
optdepends=('xdg-utils: xdg .desktop file support'
|
||||
'logrotate: for logfile rotation 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
|
||||
|
||||
# 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
|
||||
|
||||
# comment out all conversion rules which use any of the removed filters that are now part of cups-filters
|
||||
perl -p -i -e 's:^(.*\s+bannertops\s*)$:#\1:' $pkgdir/usr/share/cups/mime/mime.convs
|
||||
|
||||
# comment out unnecessary PageLogFormat entry
|
||||
sed -i -e 's:PageLogFormat:#PageLogFormat:' $pkgdir/etc/cups/cupsd.conf*
|
||||
|
||||
# OpenRC
|
||||
install -Dm755 ${srcdir}/cupsd.initd ${pkgdir}/etc/init.d/cupsd
|
||||
|
||||
# runit
|
||||
install -Dm755 ${srcdir}/cupsd.run ${pkgdir}/etc/sv/cupsd/run
|
||||
|
||||
# install licenses
|
||||
for i in LICENSE NOTICE; do
|
||||
install -Dm644 $i $pkgdir/usr/share/licenses/$pkgname/$i
|
||||
done
|
||||
}
|
||||
12
cups/cups-1.6.2-statedir.patch
Normal file
12
cups/cups-1.6.2-statedir.patch
Normal 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")
|
||||
12
cups/cups-no-export-ssllibs.patch
Normal file
12
cups/cups-no-export-ssllibs.patch
Normal 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
|
||||
6
cups/cups.install
Normal file
6
cups/cups.install
Normal file
@@ -0,0 +1,6 @@
|
||||
post_install() {
|
||||
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."
|
||||
}
|
||||
5
cups/cups.logrotate
Normal file
5
cups/cups.logrotate
Normal file
@@ -0,0 +1,5 @@
|
||||
/var/log/cups/*_log {
|
||||
missingok
|
||||
notifempty
|
||||
sharedscripts
|
||||
}
|
||||
20
cups/cupsd.initd
Normal file
20
cups/cupsd.initd
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2016 Gentoo Foundation
|
||||
# Copyright 2019 Hyperbola Project
|
||||
# Distributed under the terms of the GNU General Public License, v2 or later
|
||||
|
||||
description="The Common Unix Printing System service"
|
||||
command="/usr/sbin/cupsd"
|
||||
|
||||
depend() {
|
||||
use net
|
||||
before nfs
|
||||
after logger
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath -q -d -m 0775 -o root:lp /var/cache/cups
|
||||
checkpath -q -d -m 0775 -o root:lp /var/cache/cups/rss
|
||||
checkpath -q -d -m 0755 -o root:lp /run/cups
|
||||
checkpath -q -d -m 0511 -o daemon:sys /run/cups/certs
|
||||
}
|
||||
2
cups/cupsd.run
Normal file
2
cups/cupsd.run
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec cupsd -f
|
||||
42
cups/guid.patch
Normal file
42
cups/guid.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
diff --git a/scheduler/cups-exec.c b/scheduler/cups-exec.c
|
||||
index aab43a797..46c549075 100644
|
||||
--- a/scheduler/cups-exec.c
|
||||
+++ b/scheduler/cups-exec.c
|
||||
@@ -133,8 +133,13 @@ main(int argc, /* I - Number of command-line args */
|
||||
if (setgid(gid))
|
||||
exit(errno + 100);
|
||||
|
||||
- if (setgroups(1, &gid))
|
||||
+#include <pwd.h>
|
||||
+ struct passwd * pwd = getpwuid(uid);
|
||||
+ if(initgroups(pwd->pw_name,pwd->pw_gid))
|
||||
+ {
|
||||
+ fprintf(stderr, "DEBUG: initgroups failed\n");
|
||||
exit(errno + 100);
|
||||
+ }
|
||||
|
||||
if (uid && setuid(uid))
|
||||
exit(errno + 100);
|
||||
diff --git a/scheduler/util.c b/scheduler/util.c
|
||||
index 19ebf069b..4638562bd 100644
|
||||
--- a/scheduler/util.c
|
||||
+++ b/scheduler/util.c
|
||||
@@ -300,7 +300,16 @@ cupsdPipeCommand(int *pid, /* O - Process ID or 0 on error */
|
||||
*/
|
||||
|
||||
if (!getuid() && user)
|
||||
- setuid(user); /* Run as restricted user */
|
||||
+ {
|
||||
+#include <pwd.h>
|
||||
+ struct passwd * pwd = getpwuid(user);
|
||||
+ if(initgroups(pwd->pw_name,pwd->pw_gid))
|
||||
+ {
|
||||
+ fprintf(stderr, "DEBUG: initgroups failed\n");
|
||||
+ exit(errno + 100);
|
||||
+ }
|
||||
+ setuid(user); /* Run as restricted user */
|
||||
+ }
|
||||
|
||||
if ((fd = open("/dev/null", O_RDONLY)) > 0)
|
||||
{
|
||||
|
||||
24
cups/install-server-executables-in-usrlibexeccups.patch
Normal file
24
cups/install-server-executables-in-usrlibexeccups.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
--- a/config-scripts/cups-directories.m4 2023-01-30 00:09:55.000000000 +0100
|
||||
+++ b/config-scripts/cups-directories.m4 2023-01-30 00:12:36.304132805 +0100
|
||||
@@ -264,8 +264,8 @@
|
||||
case "$host_os_name" in
|
||||
*-gnu)
|
||||
# GNUs
|
||||
- INSTALL_SYSV="install-sysv"
|
||||
- CUPS_SERVERBIN="$exec_prefix/lib/cups"
|
||||
+ INSTALL_SYSV=""
|
||||
+ CUPS_SERVERBIN="$exec_prefix/libexec/cups"
|
||||
;;
|
||||
*bsd* | darwin*)
|
||||
# *BSD and Darwin (macOS)
|
||||
@@ -274,8 +274,8 @@
|
||||
;;
|
||||
*)
|
||||
# All others
|
||||
- INSTALL_SYSV="install-sysv"
|
||||
- CUPS_SERVERBIN="$exec_prefix/lib/cups"
|
||||
+ INSTALL_SYSV=""
|
||||
+ CUPS_SERVERBIN="$exec_prefix/libexec/cups"
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user