Re: [ptxdist] [PATCH 5/7] cups: new package: Common Unix Printing System

2017-09-27 Thread Roland Hieber

On 28.08.2017 14:51, Michael Olbrich wrote:

+CUPS_CONF_OPT  += \
+   --with-components=all \
+   --with-cachedir=/var/cache \
+   --with-logdir=/var/log \
+   --with-rundir=/run \
+   --with-rcdir=/etc \
+   --with-languages=none \
+   --with-cups-user=daemon \
+   --with-cups-group=lp \
+   $(call ptx/ifdef,PTXCONF_CUPS_JAVA,--with-java=/usr/bin/java,) \
+   $(call ptx/ifdef,PTXCONF_CUPS_PERL,--with-perl=/usr/bin/perl,) \
+   $(call ptx/ifdef,PTXCONF_CUPS_PHP,--with-php=/usr/bin/php5,) \
+   $(call ptx/ifdef,PTXCONF_CUPS_PYTHON,--with-python=/usr/bin/python,)


Are these options only to set the executable path? If yes then always set
those and remove the options and dependencies. Just add a comment to the
webinterface option.


configure defines HAVE_JAVA etc. in these cases, which influences the 
scheduler code. Nevertheless, configure is a bit broken here, PATCH v2 
will patch it for proper --without-* handling.


 - Roland

___
ptxdist mailing list
ptxdist@pengutronix.de

Re: [ptxdist] [PATCH 5/7] cups: new package: Common Unix Printing System

2017-08-30 Thread Juergen Borleis
Hi Roland,

