Package: sqlgrey
Version: 1:1.8.0-1
Severity: wishlist
Tags: patch

I'm attaching three patches for the sqlgrey init script which I hope you will 
find useful

1) import LSB init-functions. Main reason next to being a prerequesite to patch 
#2 is to
   support the LSB redirection when run on systemd
2) add status action using status_of_proc from lsb-base
3) cleanup whitespaces and tabs in the initscript

Thanks for considering it

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
>From 395dc6d4a557529fa73098e9163260b144daeb47 Mon Sep 17 00:00:00 2001
From: Bernhard Schmidt <be...@birkenwald.de>
Date: Mon, 19 Nov 2012 22:56:13 +0100
Subject: [PATCH 1/3] Import /lib/lsb/init-functions and depend on lsb-base
 for that

---
 debian/control |    2 +-
 debian/init.d  |    2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/debian/control b/debian/control
index 398f147..c92966f 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,7 @@ Homepage: http://sqlgrey.sourceforge.net/
 
 Package: sqlgrey
 Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, adduser, perl, libnet-server-perl, libdate-calc-perl, libdbd-pg-perl | libdbd-mysql-perl | libdbd-sqlite3-perl
+Depends: ${perl:Depends}, ${misc:Depends}, adduser, perl, libnet-server-perl, libdate-calc-perl, libdbd-pg-perl | libdbd-mysql-perl | libdbd-sqlite3-perl, lsb-base (>= 3.2)
 Recommends: postfix, libdbd-pg-perl
 Description: Postfix Greylisting Policy Server
  A policy server for Postfix implementing greylisting.
diff --git a/debian/init.d b/debian/init.d
index 8f74d89..4bc3276 100644
--- a/debian/init.d
+++ b/debian/init.d
@@ -18,6 +18,8 @@
 
 set -e
 
+. /lib/lsb/init-functions
+
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/sbin/sqlgrey
 SQLGREY_HOME=/var/lib/sqlgrey
-- 
1.7.10.4

>From bb048a6dd0b42d96f252efbdbead6fc927c23c68 Mon Sep 17 00:00:00 2001
From: Bernhard Schmidt <be...@birkenwald.de>
Date: Mon, 19 Nov 2012 22:59:07 +0100
Subject: [PATCH 2/3] add status action

---
 debian/init.d |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/debian/init.d b/debian/init.d
index 4bc3276..007b66a 100644
--- a/debian/init.d
+++ b/debian/init.d
@@ -54,6 +54,9 @@ case "$1" in
         rm -f $PIDFILE
 	echo "."
 	;;
+  status)
+	status_of_proc $DAEMON sqlgrey
+	;;
   reload|force-reload)
 	echo -n "Reloading $DESC configuration..."
 	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE
@@ -70,7 +73,7 @@ case "$1" in
 	echo "."
 	;;
   *)
-	echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+	echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
 	exit 1
 	;;
 esac
-- 
1.7.10.4

>From c011f9dbe64f62def899a992c2f24428e75ed869 Mon Sep 17 00:00:00 2001
From: Bernhard Schmidt <be...@birkenwald.de>
Date: Mon, 19 Nov 2012 23:00:06 +0100
Subject: [PATCH 3/3] clean-up inconsistent use of whitespaces and tabs

---
 debian/init.d |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/debian/init.d b/debian/init.d
index 007b66a..6340e10 100644
--- a/debian/init.d
+++ b/debian/init.d
@@ -44,14 +44,14 @@ case "$1" in
   start)
 	echo -n "Starting $DESC: $NAME"
 	start-stop-daemon --start --quiet --pidfile $PIDFILE \
-                --chdir $SQLGREY_HOME \
+		--chdir $SQLGREY_HOME \
 		--exec $DAEMON -- $SQLGREY_OPTS
 	echo "."
 	;;
   stop)
 	echo -n "Stopping $DESC: $NAME"
 	start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
-        rm -f $PIDFILE
+	rm -f $PIDFILE
 	echo "."
 	;;
   status)
@@ -61,15 +61,15 @@ case "$1" in
 	echo -n "Reloading $DESC configuration..."
 	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE
 	echo "done."
-        ;;
+	;;
   restart)
 	echo -n "Restarting $DESC: $NAME"
 	start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
-        rm -f $PIDFILE
+	rm -f $PIDFILE
 	sleep 1
 	start-stop-daemon --start --quiet --pidfile $PIDFILE \
-                --chdir $SQLGREY_HOME \
-                --exec $DAEMON -- $SQLGREY_OPTS
+		--chdir $SQLGREY_HOME \
+		--exec $DAEMON -- $SQLGREY_OPTS
 	echo "."
 	;;
   *)
-- 
1.7.10.4

Reply via email to