From 3211e146e1008c59bd0b6a19646d01bd8781b6fe Mon Sep 17 00:00:00 2001 From: Rene Thuemmler Date: Fri, 6 Sep 2019 20:53:08 +0200 Subject: [PATCH] added message and rc.d service script --- www/py-isso/Makefile | 11 +++++++ www/py-isso/files/isso.in | 61 +++++++++++++++++++++++++++++++++++++++ www/py-isso/pkg-message | 14 +++++++++ 3 files changed, 86 insertions(+) create mode 100755 www/py-isso/files/isso.in create mode 100644 www/py-isso/pkg-message diff --git a/www/py-isso/Makefile b/www/py-isso/Makefile index 35f89bd..650ea83 100644 --- a/www/py-isso/Makefile +++ b/www/py-isso/Makefile @@ -37,4 +37,15 @@ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2@${PY_FLAVOR} \ BUILD_DEPENDS= git:devel/git +USE_RC_SUBR= isso + +PLIST_FILES= "etc/isso.conf.sample" + +post-patch: + @${REINPLACE_CMD} -e 's|/etc/isso.conf|/usr/local/etc/isso.conf|g' ${WRKSRC}/isso/__init__.py + +post-install: + @${MKDIR} ${STAGEDIR}${PREFIX}/etc + ${CP} ${WRKSRC}/share/isso.conf ${STAGEDIR}${PREFIX}/etc/isso.conf.sample + .include diff --git a/www/py-isso/files/isso.in b/www/py-isso/files/isso.in new file mode 100755 index 0000000..3eb28c9 --- /dev/null +++ b/www/py-isso/files/isso.in @@ -0,0 +1,61 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: isso +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# isso_enable="YES" +# + +. /etc/rc.subr + +name=isso +rcvar=isso_enable +desc="isso commenting service" + +load_rc_config ${name} + +: ${isso_enable:=NO} +: ${isso_config=/usr/local/etc/isso.conf} + +logfile=/var/log/isso.log +pidfile=/var/run/isso.pid +command=/usr/local/bin/isso +start_cmd=isso_start +stop_cmd=isso_stop +procname=/usr/sbin/daemon + +is_process_running="[ -f $pidfile ] && procstat $(cat $pidfile) >/dev/null 2>&1" + +isso_start() +{ + if is_process_running; then + echo "isso is already running (pid=$(cat $pidfile))" + return 1 + fi + export USER=www + export HOME=$(echo ~www) + touch $logfile + chmod 640 $logfile + /usr/sbin/daemon -P $pidfile -u www /usr/local/bin/isso -c ${isso_config} run >>$logfile 2>&1 + if is_process_running; then + echo "started isso (pid=$(cat $pidfile))" + else + echo "failed to start isso" + fi +} + +isso_stop() +{ + if is_process_running; then + local pid=$(cat $pidfile) + echo "stopping isso (pid=$pid)" + kill -- -$pid + else + echo "isso isn't running" + fi +} + +run_rc_command "$1" diff --git a/www/py-isso/pkg-message b/www/py-isso/pkg-message new file mode 100644 index 0000000..adf8353 --- /dev/null +++ b/www/py-isso/pkg-message @@ -0,0 +1,14 @@ +[ +{ + message: <