On Thursday 24 August 2017 00:39:09 Roland Hieber wrote:
> [...]
> +$(STATEDIR)/cups.targetinstall:
> + @$(call targetinfo)
> +
> + @$(call install_init, cups)
> + @$(call install_fixup, cups,PRIORITY,optional)
> + @$(call install_fixup, cups,SECTION,base)
> + @$(call install_fixup, cups,AUTHOR,"Roland Hieber 
> ")
> + @$(call install_fixup, cups,DESCRIPTION,missing)
> +
> +# - config files, install as daemon:lp

You should create "/etc/cups" explicitly, because it needs "daemon:lp" owners
as well.

> + @$(call install_alternative, cups, 1, 110, 0640, 
> /etc/cups/cups-files.conf)
> + @$(call install_alternative, cups, 1, 110, 0640, /etc/cups/cupsd.conf)
> + @$(call install_alternative, cups, 1, 110, 0600, /etc/cups/classes.conf)
> + @$(call install_alternative, cups, 1, 110, 0600, /etc/cups/client.conf)
> + @$(call install_alternative, cups, 1, 110, 0640, /etc/cups/mailto.conf)
> + @$(call install_alternative_tree, cups, 1, 110,  /etc/cups/ppd/)

The directory "/etc/cups/ppd" should also be owned by "daemon:lp", shouldn't it?

> + @$(call install_alternative, cups, 1, 110, 0600, 
> /etc/cups/printers.conf)
> + @$(call install_alternative, cups, 1, 110, 0640, /etc/cups/snmp.conf)
> + @$(call install_alternative, cups, 1, 110, 0640, /etc/printcap)
> + @$(call install_alternative, cups, 1, 110, 0640, 
> /usr/share/cups/mime/mime.convs)

Why not "root.root" for files in "/usr/share/cups"?

> + @$(call install_alternative, cups, 1, 110, 0640, 
> /usr/share/cups/mime/mime.types)

Same here.

> + 
> +ifdef PTXCONF_CUPS_SSL
> + @$(call install_alternative_tree, cups, 1, 110, /etc/cups/ssl/)

The directory "/etc/cups/ssl" should also be owned by "daemon:lp", shouldn't it?

> +endif
> [...]

Cheers, Juergen

-- 
Pengutronix e.K.                             | Juergen Borleis             |
Industrial Linux Solutions                   | http://www.pengutronix.de/  |

___
ptxdist mailing list
ptxdist@pengutronix.de

Re: [ptxdist] [PATCH 5/7] cups: new package: Common Unix Printing System

2017-08-29 Thread Michael Olbrich
On Mon, Aug 28, 2017 at 04:03:28PM +0200, Roland Hieber wrote:
> On 28.08.2017 14:51, Michael Olbrich wrote:
> > On Thu, Aug 24, 2017 at 12:39:09AM +0200, Roland Hieber wrote:
> >> [...]
> > > +# - config files, install as daemon:lp
> > 
> > You can use the user and group names below.
> 
> Oh, ok. I always thought they would then refer to the users/groups on the
> host system.

It will find the file in projectroot, so unless you do very strange things
there, it will work as expected.

> > > + @$(call install_alternative, cups, 1, 110, 0640, 
> > > /etc/cups/cups-files.conf)
> > > + @$(call install_alternative, cups, 1, 110, 0640, /etc/cups/cupsd.conf)
> > > + @$(call install_alternative, cups, 1, 110, 0600, /etc/cups/classes.conf)
> > > + @$(call install_alternative, cups, 1, 110, 0600, /etc/cups/client.conf)
> > > + @$(call install_alternative, cups, 1, 110, 0640, /etc/cups/mailto.conf)
> >> [...]
> > > +ifdef PTXCONF_CUPS_WEBINTERFACE
> > > + @$(call install_lib, cups, 0, 0, 0755, libcupscgi)
> > > + @$(call install_tree, cups, 0, 0, -, /usr/lib/cups/cgi-bin)
> > > + @$(call install_tree, cups, 0, 0, -, /usr/share/cups/templates)
> > > + @$(call install_tree, cups, 0, 0, -, /usr/share/doc/cups)
> > 
> > Why docs?
> 
> The web interface serves them under /help, and it would create broken links
> if those are missing. I find them rather helpful for the web interface.

Ok.

Michael

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
ptxdist mailing list
ptxdist@pengutronix.de

Re: [ptxdist] [PATCH 5/7] cups: new package: Common Unix Printing System

2017-08-28 Thread Roland Hieber

On 28.08.2017 14:51, Michael Olbrich wrote:

On Thu, Aug 24, 2017 at 12:39:09AM +0200, Roland Hieber wrote:

>> [...]

+# - config files, install as daemon:lp


You can use the user and group names below.


Oh, ok. I always thought they would then refer to the users/groups on 
the host system.



+   @$(call install_alternative, cups, 1, 110, 0640, 
/etc/cups/cups-files.conf)
+   @$(call install_alternative, cups, 1, 110, 0640, /etc/cups/cupsd.conf)
+   @$(call install_alternative, cups, 1, 110, 0600, /etc/cups/classes.conf)
+   @$(call install_alternative, cups, 1, 110, 0600, /etc/cups/client.conf)
+   @$(call install_alternative, cups, 1, 110, 0640, /etc/cups/mailto.conf)

>> [...]

+ifdef PTXCONF_CUPS_WEBINTERFACE
+   @$(call install_lib, cups, 0, 0, 0755, libcupscgi)
+   @$(call install_tree, cups, 0, 0, -, /usr/lib/cups/cgi-bin)
+   @$(call install_tree, cups, 0, 0, -, /usr/share/cups/templates)
+   @$(call install_tree, cups, 0, 0, -, /usr/share/doc/cups)


Why docs?


The web interface serves them under /help, and it would create broken 
links if those are missing. I find them rather helpful for the web 
interface.


 - Roland

--
Pengutronix e.K.  | Roland Hieber   |
Industrial Linux Solutions| http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917- |

___
ptxdist mailing list
ptxdist@pengutronix.de

Re: [ptxdist] [PATCH 5/7] cups: new package: Common Unix Printing System

2017-08-28 Thread Michael Olbrich
On Thu, Aug 24, 2017 at 12:39:09AM +0200, Roland Hieber wrote:
> If using systemd, CUPS can be started via socket activation or directly,
> in any case it is run as user daemon, group lp. The default spool and
> cache locations were moved to /tmp/cups so we don't need to set up a
> tmpfs for /var/spool/cups and /var/cache/cups.
> 
> sysvinit script is installed from upstream, but untested.
> 
> Some config files are only created by cupsd on the first start and not
> at install time, so we supply reasonable defaults in projectroot/ in
> order to use $(call install_alternative...) on them.
> 
> Signed-off-by: Roland Hieber 
> ---
>  projectroot/etc/cups/classes.conf   |   1 +
>  projectroot/etc/cups/client.conf|   2 +
>  projectroot/etc/cups/cups-files.conf|  22 +++
>  projectroot/etc/cups/mailto.conf|   1 +
>  projectroot/etc/cups/ppd/.createdirectory   |   0
>  projectroot/etc/cups/printers.conf  |   1 +
>  projectroot/etc/cups/ssl/.createdirectory   |   0
>  projectroot/etc/printcap|   3 +
>  projectroot/usr/lib/systemd/system/cups.service |  15 ++
>  projectroot/usr/lib/systemd/system/cups.socket  |  14 ++
>  projectroot/usr/lib/tmpfiles.d/cups.conf|   6 +
>  rules/cups.in   | 142 +++
>  rules/cups.make | 227 
> 
>  13 files changed, 434 insertions(+)
>  create mode 100644 projectroot/etc/cups/classes.conf
>  create mode 100644 projectroot/etc/cups/client.conf
>  create mode 100644 projectroot/etc/cups/cups-files.conf
>  create mode 100644 projectroot/etc/cups/mailto.conf
>  create mode 100644 projectroot/etc/cups/ppd/.createdirectory
>  create mode 100644 projectroot/etc/cups/printers.conf
>  create mode 100644 projectroot/etc/cups/ssl/.createdirectory
>  create mode 100644 projectroot/etc/printcap
>  create mode 100644 projectroot/usr/lib/systemd/system/cups.service
>  create mode 100644 projectroot/usr/lib/systemd/system/cups.socket
>  create mode 100644 projectroot/usr/lib/tmpfiles.d/cups.conf
>  create mode 100644 rules/cups.in
>  create mode 100644 rules/cups.make
> 
> diff --git a/projectroot/etc/cups/classes.conf 
> b/projectroot/etc/cups/classes.conf
> new file mode 100644
> index 0..dea737751
> --- /dev/null
> +++ b/projectroot/etc/cups/classes.conf
> @@ -0,0 +1 @@
> +# classes.conf - class configuration file for cups
> diff --git a/projectroot/etc/cups/client.conf 
> b/projectroot/etc/cups/client.conf
> new file mode 100644
> index 0..f8f0b6832
> --- /dev/null
> +++ b/projectroot/etc/cups/client.conf
> @@ -0,0 +1,2 @@
> +# CUPS client configuration
> +ServerName localhost
> diff --git a/projectroot/etc/cups/cups-files.conf 
> b/projectroot/etc/cups/cups-files.conf
> new file mode 100644
> index 0..2cc2d5a5b
> --- /dev/null
> +++ b/projectroot/etc/cups/cups-files.conf
> @@ -0,0 +1,22 @@
> +# File/directory/user/group configuration file for the CUPS scheduler.
> +User daemon
> +Group lp
> +SystemGroup root
> +
> +AccessLog /var/log/cups/access_log
> +ErrorLog /var/log/cups/error_log
> +PageLog /var/log/cups/page_log
> +
> +CacheDir /tmp/cups/cache
> +DataDir /usr/share/cups
> +DocumentRoot /usr/share/doc/cups
> +RequestRoot /tmp/cups/spool
> +ServerBin /usr/lib/cups
> +ServerRoot /etc/cups
> +StateDir /var/run/cups
> +
> +Printcap /etc/printcap
> +PrintcapFormat bsd
> +
> +# SSL/TLS keychain for the scheduler...
> +#ServerKeychain ssl
> diff --git a/projectroot/etc/cups/mailto.conf 
> b/projectroot/etc/cups/mailto.conf
> new file mode 100644
> index 0..4502adaee
> --- /dev/null
> +++ b/projectroot/etc/cups/mailto.conf
> @@ -0,0 +1 @@
> +# mailto.conf - configuration file for cups email notifier
> diff --git a/projectroot/etc/cups/ppd/.createdirectory 
> b/projectroot/etc/cups/ppd/.createdirectory
> new file mode 100644
> index 0..e69de29bb
> diff --git a/projectroot/etc/cups/printers.conf 
> b/projectroot/etc/cups/printers.conf
> new file mode 100644
> index 0..bf9879904
> --- /dev/null
> +++ b/projectroot/etc/cups/printers.conf
> @@ -0,0 +1 @@
> +# printers.conf - printer configuration file for cups
> diff --git a/projectroot/etc/cups/ssl/.createdirectory 
> b/projectroot/etc/cups/ssl/.createdirectory
> new file mode 100644
> index 0..e69de29bb
> diff --git a/projectroot/etc/printcap b/projectroot/etc/printcap
> new file mode 100644
> index 0..e74f358e1
> --- /dev/null
> +++ b/projectroot/etc/printcap
> @@ -0,0 +1,3 @@
> +# This file was automatically generated by cupsd(8) from the
> +# /etc/cups/printers.conf file.  All changes to this file
> +# will be lost.
> diff --git a/projectroot/usr/lib/systemd/system/cups.service 
> b/projectroot/usr/lib/systemd/system/cups.service
> new file mode 100644
> index 0..ff94f69d2
> --- /dev/null
> +++ b/projectroot/usr/lib/systemd/system/cups.service
> @@ -0,0 +1,15 @@
> +[Unit]
> +

Re: [ptxdist] [PATCH 5/7] cups: new package: Common Unix Printing System

2017-08-28 Thread Juergen Borleis
Hi Roland,

On Thursday 24 August 2017 00:39:09 Roland Hieber wrote:
> [...]
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/accept)
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/cupsaccept)
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/cupsaddsmb)
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/cupsctl)
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/cupsd)
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/cupsdisable)
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/cupsenable)
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/cupsfilter)
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/cupsreject)
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/lpadmin)
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/lpc)
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/lpinfo)
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/lpmove)
> + @$(call install_copy, cups, 0, 0, 0755, -, /usr/sbin/reject)

