File otrs-3.0.11-init.patch of Package otrs.openSUSE_12.1_Update

Index: scripts/suse-rcotrs
===================================================================
--- scripts/suse-rcotrs.orig
+++ scripts/suse-rcotrs
@@ -12,25 +12,57 @@
 
 ### BEGIN INIT INFO
 # Provides:          otrs
-# Required-Start:    mysql apache
-# Required-Stop:
+# Required-Start:    apache2
+# Should-Start:      mysql
+# Required-Stop:     apache2
+# Should-Stop:       mysql
 # Default-Start:     3 5
 # Default-Stop:      0 1 2 6
-# Description:       Open Ticket Request System
+# Short-Description: start OTRS
+# Description:       start OTRS (Open Ticket Request System)
 ### END INIT INFO
 
 export LANG=POSIX
 PATH="/bin:/usr/bin:/sbin:/usr/sbin"
 
-#
-# load the configuration
-#
-CONFIGFILE="rcconfig file not found!"
-test -r /etc/rc.config && . /etc/rc.config
+# Check for existence of needed config file and read it
+OTRS_SYSCONFIG=/etc/sysconfig/otrs
+test -r $OTRS_SYSCONFIG || { echo "$OTRS_SYSCONFIG not existing";
+        if [ "$1" = "stop" ]; then exit 0;
+        else exit 6; fi; }
+
+# Read config
+. $OTRS_SYSCONFIG
+
+if [ -z $OTRS_ROOT ]; then
+        echo "OTRS_ROOT not set";
+        echo "check config: $OTRS_SYSCONFIG";
+        exit 6;
+fi
+
+if [ -z $OTRS_POSTMASTER ]; then
+        echo "OTRS_POSTMASTER not set";
+        echo "check config: $OTRS_SYSCONFIG";
+        exit 6;
+fi
 
-test -r /etc/rc.config.d/otrs && . /etc/rc.config.d/otrs && CONFIGFILE=/etc/rc.config.d/otrs
+if [ -z $OTRS_CHECKDB ]; then
+        echo "OTRS_CHECKDB not set";
+        echo "check config: $OTRS_SYSCONFIG";
+        exit 6;
+fi
 
-test -r /etc/sysconfig/otrs && . /etc/sysconfig/otrs && CONFIGFILE=/etc/sysconfig/otrs
+if [ -z $OTRS_CLEANUP ]; then
+        echo "OTRS_CLEANUP not set";
+        echo "check config: $OTRS_SYSCONFIG";
+        exit 6;
+fi
+
+if [ -z $OTRS_SPOOLDIR ]; then
+        echo "OTRS_SPOOLDIR not set";
+        echo "check config: $OTRS_SYSCONFIG";
+        exit 6;
+fi
 
 # Shell functions sourced from /etc/rc.status:
 #      rc_check         check and set local and overall rc status
@@ -41,64 +73,22 @@ test -r /etc/sysconfig/otrs && . /etc/sy
 #      rc_failed <num>  set local and overall rc status to <num>
 #      rc_reset         clear local rc status (overall remains)
 #      rc_exit          exit appropriate to overall rc status
-test -s /etc/rc.status && . /etc/rc.status
-
-#
-# check needed variable
-#
-if ! test $OTRS_ROOT; then
-    echo "Error: Corrupt config file ($CONFIGFILE)! OTRS_ROOT not found! Please check your /etc/sysconfig/otrs - maybe it wasn't changed by rpm!"
-    exit 5
-fi
-if ! test $OTRS_POSTMASTER; then
-    echo "Error: Corrupt config file ($CONFIGFILE)! OTRS_POSTMASTER not found! Please check your /etc/sysconfig/otrs - maybe it wasn't changed by rpm!"
-    exit 5
-fi
-if ! test $OTRS_SPOOLDIR; then
-    echo "Error: Corrupt config file ($CONFIGFILE)! OTRS_SPOOLDIR not found! Please check your /etc/sysconfig/otrs - maybe it wasn't changed by rpm!"
-    exit 5
-fi
-#
-# check needed files
-#
-if ! test -r $OTRS_ROOT; then
-    echo "Error: $OTRS_ROOT not found!"
-    exit 5
-fi
-
-if ! test -r $OTRS_POSTMASTER; then
-    echo "Error: $OTRS_POSTMASTER not found!"
-    exit 5
-fi
-
-if ! test -d $OTRS_SPOOLDIR; then
-    echo "Error: $OTRS_SPOOLDIR not found!"
-    exit 5
-fi
-
-if ! test -r $OTRS_CHECKDB; then
-    echo "Error: $OTRS_CHECKDB not found!"
-    exit 5
-fi
-
-if test $OTRS_CLEANUP; then
-    if ! test -r $OTRS_CLEANUP; then
-        echo "Error: $OTRS_CLEANUP not found!"
-        exit 5
-    fi
-fi
+. /etc/rc.status
 
-# reset status of this service
+# Reset status of this service
 rc_reset
 
-#
-# The echo return value for success (defined in /etc/rc.config).
-#
-return=$rc_done
-
-#
-# main part
-#
+# Return values acc. to LSB for all commands but status:
+# 0       - success
+# 1       - generic or unspecified error
+# 2       - invalid or excess argument(s)
+# 3       - unimplemented feature (e.g. "reload")
+# 4       - user had insufficient privileges
+# 5       - program is not installed
+# 6       - program is not configured
+# 7       - program is not running
+# 8--199  - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
+
 case "$1" in
     # ------------------------------------------------------
     # start
@@ -394,6 +384,16 @@ case "$1" in
       rc_status
     ;;
     # ------------------------------------------------------
+    # reload
+    # ------------------------------------------------------
+    reload)
+      ## OTRS does not support reload:
+      rc_failed 3
+
+      # Remember status and be verbose
+      rc_status -v
+    ;;
+    # ------------------------------------------------------
     # cleanup
     # ------------------------------------------------------
     cleanup)
openSUSE Build Service is sponsored by