diff options
author | Robert Allen <slacker@engineer.com> | 2014-09-05 22:51:11 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2014-09-06 00:02:53 +0700 |
commit | ed16becd86f3dec0cc8690d69906b1ded52c1250 (patch) | |
tree | 5fc71e796a38e172510446843cce55b32f2b8d9f /office/taskd | |
parent | 169f8a4fae53334e2b8222a3bb7ab1fc176e4557 (diff) |
office/taskd: Added (task server daemon).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'office/taskd')
-rw-r--r-- | office/taskd/README | 25 | ||||
-rw-r--r-- | office/taskd/README_SLACKWARE | 192 | ||||
-rw-r--r-- | office/taskd/doinst.sh | 28 | ||||
-rw-r--r-- | office/taskd/profile/taskddata | 13 | ||||
-rw-r--r-- | office/taskd/profile/taskddata.csh | 4 | ||||
-rw-r--r-- | office/taskd/profile/taskddata.sh | 4 | ||||
-rw-r--r-- | office/taskd/rc.taskd.diff | 55 | ||||
-rw-r--r-- | office/taskd/slack-desc | 19 | ||||
-rw-r--r-- | office/taskd/taskd.SlackBuild | 128 | ||||
-rw-r--r-- | office/taskd/taskd.info | 10 |
10 files changed, 478 insertions, 0 deletions
diff --git a/office/taskd/README b/office/taskd/README new file mode 100644 index 0000000000000..b65268f0750c3 --- /dev/null +++ b/office/taskd/README @@ -0,0 +1,25 @@ +Taskwarrior is an open-source cross platform command-line +task management tool. It allows you to capture, annotate, +manipulate and present your tasks, then sync them among +devices. + +The taskd server is the component which supports +synchronization among task clients. + +The task client application is also available on SBo. + +Each may be built and run standalone so that there are +no hard buildtime or runtine dependencies between them. + +It is recommended to create a non-priv'd user to run the +server, and it requires CA certs to operate, which may +be generated with included scripts. + +Installation of this package provides a complete taskd +install from upstream source. You may proceed to configure +and operate it from the distribution documentation if you +like. + +The additional README_SLACKWARE file provides notes for +getting things configured and working quickly on a Slackware +platform with a few extra pieces provided. diff --git a/office/taskd/README_SLACKWARE b/office/taskd/README_SLACKWARE new file mode 100644 index 0000000000000..e912b7c1fe8d9 --- /dev/null +++ b/office/taskd/README_SLACKWARE @@ -0,0 +1,192 @@ +*** Running a taskd server under Slackware *** + +Table of contents: + + * Taskd configuration for Slackware + * Creating a taskd user and data directory + * Initializing the server + * Certificates and clients + * Starting the server + * Cautions and quirks... + +See man taskd, /usr/doc/taskd-VERSION/doc/operation.txt +and man task-sync (from task) for full details of +what follows. In particular, read the operation.txt +document for a more complete overview. + +Taskd configuration for Slackware +================================= + +The taskd server is written to be cross-platform among +Unix-like OSs and leaves many setup and configuration +choices to the user. The provided man pages and text +guides are complete and helpful, but this SlackBuild +script adds a few details to make initial setup easier +on a Slackware system. + +The added pieces are: + + * Creation of a taskd user and group + * Creation of data directory - /var/lib/taskd + * A global path config file - /etc/taskddata + * Profile scripts - /etc/profile.d/taskddata.{sh,csh} + * A Slackware start script - /etc/rc.d/rc.taskd + +If you build and install the package with this script, you +you will end with a complete taskd install just as provided +by the upstream sources. Simply ignore or remove the above +listed files and skip the following config steps, and you +may then configure and run the server according to your own +choices based on man taskd and the distribution docs. + +If you continue, the following steps will get your taskd +server running quickly and safely based on the above +listed choices. + +Create a taskd user and data directory +====================================== + +The server should be run as a non-priviledged user, and +the data paths should be owned by that user and not +accessible by others. You may use any UID/GID you choose, +those guaranteed not to conflict on a Slackware/SBo system +may be found here: http://www.slackbuilds.org/uid_gid.txt + +To create the user account and data directory, execute the +following shell commands as root: + +groupadd -g 290 taskd +useradd -g taskd -u 290 -d /var/lib/taskd taskd +mkdir -p /var/lib/taskd +chown taskd:taskd /var/lib/taskd +chmod 700 /var/lib/taskd + +Initializing the server +======================= + +You need to initialize the server as the taskd user, +AND the $TASKDDATA env variable must be set for that user, +so let's verify that first: + + su - taskd + echo $TASKDDATA + +If the value of $TASKDDATA is not the same as the data path +set above, check the following: + + /etc/taskddata - Must export the variable when sourced + + /etc/profile.d/taskddata.{sh,csh} - are executable + OR + /etc/profile - includes a line ". /etc/taskddata" + +After you verify taskd user correctly sees $TASKDDATA... + + taskd init --data $TASKDDATA + taskd config server localhost:53589 + +Change logs and PIDs from /tmp to data path + + taskd config log $TASKDDATA/taskd.log + taskd config pid.file $TASKDDATA/taskd.pid + taskd config ip.log 1 + +We will allow all connections for now... + + taskd config client.allow all + taskd config client.deny none + +Certificates and clients +======================== + +The server needs a certificate, key and crl to operate. +See operation.txt and man taskd to set up your own certs, +the following uses locally created self-signed certs. + +You will need to be root for this... + + cd /usr/share/taskd-VERSION/pki + ./generate + +Once the various files are created, install them in $TASKDDATA: + + cp client.cert.pem $TASKDDATA + cp server.cert.pem $TASKDDATA + cp server.key.pem $TASKDDATA + cp server.crl.pem $TASKDDATA + +Configure the server to use them: + + taskd config client.cert $TASKDDATA/client.cert.pem + taskd config server.cert $TASKDDATA/server.cert.pem + taskd config server.key $TASKDDATA/server.key.pem + taskd config server.crl $TASKDDATA/server.crl.pem + +We are using self-signed certs at this point, so... + + cp ca.cert.pem $TASKDDATA + taskd config ca.cert $TASKDDATA/ca.cert.pem + +Now you must change ownership of these to taskd in the data +directory: + + chown taskd:taskd /var/lib/taskd/* + +The resultant client.cert.pem and client.key.pem files +are needed by the clients (see man task-sync from task). + +This will get taskd working and is probably sufficient for local +use. You will want to use proper certificates and keys created +per-user for production use. See the accompanying docs for details. + +See man taskd for creating and managing organizations, groups and +users on the server. + +Starting the server +=================== + +To start/stop the taskd server: + +chmod +x /etc/rc.d/rc.taskd + +/etc/rc.d/rc.taskd start +/etc/rc.d/rc.taskd stop + +See comments in /etc/rc.d/rc.taskd to auto-start at boot. + +Cautions and quirks... +====================== + +Taskd is a new application and is not as mature as the task +client application. Although it has proven to be very stable in +operation, it has a few loose ends still when it comes to +admin of the server. Hopefully these will be cleaned up with +future releases! + +A recurring theme in my own use has been that when creating +new organizations and users, I forget to su - taskd first and +perform the operation as root - and it succeeds! But taskd +creates the associated subdirectories and files with root +ownership and the server cannot use them! + +Another is when changing server certs, I generate and copy +them in as root - the server will not start afterward. + +The fix is easy in both cases... + +chown -R taskd:taskd /var/lib/taskd + +Just remember to perform all server admin as taskd, and when +something breaks - check ownerships first! + +Another quirk is the start script - rc.taskd. I generated this +based on the distribution taskdctl script, so I'll share the +blame! It is not very robust when it encounters errors at startup +and will report "server started" under some conditions where the +server actually failed to start... use man taskd and test from +an su - taskd shell when getting the configs right. + +Hopefully the server will catch the client soon in terms of +polish! + +Enjoy! diff --git a/office/taskd/doinst.sh b/office/taskd/doinst.sh new file mode 100644 index 0000000000000..c4ba0e205abc2 --- /dev/null +++ b/office/taskd/doinst.sh @@ -0,0 +1,28 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.taskd.new +preserve_perms etc/profile.d/taskddata.sh.new +preserve_perms etc/profile.d/taskddata.csh.new +preserve_perms etc/taskddata.new diff --git a/office/taskd/profile/taskddata b/office/taskd/profile/taskddata new file mode 100644 index 0000000000000..870f819f67e36 --- /dev/null +++ b/office/taskd/profile/taskddata @@ -0,0 +1,13 @@ +#!/bin/sh +#Global taskd data path config +#Must be sourced into taskd and admin user environments +# +#You may add the following line to /etc/profile +# . /etc/taskd_config +# OR +#chmod +x /etc/profile.d/taskddata.* + +TASKDDATA=/var/lib/taskd +export TASKDDATA + + diff --git a/office/taskd/profile/taskddata.csh b/office/taskd/profile/taskddata.csh new file mode 100644 index 0000000000000..c1a2e4004979c --- /dev/null +++ b/office/taskd/profile/taskddata.csh @@ -0,0 +1,4 @@ +#!/bin/csh +#Set data path for taskd server from global config + +source /etc/taskddata diff --git a/office/taskd/profile/taskddata.sh b/office/taskd/profile/taskddata.sh new file mode 100644 index 0000000000000..f9b61cca0f4d0 --- /dev/null +++ b/office/taskd/profile/taskddata.sh @@ -0,0 +1,4 @@ +#!/bin/sh +#Set data path for taskd server from global config + +. /etc/taskddata diff --git a/office/taskd/rc.taskd.diff b/office/taskd/rc.taskd.diff new file mode 100644 index 0000000000000..9cd4d59e41e11 --- /dev/null +++ b/office/taskd/rc.taskd.diff @@ -0,0 +1,55 @@ +--- src/taskdctl 2014-09-04 15:15:11.000000000 -0600 ++++ rc.taskd 2014-09-05 00:58:33.000000000 -0600 +@@ -26,13 +26,49 @@ + ## + ################################################################################ + ++################################################################################ ++# SLACKWARE STARTUP: ++# ++# Before this script may be run the following conditions must be met: ++# ++# A taskd user must exist ++# The data path must exist and be owned by the taskd user ++# The data path must be set in $TASKDDATA or in /etc/taskddata ++# The server must have been previously initialized by ++# taskd init --data $TASKDDATA ++# ++# Additional configuration parameters must be valid and CA installed ++# ++# See /usr/doc/taskd-VERSION/README_SLACKWARE and man taskd for details. ++# ++# To auto start taskd at boot add these lines to /etc/rc.d/rc.local ++# if [ -x /etc/rc.d/rc.taskd ]; then ++# /etc/rc.d/rc.taskd start ++# fi ++# ++# To stop taskd at shutdown add these lines to /etc/rc.d/rc.local_shutdown ++# if [ -x /etc/rc.d/rc.taskd ]; then ++# /etc/rc.d/rc.taskd stop ++# fi ++################################################################################ ++ ++#Initialize from global config for convenience - SlackBuild patch ++if [ -z $TASKDDATA ] && [ -f /etc/taskddata ] ; then ++ . /etc/taskddata ++fi ++ + if [ -z $TASKDDATA ] ; then +- echo 'The TASKDDATA variable must be set.' +- exit ++ echo 'The TASKDDATA variable must be set.' ++ exit + fi + + PIDFILE=$(taskd config --data $TASKDDATA | grep pid.file | awk '{print $2}') +-DAEMON="taskd server --data $TASKDDATA --daemon" ++DAEMON="taskd_ctl $TASKDDATA" ++ ++taskd_ctl(){ ++ EX="taskd server --data $1 --daemon" ++ su - taskd -c "$EX" ++} + + ERROR=0 + ARGV="$@" diff --git a/office/taskd/slack-desc b/office/taskd/slack-desc new file mode 100644 index 0000000000000..03eed32dedcbd --- /dev/null +++ b/office/taskd/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +taskd: taskd (task server daemon) +taskd: +taskd: Taskwarrior is an open-source command-line task management tool. +taskd: It allows you to capture, annotate, manipulate and present tasks. +taskd: +taskd: taskd is an extension supporting client synchronization. +taskd: +taskd: +taskd: +taskd: Project home page - http://taskwarrior.org/ +taskd: diff --git a/office/taskd/taskd.SlackBuild b/office/taskd/taskd.SlackBuild new file mode 100644 index 0000000000000..f137a521399b8 --- /dev/null +++ b/office/taskd/taskd.SlackBuild @@ -0,0 +1,128 @@ +#!/bin/sh + +# Slackware build script for taskd + +# Copyright 2014 Robert Allen +# All rights reserved, including Creator Endowed Unalienable Rights +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=taskd +VERSION=${VERSION:-1.0.0} +BUILD=${BUILD:-3} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION + +#Patch to use global path config and add startup comments for rc.taskd +patch -p0 <$CWD/rc.taskd.diff + +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + + +mkdir -p build + cmake \ + -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DTASKD_BINDIR=bin \ + -DTASKD_EXTDIR=libexec/taskd \ + -DTASKD_DOCDIR=doc/$PRGNAM-$VERSION \ + -DTASKD_MAN1DIR=man/man1 \ + -DTASKD_MAN5DIR=man/man5 \ + -DLIB_SUFFIX=${LIBDIRSUFFIX} + + make + make install DESTDIR=$PKG + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/etc/rc.d +mv $PKG/usr/bin/taskdctl $PKG/etc/rc.d/rc.taskd.new +chmod 644 $PKG/etc/rc.d/rc.taskd.new + +mkdir -p $PKG/etc/profile.d +cat $CWD/profile/taskddata > $PKG/etc/taskddata.new +cat $CWD/profile/taskddata.sh > $PKG/etc/profile.d/taskddata.sh.new +cat $CWD/profile/taskddata.csh > $PKG/etc/profile.d/taskddata.csh.new +chmod 755 $PKG/etc/profile.d/*new +chmod 644 $PKG/etc/taskddata.new + +# Compress man pages +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +#Additional documents... +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/doc +cp -a doc/[a-z]*.txt $PKG/usr/doc/$PRGNAM-$VERSION/doc/. +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README +cat $CWD/README_SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README_SLACKWARE + +#CA keys are required, pki provides tools for the task, and extra scripts +mkdir -p $PKG/usr/share/$PRGNAM-$VERSION +cp -ra pki $PKG/usr/share/$PRGNAM-$VERSION/. +cp -ra scripts $PKG/usr/share/$PRGNAM-$VERSION/. +cp -ra mon $PKG/usr/share/$PRGNAM-$VERSION/. + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/office/taskd/taskd.info b/office/taskd/taskd.info new file mode 100644 index 0000000000000..6e6c35386d98b --- /dev/null +++ b/office/taskd/taskd.info @@ -0,0 +1,10 @@ +PRGNAM="taskd" +VERSION="1.0.0" +HOMEPAGE="http://taskwarrior.org" +DOWNLOAD="http://taskwarrior.org/download/taskd-1.0.0.tar.gz" +DOWNLOAD_x86_64="" +MD5SUM="1cead23539e36d5623cb3ca1225072c0" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Robert Allen" +EMAIL="slacker@engineer.com" |