"accept", "cupsdisable", "cupsenable", "cupsreject" and "reject" are all
softlinks to "/usr/sbin/cupsaccept" and no files. PTXdist currently
complains:

ptxdist: error: file '[...]/[...]/packages/cups-2.2.4/usr/sbin/accept' is a link
ptxdist: error: file '[...]/[...]/packages/cups-2.2.4/usr/sbin/cupsdisable' is 
a link
ptxdist: error: file '[...]/[...]/packages/cups-2.2.4/usr/sbin/cupsenable' is a 
link
ptxdist: error: file '[...]/[...]/packages/cups-2.2.4/usr/sbin/cupsreject' is a 
link
ptxdist: error: file '[...]/[...]/packages/cups-2.2.4/usr/sbin/reject' is a link

jb

-- 
Pengutronix e.K.                             | Juergen Borleis             |
Industrial Linux Solutions                   | http://www.pengutronix.de/  |

___
ptxdist mailing list
ptxdist@pengutronix.de

[ptxdist] [PATCH 5/7] cups: new package: Common Unix Printing System

2017-08-23 Thread Roland Hieber
If using systemd, CUPS can be started via socket activation or directly,
in any case it is run as user daemon, group lp. The default spool and
cache locations were moved to /tmp/cups so we don't need to set up a
tmpfs for /var/spool/cups and /var/cache/cups.

