diff options
author | decke <decke@FreeBSD.org> | 2014-03-10 17:20:06 +0800 |
---|---|---|
committer | decke <decke@FreeBSD.org> | 2014-03-10 17:20:06 +0800 |
commit | 600cd6c4a5f6ec16126212271bb2fd0d1e32f872 (patch) | |
tree | 98e03991d81b6da7719aaaf4e4dc92541a634d57 /print | |
parent | f4319944ce216da780d5f4cb8f4bea03d79193dd (diff) | |
download | freebsd-ports-gnome-600cd6c4a5f6ec16126212271bb2fd0d1e32f872.tar.gz freebsd-ports-gnome-600cd6c4a5f6ec16126212271bb2fd0d1e32f872.tar.zst freebsd-ports-gnome-600cd6c4a5f6ec16126212271bb2fd0d1e32f872.zip |
- Add rc startscript with support to run cloudprint as unprivileged user
- Bump PORTREVISION
Diffstat (limited to 'print')
-rw-r--r-- | print/cloudprint/Makefile | 12 | ||||
-rw-r--r-- | print/cloudprint/files/cloudprint.in | 46 |
2 files changed, 57 insertions, 1 deletions
diff --git a/print/cloudprint/Makefile b/print/cloudprint/Makefile index 09100156eaa4..84cdb5ae844a 100644 --- a/print/cloudprint/Makefile +++ b/print/cloudprint/Makefile @@ -3,6 +3,7 @@ PORTNAME= cloudprint PORTVERSION= 0.11.20140215 +PORTREVISION= 1 CATEGORIES= print MAINTAINER= decke@FreeBSD.org @@ -10,7 +11,8 @@ COMMENT= Google Cloud Print proxy for local CUPS printers LICENSE= GPLv3 -RUN_DEPENDS= ${PYTHON_SITELIBDIR}/cups.so:${PORTSDIR}/print/py-cups +RUN_DEPENDS= ${PYTHON_SITELIBDIR}/cups.so:${PORTSDIR}/print/py-cups \ + ${PYTHON_PKGNAMEPREFIX}daemon>0:${PORTSDIR}/devel/py-daemon USE_GITHUB= yes GH_ACCOUNT= armooo @@ -19,5 +21,13 @@ GH_COMMIT= 07e4711 USE_PYTHON= 2 USE_PYDISTUTILS= yes +USE_RC_SUBR= ${PORTNAME} + +USERS= cups +GROUPS= cups + +SUB_LIST+= PYTHON_CMD="${PYTHON_CMD}" \ + CPUSER="${USERS}" \ + CPGROUP="${GROUPS}" .include <bsd.port.mk> diff --git a/print/cloudprint/files/cloudprint.in b/print/cloudprint/files/cloudprint.in new file mode 100644 index 000000000000..0caa7193cef2 --- /dev/null +++ b/print/cloudprint/files/cloudprint.in @@ -0,0 +1,46 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: cloudprint +# REQUIRE: LOGIN cupsd +# KEYWORD: shutdown +# +# Add the following line to /etc/rc.conf[.local] to enable cloudprint +# +# cloudprint_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable cloudprint. +# cloudprint_user (str): User account to run with. +# cloudprint_group (str): Group to run with. +# cloudprint_flags (str): Custom flags for cloudprint. + +. /etc/rc.subr + +: ${cloudprint_enable="NO"} +: ${cloudprint_user="%%CPUSER%%"} +: ${cloudprint_group="%%CPGROUP%%"} + +name=cloudprint +rcvar=cloudprint_enable +piddir="/var/run/${name}" +pidfile="${piddir}/${name}.pid" +confdir="%%PREFIX%%/etc/cloudprint" +command="%%PREFIX%%/bin/cloudprint" +command_args="-d -p ${pidfile} -a ${confdir}/cloudprintauth" +command_interpreter="%%PYTHON_CMD%%" +sig_stop="QUIT" +start_precmd="${name}_prestart" + +cloudprint_prestart() +{ + if [ ! -d "${piddir}" ]; then + /usr/bin/install -d -o ${cloudprint_user} -g ${cloudprint_group} -m 0755 ${piddir} + fi + if [ ! -d "${confdir}" ]; then + /usr/bin/install -d -o ${cloudprint_user} -g ${cloudprint_group} -m 0755 ${confdir} + fi +} + +load_rc_config $name + +run_rc_command "$1" |