From 7bfd60d9d94e0f698f15e131b26fd5ff770b8cfa Mon Sep 17 00:00:00 2001 From: Jan-Pascal van Best Date: Sun, 27 Jan 2013 16:54:56 +0100 Subject: [PATCH] Fixes for init script: Check for module availability, patched kernel, do not exit with error --- debian/sasc-ng-common.sasc-ng.init | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/debian/sasc-ng-common.sasc-ng.init b/debian/sasc-ng-common.sasc-ng.init index cbfa0bb..3c8bf96 100755 --- a/debian/sasc-ng-common.sasc-ng.init +++ b/debian/sasc-ng-common.sasc-ng.init @@ -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 ;; *) -- 2.39.5