sysvinit script is installed from upstream, but untested.

Some config files are only created by cupsd on the first start and not
at install time, so we supply reasonable defaults in projectroot/ in
order to use $(call install_alternative...) on them.

Signed-off-by: Roland Hieber 
---
 projectroot/etc/cups/classes.conf   |   1 +
 projectroot/etc/cups/client.conf|   2 +
 projectroot/etc/cups/cups-files.conf|  22 +++
 projectroot/etc/cups/mailto.conf|   1 +
 projectroot/etc/cups/ppd/.createdirectory   |   0
 projectroot/etc/cups/printers.conf  |   1 +
 projectroot/etc/cups/ssl/.createdirectory   |   0
 projectroot/etc/printcap|   3 +
 projectroot/usr/lib/systemd/system/cups.service |  15 ++
 projectroot/usr/lib/systemd/system/cups.socket  |  14 ++
 projectroot/usr/lib/tmpfiles.d/cups.conf|   6 +
 rules/cups.in   | 142 +++
 rules/cups.make | 227 
 13 files changed, 434 insertions(+)
 create mode 100644 projectroot/etc/cups/classes.conf
 create mode 100644 projectroot/etc/cups/client.conf
 create mode 100644 projectroot/etc/cups/cups-files.conf
 create mode 100644 projectroot/etc/cups/mailto.conf
 create mode 100644 projectroot/etc/cups/ppd/.createdirectory
 create mode 100644 projectroot/etc/cups/printers.conf
 create mode 100644 projectroot/etc/cups/ssl/.createdirectory
 create mode 100644 projectroot/etc/printcap
 create mode 100644 projectroot/usr/lib/systemd/system/cups.service
 create mode 100644 projectroot/usr/lib/systemd/system/cups.socket
 create mode 100644 projectroot/usr/lib/tmpfiles.d/cups.conf
 create mode 100644 rules/cups.in
 create mode 100644 rules/cups.make

