Package: tircd
Version: 0.10-2
Severity: wishlist
Tags: patch

Having to run and daemonise tircd manually isn't really the Debian way; an
initscript would be much nicer.

Patch attached.

It is disabled by default in /etc/default/tircd (which I don't like at all)
but existing users upgrading will not be caught out this way. Your call to
remove this.


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      [email protected]
       `-
diff -urNd tircd-0.10.orig/debian/control tircd-0.10/debian/control
--- tircd-0.10.orig/debian/control      2010-06-24 07:17:54.000000000 +0100
+++ tircd-0.10/debian/control   2010-06-24 07:19:26.000000000 +0100
@@ -8,7 +8,7 @@
 
 Package: tircd
 Architecture: all
-Depends: libnet-twitter-lite-perl, libpoe-filter-ircd-perl, ${misc:Depends}
+Depends: adduser, libnet-twitter-lite-perl, libpoe-filter-ircd-perl, 
${misc:Depends}
 Description: ircd proxy to the twitter API
  tircd presents Twitter as an IRC channel. You can connect to tircd
  with any IRC client, and Twitter as if you were on IRC.
diff -urNd tircd-0.10.orig/debian/tircd.default tircd-0.10/debian/tircd.default
--- tircd-0.10.orig/debian/tircd.default        1970-01-01 01:00:00.000000000 
+0100
+++ tircd-0.10/debian/tircd.default     2010-06-24 07:18:37.000000000 +0100
@@ -0,0 +1 @@
+ENABLED=0
diff -urNd tircd-0.10.orig/debian/tircd.init tircd-0.10/debian/tircd.init
--- tircd-0.10.orig/debian/tircd.init   1970-01-01 01:00:00.000000000 +0100
+++ tircd-0.10/debian/tircd.init        2010-06-24 07:18:39.000000000 +0100
@@ -0,0 +1,68 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:      tircd
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Twitter IRC deamon
+### END INIT INFO
+
+ACTION="${1}"
+
+NAME="tircd"
+DESC="Twitter IRC proxy"
+PIDFILE="/var/run/tircd.pid"
+LOGFILE="/var/log/tircd/tircd.log"
+BINARY="/usr/bin/tircd"
+
+test -x ${BINARY} || exit 0
+
+. /lib/lsb/init-functions
+
+ENABLED=0
+
+if [ -f /etc/default/tircd ]; then
+       . /etc/default/tircd
+fi
+
+case "${ACTION}" in
+       start|start-now)
+               if [ "${ENABLED}" != "1" ]; then
+                       exit 0
+               fi
+
+               log_daemon_msg "Starting ${DESC}" ${NAME}
+               if start-stop-daemon --start -q --oknodo --pidfile ${PIDFILE} \
+                       --make-pidfile --chuid tircd --user tircd --name tircd \
+                       --background --startas ${BINARY}
+               then
+                       log_end_msg 0
+               else
+                       log_end_msg 1
+               fi
+               ;;
+       stop|stop-now)
+               log_daemon_msg "Stopping ${DESC}" ${NAME}
+               if start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
+                       --retry 10 2>&1 >>${LOGFILE}
+               then
+                       rm -f ${PIDFILE}
+                       log_end_msg 0
+               else
+                       log_end_msg 1
+               fi
+               ;;
+       restart|force-reload)
+               ${0} stop
+               sleep 1
+               ${0} start
+               ;;
+       *)
+               echo "Usage: /etc/init.d/${NAME} 
{start|stop|restart|force-reload}"
+               exit 1
+               ;;
+esac
+
+exit 0
+
diff -urNd tircd-0.10.orig/debian/tircd.postinst 
tircd-0.10/debian/tircd.postinst
--- tircd-0.10.orig/debian/tircd.postinst       1970-01-01 01:00:00.000000000 
+0100
+++ tircd-0.10/debian/tircd.postinst    2010-06-24 07:18:57.000000000 +0100
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "configure" ]; then
+       adduser --system --quiet --group --no-create-home tircd || true
+       mkdir -p /var/log/tircd
+       chown -R tircd:tircd /var/log/tircd
+fi
+
+#DEBHELPER#
diff -urNd tircd-0.10.orig/debian/tircd.postrm tircd-0.10/debian/tircd.postrm
--- tircd-0.10.orig/debian/tircd.postrm 1970-01-01 01:00:00.000000000 +0100
+++ tircd-0.10/debian/tircd.postrm      2010-06-24 07:18:41.000000000 +0100
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+#DEBHELPER#
+
+if [ "$1" = "purge" ]; then
+       deluser --quiet --system tircd >/dev/null || true
+       rm -rf /var/log/tircd
+fi
diff -urNd tircd-0.10.orig/tircd.cfg.example tircd-0.10/tircd.cfg.example
--- tircd-0.10.orig/tircd.cfg.example   2010-06-24 07:17:54.000000000 +0100
+++ tircd-0.10/tircd.cfg.example        2010-06-24 07:18:12.000000000 +0100
@@ -29,8 +29,8 @@
 # This controls how POE logs data
 # Current options for logtype are 'stdout', 'stderr', 'file', or 'none', 
 # If file is chosen logfile must be set to a path for the log file
-logtype stdout
-logfile tircd.log
+logtype file
+logfile /var/log/tircd/tircd.log
 
 # This option turns on lots of extra debugging.  The default setting is 0 or 
off.
 debug 0

Attachment: signature.asc
Description: PGP signature

Reply via email to