diff options
author | skreuzer <skreuzer@FreeBSD.org> | 2016-08-12 00:06:51 +0800 |
---|---|---|
committer | skreuzer <skreuzer@FreeBSD.org> | 2016-08-12 00:06:51 +0800 |
commit | 56b4f58723be1e16ba95616bc6e2df539c2a44a7 (patch) | |
tree | a5a8b1f62e6956aa4a1bab0c8deb26ff0ec8f764 /deskutils/taskd | |
parent | 220eb1799371518287c02dc053b1c871b90e1116 (diff) | |
download | freebsd-ports-gnome-56b4f58723be1e16ba95616bc6e2df539c2a44a7.tar.gz freebsd-ports-gnome-56b4f58723be1e16ba95616bc6e2df539c2a44a7.tar.zst freebsd-ports-gnome-56b4f58723be1e16ba95616bc6e2df539c2a44a7.zip |
Add a rc script and have taskd run as an unprivileged user
PR: 204757
Submitted by: Ike Eichorn <ike@michaeleichorn.com>
Diffstat (limited to 'deskutils/taskd')
-rw-r--r-- | deskutils/taskd/Makefile | 32 | ||||
-rw-r--r-- | deskutils/taskd/files/taskd.in | 35 | ||||
-rw-r--r-- | deskutils/taskd/pkg-message | 22 | ||||
-rw-r--r-- | deskutils/taskd/pkg-plist | 14 |
4 files changed, 86 insertions, 17 deletions
diff --git a/deskutils/taskd/Makefile b/deskutils/taskd/Makefile index 318b7c0e5179..29576f281e12 100644 --- a/deskutils/taskd/Makefile +++ b/deskutils/taskd/Makefile @@ -3,7 +3,7 @@ PORTNAME= taskd PORTVERSION= 1.1.0 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= deskutils MASTER_SITES= http://taskwarrior.org/download/ @@ -16,6 +16,19 @@ LIB_DEPENDS= libgnutls.so:security/gnutls RUN_DEPENDS= bash:shells/bash USES= cmake:outsource compiler:c++11-lib shebangfix +USE_RC_SUBR= taskd + +USERS= taskd +GROUPS= taskd + +TASKD_DBDIR?= /var/db/${PORTNAME} + +PLIST_SUB+= TASKD_DBDIR="${TASKD_DBDIR}" \ + TASKD_USER="${USERS}" \ + TASKD_GROUP="${GROUPS}" + +SUB_LIST+= TASKD_DBDIR="${TASKD_DBDIR}" + SHEBANG_FILES= demo/client/case* \ demo/client/malformed* \ demo/client/run \ @@ -33,25 +46,10 @@ SHEBANG_FILES= demo/client/case* \ CFLAGS+= -g -O0 -PLIST_FILES= bin/taskd \ - bin/taskdctl \ - man/man1/taskd.1.gz \ - man/man1/taskdctl.1.gz \ - man/man5/taskdrc.5.gz \ - share/taskd/README \ - share/taskd/generate \ - share/taskd/generate.ca \ - share/taskd/generate.client \ - share/taskd/generate.crl \ - share/taskd/generate.server \ - share/taskd/vars - PORTDOCS= * post-install: (cd ${WRKSRC}/pki && ${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR}) -.for s in generate generate.ca generate.client generate.crl generate.server - ${CHMOD} 755 ${STAGEDIR}${DATADIR}/${s} -.endfor + ${MKDIR} ${STAGEDIR}${TASKD_DBDIR} .include <bsd.port.mk> diff --git a/deskutils/taskd/files/taskd.in b/deskutils/taskd/files/taskd.in new file mode 100644 index 000000000000..11c2403d50a1 --- /dev/null +++ b/deskutils/taskd/files/taskd.in @@ -0,0 +1,35 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: taskd +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add these lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# taskd_enable (bool): Set to NO by default. +# Set it to YES to enable taskd. +# taskd_data (path): Set to %%TASKD_DBDIR%% by default. +# Taskd data directory (TASKDDATA) +# taskd_user (str): Set to taskd by default. +# User to run taskd as. + +. /etc/rc.subr + +name=taskd +rcvar=taskd_enable + +load_rc_config $name + +: ${taskd_enable="NO"} +: ${taskd_data="%%TASKD_DBDIR%%"} +: ${taskd_user="taskd"} + +command=%%PREFIX%%/bin/${name} +pidfile=$(${command} config --data $taskd_data | awk '/pid.file/ {print $2}') + +command_args="server --data $taskd_data --daemon" + +run_rc_command "$1" diff --git a/deskutils/taskd/pkg-message b/deskutils/taskd/pkg-message new file mode 100644 index 000000000000..b011b012a60c --- /dev/null +++ b/deskutils/taskd/pkg-message @@ -0,0 +1,22 @@ +======================================================================= +taskd requires user directed configuration prior to use. + +See taskwarrior.org/docs/taskserver/configure.html for configuration +information. The generate script has been installed to +/usr/local/share/taskd. + +After completing configuration to start taskd at system startup add +taskd_enable="YES" to rc.conf. If you configured taskd with a TASKDDATA +other than /var/db/taskd you will also need to set taskd_data in rc.conf +to that path. + +The rc script will start taskd as the unprivileged user taskd, this +requires that your TASKDDATA directory and /var/log/taskd.log be owned +by taskd:taskd. If you prefer to use another user specify this in +rc.conf using taskd_user. + +To add users see: taskwarrior.org/docs/taskserver/user.html + +To configure taskwarrior to use your taskd server see: +taskwarrior.org/docs/taskserver/taskwarrior.html +======================================================================= diff --git a/deskutils/taskd/pkg-plist b/deskutils/taskd/pkg-plist new file mode 100644 index 000000000000..4f311dfd27dc --- /dev/null +++ b/deskutils/taskd/pkg-plist @@ -0,0 +1,14 @@ +bin/taskd +bin/taskdctl +man/man1/taskd.1.gz +man/man1/taskdctl.1.gz +man/man5/taskdrc.5.gz +share/taskd/README +@mode 0755 +%%DATADIR%%/generate +%%DATADIR%%/generate.ca +%%DATADIR%%/generate.client +%%DATADIR%%/generate.crl +%%DATADIR%%/generate.server +%%DATADIR%%/vars +@dir(%%TASKD_USER%%,%%TASKD_GROUP%%,) %%TASKD_DBDIR%% |