diff --git a/projectroot/etc/cups/classes.conf 
b/projectroot/etc/cups/classes.conf
new file mode 100644
index 0..dea737751
--- /dev/null
+++ b/projectroot/etc/cups/classes.conf
@@ -0,0 +1 @@
+# classes.conf - class configuration file for cups
diff --git a/projectroot/etc/cups/client.conf b/projectroot/etc/cups/client.conf
new file mode 100644
index 0..f8f0b6832
--- /dev/null
+++ b/projectroot/etc/cups/client.conf
@@ -0,0 +1,2 @@
+# CUPS client configuration
+ServerName localhost
diff --git a/projectroot/etc/cups/cups-files.conf 
b/projectroot/etc/cups/cups-files.conf
new file mode 100644
index 0..2cc2d5a5b
--- /dev/null
+++ b/projectroot/etc/cups/cups-files.conf
@@ -0,0 +1,22 @@
+# File/directory/user/group configuration file for the CUPS scheduler.
+User daemon
+Group lp
+SystemGroup root
+
+AccessLog /var/log/cups/access_log
+ErrorLog /var/log/cups/error_log
+PageLog /var/log/cups/page_log
+
+CacheDir /tmp/cups/cache
+DataDir /usr/share/cups
+DocumentRoot /usr/share/doc/cups
+RequestRoot /tmp/cups/spool
+ServerBin /usr/lib/cups
+ServerRoot /etc/cups
+StateDir /var/run/cups
+
+Printcap /etc/printcap
+PrintcapFormat bsd
+
+# SSL/TLS keychain for the scheduler...
+#ServerKeychain ssl
diff --git a/projectroot/etc/cups/mailto.conf b/projectroot/etc/cups/mailto.conf
new file mode 100644
index 0..4502adaee
--- /dev/null
+++ b/projectroot/etc/cups/mailto.conf
@@ -0,0 +1 @@
+# mailto.conf - configuration file for cups email notifier
diff --git a/projectroot/etc/cups/ppd/.createdirectory 
b/projectroot/etc/cups/ppd/.createdirectory
new file mode 100644
index 0..e69de29bb
diff --git a/projectroot/etc/cups/printers.conf 
b/projectroot/etc/cups/printers.conf
new file mode 100644
index 0..bf9879904
--- /dev/null
+++ b/projectroot/etc/cups/printers.conf
@@ -0,0 +1 @@
+# printers.conf - printer configuration file for cups
diff --git a/projectroot/etc/cups/ssl/.createdirectory 
b/projectroot/etc/cups/ssl/.createdirectory
new file mode 100644
index 0..e69de29bb
diff --git a/projectroot/etc/printcap b/projectroot/etc/printcap
new file mode 100644
index 0..e74f358e1
--- /dev/null
+++ b/projectroot/etc/printcap
@@ -0,0 +1,3 @@
+# This file was automatically generated by cupsd(8) from the
+# /etc/cups/printers.conf file.  All changes to this file
+# will be lost.
diff --git a/projectroot/usr/lib/systemd/system/cups.service 
b/projectroot/usr/lib/systemd/system/cups.service
new file mode 100644
index 0..ff94f69d2
--- /dev/null
+++ b/projectroot/usr/lib/systemd/system/cups.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=CUPS Scheduler service
+Documentation=man:cupsd(8)
+Requires=systemd-tmpfiles-setup.service
+Requires=cups.socket
+
+[Service]
+User=daemon
+Group=lp
+ExecStart=/usr/sbin/cupsd -l -c /etc/cups/cupsd.conf -s 
/etc/cups/cups-files.conf
+Type=simple
+
+[Install]
+Also=cups.socket
+WantedBy=printer.target
diff --git