]> www.vanbest.org Git - sasc-ng.git/commitdiff
Fixes for init script: Check for module availability, patched kernel, do not exit...
authorJan-Pascal van Best <janpascal@vanbest.org>
Sun, 27 Jan 2013 15:54:56 +0000 (16:54 +0100)
committerJan-Pascal van Best <janpascal@vanbest.org>
Sun, 27 Jan 2013 15:54:56 +0000 (16:54 +0100)
debian/sasc-ng-common.sasc-ng.init

index cbfa0bbd3278fbed193b0ad5b6b9ef7d15c71a2b..3c8bf96aa3891836aa3a8518f0c2a72dbd68ce7a 100755 (executable)
@@ -24,7 +24,12 @@ SCRIPTNAME=/etc/init.d/sasc-ng-common
 # Exit if the package is not installed
 [ -x "$DAEMON" ] || exit 0
 
-# TODO: check for proper kernel version
+# Exit if the module is not available
+modprobe --dry-run --quiet dvbloopback || exit 0
+
+# Exit if the kernel has no 'sasc' in its version name,
+# indicating it's not patched for sasc
+uname -v | grep -q sasc || exit 0
 
 # Read configuration variable file if it is present
 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
@@ -104,16 +109,16 @@ case "$1" in
         [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
         do_start
         case "$?" in
-                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
-                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 || true ;;
+                2) [ "$VERBOSE" != no ] && log_end_msg 1 || true ;;
         esac
         ;;
   stop)
         [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
         do_stop
         case "$?" in
-                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
-                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 || true ;;
+                2) [ "$VERBOSE" != no ] && log_end_msg 1 || true ;;
         esac
         ;;
   #reload|force-reload)
@@ -136,9 +141,9 @@ case "$1" in
           0|1)
                 do_start
                 case "$?" in
-                        0) log_end_msg 0 ;;
-                        1) log_end_msg 1 ;; # Old process is still running
-                        *) log_end_msg 1 ;; # Failed to start
+                        0) log_end_msg 0 || true ;;
+                        1) log_end_msg 1 || true ;; # Old process is still running
+                        *) log_end_msg 1 || true ;; # Failed to start
                 esac
                 ;;
           *)