File openct-init.patch of Package openct

--- etc/init-script.in
+++ etc/init-script.in
@@ -2,8 +2,8 @@
 
 ### BEGIN INIT INFO
 # Provides:          openct
-# Required-Start:    $syslog
-# Required-Stop:     $syslog
+# Required-Start:    $syslog $remote_fs
+# Required-Stop:     $syslog $remote_fs
 # Should-Start:      $local_fs
 # Should-Stop:       $local_fs
 # Default-Start:     2 3 4 5
@@ -20,7 +20,11 @@ STATUS_FILE="$STATUS_DIR/status"
 NAME=OpenCT
 DESC="smart card terminal framework"
 
-test -x $DAEMON || exit 0
+. /etc/rc.status
+
+rc_reset
+
+test -x $DAEMON || exit 5
 
 # create the directory for our status and socket files,
 # if it does not exist.
@@ -32,39 +36,26 @@ then
 	# this example would assign the directory to a group "scard"
 	# and set permissions so only users in that group can access
 	# smart card readers via openct.
-	#chown root:scard "$STATUS_DIR"
-	#chmod 0750 "$STATUS_DIR"
+	chown @USER@:@GROUP@ "$STATUS_DIR"
+	chmod 0755 "$STATUS_DIR"
 fi
 
-set -e
-
 case "$1" in
   start)
 	echo -n "Starting $DESC: $NAME"
 	$DAEMON init
-	echo "."
+	rc_status -v
 	;;
   stop)
-	echo -n "Stopping $DESC: $NAME "
+	echo -n "Stopping $DESC: $NAME"
 	if [ -f $STATUS_FILE ]; then
 		$DAEMON shutdown
 		rm -f $STATUS_FILE
 	fi
-	echo "."
+	rc_status -v
+	;;
+  reload)
 	;;
-  #reload)
-	#
-	#	If the daemon can reload its config files on the fly
-	#	for example by sending it SIGHUP, do it here.
-	#
-	#	If the daemon responds to changes in its config file
-	#	directly anyway, make this a do-nothing entry.
-	#
-	# echo -n "Reloading $DESC configuration..."
-	# start-stop-daemon --stop --signal 1 --quiet --pidfile \
-	#	@localstatedir@/run/$NAME.pid --exec $DAEMON
-	# echo "done."
-  #;;
   restart|force-reload)
 	#
 	#	If the "reload" option is implemented, move the "force-reload"
@@ -78,12 +69,24 @@ case "$1" in
 	fi
 	sleep 0.1
 	$DAEMON init
-	echo "."
+	rc_status -v
+	;;
+  try-restart)
+	$0 status >/dev/null &&  $0 restart
+	rc_status
+	;;
+  status)
+	echo -n "Checking for $DESC: $NAME"
+	if openct-tool list >/dev/null 2>&1; then
+		rc_failed 0
+	else
+		rc_failed 3
+	fi
+	rc_status -v
 	;;
   *)
 	N=/etc/init.d/$NAME
-	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
-	echo "Usage: $N {start|stop|restart|force-reload}" >&2
+	echo "Usage: $N {start|stop|status|try-restart|restart|reload|force-reload}" >&2
 	exit 1
 	;;
 esac
openSUSE Build Service is sponsored by