tags 506099 +patch thanks Here's my first-stab patch. It fixes the problem, but I need to test it in a few more configurations (restarts, especially if the default file is modified between stop and starts). Also, some explanatory comments in the default file. The technique is based on the way the rsync package works.
(I'm not sure/convinced about this method for controlling daemon startup but, it's established practise for other packages in lenny at least...) I'll work a bit more on this tomorrow. -- Jon Dowland
diff -ruN iscsitarget-0.4.16+svn162-orig/debian/changelog iscsitarget-0.4.16+svn162/debian/changelog
--- iscsitarget-0.4.16+svn162-orig/debian/changelog 2008-11-26 22:24:06.000000000 +0000
+++ iscsitarget-0.4.16+svn162/debian/changelog 2008-11-26 22:42:09.000000000 +0000
@@ -1,3 +1,13 @@
+iscsitarget (0.4.16+svn162-2.1) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Add /etc/default/iscsitarget to determine whether to
+ start the iscsitarget automatically or not. Default to
+ not (environment might not have the correct module).
+ Closes: #506099.
+
+ -- Jon Dowland <[EMAIL PROTECTED]> Wed, 26 Nov 2008 22:37:20 +0000
+
iscsitarget (0.4.16+svn162-2) unstable; urgency=high
* Fix initscript. (Closes: #484107)
diff -ruN iscsitarget-0.4.16+svn162-orig/debian/iscsitarget.default iscsitarget-0.4.16+svn162/debian/iscsitarget.default
--- iscsitarget-0.4.16+svn162-orig/debian/iscsitarget.default 1970-01-01 01:00:00.000000000 +0100
+++ iscsitarget-0.4.16+svn162/debian/iscsitarget.default 2008-11-26 22:26:54.000000000 +0000
@@ -0,0 +1 @@
+ISCSITARGET_ENABLE=false
diff -ruN iscsitarget-0.4.16+svn162-orig/debian/iscsitarget.init iscsitarget-0.4.16+svn162/debian/iscsitarget.init
--- iscsitarget-0.4.16+svn162-orig/debian/iscsitarget.init 2008-11-26 22:24:06.000000000 +0000
+++ iscsitarget-0.4.16+svn162/debian/iscsitarget.init 2008-11-26 22:36:31.000000000 +0000
@@ -19,6 +19,21 @@
# with knowledge about it.
MEM_SIZE=1048576
+. /lib/lsb/init-functions # log_{warn,failure}_msg
+ISCSITARGET_ENABLE=false
+ISCSITARGET_DEFAULTS_FILE=/etc/default/iscsitarget
+if [ -s "$ISCSITARGET_DEFAULTS_FILE" ]; then
+ . "$ISCSITARGET_DEFAULTS_FILE"
+ case "x$ISCSITARGET_ENABLE" in
+ xtrue|xfalse) ;;
+ *)
+ log_failure_msg "value of ISCSITARGET_ENABLE must be either 'true' or 'false';"
+ log_failure_msg "not starting iscsitarget."
+ exit 1
+ ;;
+ esac
+fi
+
configure_memsize()
{
if [ -e /proc/sys/net/core/wmem_max ]; then
@@ -122,7 +137,11 @@
case "$1" in
start)
- ietd_start
+ if [ "$ISCSITARGET_ENABLE" = "true" ]; then
+ ietd_start
+ else
+ log_warning_msg "iscsitarget not enabled in \"$ISCSITARGET_DEFAULTS_FILE\", not starting..."
+ fi
;;
stop)
ietd_stop
@@ -130,7 +149,11 @@
restart|force-reload)
ietd_stop
sleep 1
- ietd_start
+ if [ "$ISCSITARGET_ENABLE" = "true" ]; then
+ ietd_start
+ else
+ log_warning_msg "iscsitarget not enabled in \"$ISCSITARGET_DEFAULTS_FILE\", not starting..."
+ fi
;;
status)
PID=`pidof ietd`
signature.asc
Description: Digital signature

