diff options
author | wiz <wiz@pkgsrc.org> | 2017-07-27 08:54:26 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2017-07-27 08:54:26 +0000 |
commit | 9e8aff785a789fbe0207e67d7fd16a22f0059fe0 (patch) | |
tree | b757bc5d2a827cdfd21959d5c2cbb95d4c7c9266 /print/cups | |
parent | c81ae47bc953092e9d0129107cf764cf2458cbcf (diff) | |
download | pkgsrc-9e8aff785a789fbe0207e67d7fd16a22f0059fe0.tar.gz |
Add proper pidfile support, from Edgar Fuß.
This has not been accepted upstream in various previous tries, but is
deemed useful functionality anyway.
Bump PKGREVISION.
While here, revert undiscussed mit-krb5 dependency. Should be optional,
and should have bumped PKGREVISION.
Diffstat (limited to 'print/cups')
-rw-r--r-- | print/cups/Makefile | 5 | ||||
-rw-r--r-- | print/cups/distinfo | 8 | ||||
-rw-r--r-- | print/cups/files/cupsd.sh | 3 | ||||
-rw-r--r-- | print/cups/patches/patch-conf-cups-files.conf.in | 17 | ||||
-rw-r--r-- | print/cups/patches/patch-doc-help-man-cups-files.conf.html | 17 | ||||
-rw-r--r-- | print/cups/patches/patch-man-cups-files.conf.man.in | 19 | ||||
-rw-r--r-- | print/cups/patches/patch-scheduler-conf.c | 30 | ||||
-rw-r--r-- | print/cups/patches/patch-scheduler-conf.h | 15 | ||||
-rw-r--r-- | print/cups/patches/patch-scheduler-main.c | 86 |
9 files changed, 195 insertions, 5 deletions
diff --git a/print/cups/Makefile b/print/cups/Makefile index 7f83a7bda43..b7d171cf086 100644 --- a/print/cups/Makefile +++ b/print/cups/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.246 2017/07/25 18:30:39 reinoud Exp $ +# $NetBSD: Makefile,v 1.247 2017/07/27 08:54:26 wiz Exp $ DISTNAME= cups-2.2.3-source PKGNAME= ${DISTNAME:S/-source//} -PKGREVISION= 1 +PKGREVISION= 2 CATEGORIES= print MASTER_SITES= ${MASTER_SITE_GITHUB:=apple/} @@ -171,5 +171,4 @@ post-install: .include "../../mk/curses.buildlink3.mk" .include "../../mk/jpeg.buildlink3.mk" .include "../../mk/pthread.buildlink3.mk" -.include "../../security/mit-krb5/buildlink3.mk" .include "../../mk/bsd.pkg.mk" diff --git a/print/cups/distinfo b/print/cups/distinfo index 7fa2e68f1ff..c90f53ac507 100644 --- a/print/cups/distinfo +++ b/print/cups/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.122 2017/05/25 12:11:55 jperkin Exp $ +$NetBSD: distinfo,v 1.123 2017/07/27 08:54:26 wiz Exp $ SHA1 (cups-2.2.3-source.tar.gz) = 149e9ded0744b7545630c62b6a347e747928e0f7 RMD160 (cups-2.2.3-source.tar.gz) = 3eb91fbd20bee081e08af64ddfa23a45f2bfa7b2 @@ -8,6 +8,7 @@ SHA1 (patch-ae) = 04f314bbbb05538b67a0f68adc241a09e836a4e2 SHA1 (patch-af) = 6ae6ae6006387db69bf7c15f7c8500708c9e8f56 SHA1 (patch-ai) = 2c1ca67ea6f6c1dedb4c8ff97736f328a2b9a7c6 SHA1 (patch-at) = ef6303936daf0826dc4725f5369bfb1add832b1f +SHA1 (patch-conf-cups-files.conf.in) = 327cc8b62e606389542870aa6619ade10377b044 SHA1 (patch-conf_Makefile) = bb8313e493c02959edfe1e53f50b9f16ce6f42e0 SHA1 (patch-config-scripts_cups-compiler.m4) = 6b825d05163a91ee3092a68a3b0abc173a378026 SHA1 (patch-config-scripts_cups-directories.m4) = 1daa2b6237d3675665f273678271b7b522905c8d @@ -16,7 +17,12 @@ SHA1 (patch-config-scripts_cups-manpages.m4) = cc920bf46555aab5610e91de4ca1f6991 SHA1 (patch-config-scripts_cups-sharedlibs.m4) = 5b95da8f91de0aaab8b3f826ce0a2662cee3f63a SHA1 (patch-configure.ac) = 0e48669372badc477db7d6f26c8180062f4e78de SHA1 (patch-cups-tls.c) = f89c25f8089d9e11a983a270adbb2cbde3c22511 +SHA1 (patch-doc-help-man-cups-files.conf.html) = fcd3d06c00b0a85b6c0790235ccb68685252ea68 +SHA1 (patch-man-cups-files.conf.man.in) = 1563a7be3327a975ce8753a3287947f1594975a3 SHA1 (patch-ppdc_Makefile) = 575ab7d75bebf086cde52956679164c9f01fd37e +SHA1 (patch-scheduler-conf.c) = 179964f8d251be3c21f4cfc7b67f3196beda29dc +SHA1 (patch-scheduler-conf.h) = d11f3b789af096dcaca13a38f6484727ff895bee +SHA1 (patch-scheduler-main.c) = 11f97cf9db4319fcff614a1b01d47d8e84ace4d9 SHA1 (patch-scheduler_auth.c) = ca675a6e903d4b41cd69a0cab27180653e11f501 SHA1 (patch-scheduler_dirsvc.c) = aae5b924fb8fb39007cf04d8b83747e8724485cf SHA1 (patch-test_ippfind.c) = 6db56b9b1b9a26d5c40336af4dc6cde98abd9c19 diff --git a/print/cups/files/cupsd.sh b/print/cups/files/cupsd.sh index 78d6fdca452..ba008f9aae4 100644 --- a/print/cups/files/cupsd.sh +++ b/print/cups/files/cupsd.sh @@ -1,6 +1,6 @@ #!@RCD_SCRIPTS_SHELL@ # -# $NetBSD: cupsd.sh,v 1.21 2017/04/26 14:10:04 prlw1 Exp $ +# $NetBSD: cupsd.sh,v 1.22 2017/07/27 08:54:26 wiz Exp $ # # Common UNIX Printing System daemon # @@ -23,6 +23,7 @@ fi name="cupsd" rcvar=${name} command="@PREFIX@/sbin/${name}" +pidfile="@VARBASE@/run/cups/cupsd.pid" lpstat_command="@PREFIX@/bin/lpstat" command_args="& sleep 2" required_files="@PKG_SYSCONFDIR@/${name}.conf" diff --git a/print/cups/patches/patch-conf-cups-files.conf.in b/print/cups/patches/patch-conf-cups-files.conf.in new file mode 100644 index 00000000000..def61eded22 --- /dev/null +++ b/print/cups/patches/patch-conf-cups-files.conf.in @@ -0,0 +1,17 @@ +$NetBSD: patch-conf-cups-files.conf.in,v 1.1 2017/07/27 08:54:26 wiz Exp $ + +Add a PidFile configuration directive to write a PID file. + +--- conf/cups-files.conf.in.orig 2017-03-28 20:26:53.000000000 +0200 ++++ conf/cups-files.conf.in 2017-07-17 17:25:02.000000000 +0200 +@@ -40,6 +40,10 @@ + # Location of data files used by the scheduler... + #DataDir @CUPS_DATADIR@ + ++# Location of PID file written by the scheduler (set empty for no PID file)... ++#PidFile @CUPS_STATEDIR@/cupsd.pid ++ ++# Location of the static web content served by the scheduler... + # Location of the static web content served by the scheduler... + #DocumentRoot @CUPS_DOCROOT@ + diff --git a/print/cups/patches/patch-doc-help-man-cups-files.conf.html b/print/cups/patches/patch-doc-help-man-cups-files.conf.html new file mode 100644 index 00000000000..474c7534df6 --- /dev/null +++ b/print/cups/patches/patch-doc-help-man-cups-files.conf.html @@ -0,0 +1,17 @@ +$NetBSD: patch-doc-help-man-cups-files.conf.html,v 1.1 2017/07/27 08:54:26 wiz Exp $ + +Add a PidFile configuration directive to write a PID file. + +--- doc/help/man-cups-files.conf.html.orig 2017-03-28 20:26:53.000000000 +0200 ++++ doc/help/man-cups-files.conf.html 2017-07-17 17:25:02.000000000 +0200 +@@ -116,6 +116,10 @@ + + </pre> + The default is "/var/log/cups/page_log". ++<dt><a name="PidFile"></a><b>PidFile </b><i>path</i> ++<dd style="margin-left: 5.0em">Specifies the file the CUPS scheduler writes its PID to ++(set to an ampty value to disable the PID file). ++The default is usually "/var/run/cups/cupsd.pid". + <dt><a name="RemoteRoot"></a><b>RemoteRoot </b><i>username</i> + <dd style="margin-left: 5.0em">Specifies the username that is associated with unauthenticated accesses by clients claiming to be the root user. + The default is "remroot". diff --git a/print/cups/patches/patch-man-cups-files.conf.man.in b/print/cups/patches/patch-man-cups-files.conf.man.in new file mode 100644 index 00000000000..bb1fcfb14f1 --- /dev/null +++ b/print/cups/patches/patch-man-cups-files.conf.man.in @@ -0,0 +1,19 @@ +$NetBSD: patch-man-cups-files.conf.man.in,v 1.1 2017/07/27 08:54:26 wiz Exp $ + +Add a PidFile configuration directive to write a PID file. + +--- man/cups-files.conf.man.in.orig 2017-03-28 20:26:53.000000000 +0200 ++++ man/cups-files.conf.man.in 2017-07-17 17:25:02.000000000 +0200 +@@ -159,6 +159,12 @@ + + .fi + The default is "/var/log/cups/page_log". ++.\"#PidFile ++.TP 5 ++\fBPidFile \fIpath\fR ++Specifies the file the CUPS scheduler writes its PID to ++(set to an empty value to disable the PID file). ++The default is usually "/var/run/cups/cupsd.pid". + .\"#RemoteRoot + .TP 5 + \fBRemoteRoot \fIusername\fR diff --git a/print/cups/patches/patch-scheduler-conf.c b/print/cups/patches/patch-scheduler-conf.c new file mode 100644 index 00000000000..b4dff19b6dd --- /dev/null +++ b/print/cups/patches/patch-scheduler-conf.c @@ -0,0 +1,30 @@ +$NetBSD: patch-scheduler-conf.c,v 1.1 2017/07/27 08:54:26 wiz Exp $ + +Add a PidFile configuration directive to write a PID file. + +--- scheduler/conf.c.orig 2017-03-28 20:26:53.000000000 +0200 ++++ scheduler/conf.c 2017-07-17 18:04:23.000000000 +0200 +@@ -142,6 +142,7 @@ static const cupsd_var_t cupsfiles_vars[ + { "CreateSelfSignedCerts", &CreateSelfSignedCerts, CUPSD_VARTYPE_BOOLEAN }, + #endif /* HAVE_SSL */ + { "DataDir", &DataDir, CUPSD_VARTYPE_STRING }, ++ { "PidFile", &PidFile, CUPSD_VARTYPE_STRING }, + { "DocumentRoot", &DocumentRoot, CUPSD_VARTYPE_STRING }, + { "ErrorLog", &ErrorLog, CUPSD_VARTYPE_STRING }, + { "FileDevice", &FileDevice, CUPSD_VARTYPE_BOOLEAN }, +@@ -579,6 +580,7 @@ cupsdReadConfiguration(void) + cupsdSetString(&RequestRoot, CUPS_REQUESTS); + cupsdSetString(&CacheDir, CUPS_CACHEDIR); + cupsdSetString(&DataDir, CUPS_DATADIR); ++ cupsdSetString(&PidFile, CUPS_STATEDIR "/cupsd.pid"); + cupsdSetString(&DocumentRoot, CUPS_DOCROOT); + cupsdSetString(&AccessLog, CUPS_LOGDIR "/access_log"); + cupsdClearString(&ErrorLog); +@@ -3402,6 +3404,7 @@ read_cupsd_conf(cups_file_t *fp) /* I - + !_cups_strcasecmp(line, "CacheDir") || + !_cups_strcasecmp(line, "ConfigFilePerm") || + !_cups_strcasecmp(line, "DataDir") || ++ !_cups_strcasecmp(line, "PidFile") || + !_cups_strcasecmp(line, "DocumentRoot") || + !_cups_strcasecmp(line, "ErrorLog") || + !_cups_strcasecmp(line, "FatalErrors") || diff --git a/print/cups/patches/patch-scheduler-conf.h b/print/cups/patches/patch-scheduler-conf.h new file mode 100644 index 00000000000..a01e60bd2a2 --- /dev/null +++ b/print/cups/patches/patch-scheduler-conf.h @@ -0,0 +1,15 @@ +$NetBSD: patch-scheduler-conf.h,v 1.1 2017/07/27 08:54:26 wiz Exp $ + +Add a PidFile configuration directive to write a PID file. + +--- scheduler/conf.h.orig 2017-03-28 20:26:53.000000000 +0200 ++++ scheduler/conf.h 2017-07-17 17:25:02.000000000 +0200 +@@ -134,6 +134,8 @@ + /* Cache file directory */ + *DataDir VALUE(NULL), + /* Data file directory */ ++ *PidFile VALUE(NULL), ++ /* PID file */ + *DefaultLanguage VALUE(NULL), + /* Default language encoding */ + *DefaultLocale VALUE(NULL), diff --git a/print/cups/patches/patch-scheduler-main.c b/print/cups/patches/patch-scheduler-main.c new file mode 100644 index 00000000000..57e292a5b70 --- /dev/null +++ b/print/cups/patches/patch-scheduler-main.c @@ -0,0 +1,86 @@ +$NetBSD: patch-scheduler-main.c,v 1.1 2017/07/27 08:54:26 wiz Exp $ + +Add a PidFile configuration directive to write a PID file. + +--- scheduler/main.c.orig 2017-03-28 20:26:53.000000000 +0200 ++++ scheduler/main.c 2017-07-17 18:02:10.000000000 +0200 +@@ -72,6 +72,7 @@ static void service_checkin(void); + static void service_checkout(void); + #endif /* HAVE_ONDEMAND */ + static void usage(int status) __attribute__((noreturn)); ++static int create_pidfile(const char *path); + + + /* +@@ -675,6 +676,13 @@ main(int argc, /* I - Number of comm + #endif /* __APPLE__ */ + + /* ++ * Create pidfile... ++ */ ++ if (PidFile && *PidFile) ++ if (!create_pidfile(PidFile)) ++ goto fail; ++ ++ /* + * Send server-started event... + */ + +@@ -1129,6 +1137,7 @@ main(int argc, /* I - Number of comm + "Scheduler shutting down due to program error."); + } + ++fail: + /* + * Close all network clients... + */ +@@ -1152,6 +1161,12 @@ main(int argc, /* I - Number of comm + + cupsdFreeAllJobs(); + ++ /* ++ * Remove pidfile... ++ */ ++ if (PidFile && *PidFile) ++ (void)unlink(PidFile); ++ + #ifdef __APPLE__ + /* + * Stop monitoring system event monitoring... +@@ -2035,6 +2050,36 @@ service_checkout(void) + + + /* ++ * 'create_pidfile()' - Create PID file. ++ */ ++static int ++create_pidfile(const char *path) ++{ ++ int fd; ++ size_t l; ++ char s[42]; ++ if ((l = snprintf(s, sizeof(s), "%jd\n", (intmax_t)getpid())) < 0) { ++ cupsdLogMessage(CUPSD_LOG_EMERG, "PidFile: snprintf() failed - %s!", ++ strerror(errno)); ++ return (0); ++ } ++ if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) { ++ cupsdLogMessage(CUPSD_LOG_EMERG, "PidFile: open(%s) failed - %s!", ++ path, strerror(errno)); ++ return (0); ++ } ++ if (write(fd, s, l + 1) < l + 1) { ++ cupsdLogMessage(CUPSD_LOG_EMERG, "PidFile %s: write(\"%s\", %zd) failed - %s!", ++ path, s, l + 1, strerror(errno)); ++ (void)close(fd); ++ return (0); ++ } ++ (void)close(fd); ++ return (1); ++} ++ ++ ++/* + * 'usage()' - Show scheduler usage. + */ + |