From c2d927e7105f04570f4b1e82d94a8c40f53b2303 Mon Sep 17 00:00:00 2001 From: Steve Beattie Date: Thu, 24 May 2007 05:00:34 +0000 Subject: [PATCH] Fix return code propogation in the initscripts, and return the correct return code in the try-restart case properly when apparmor is not loaded. --- parser/rc.aaeventd.redhat | 5 ++++- parser/rc.aaeventd.suse | 5 ++++- parser/rc.apparmor.debian | 8 +++++++- parser/rc.apparmor.functions | 2 +- parser/rc.apparmor.redhat | 8 +++++++- parser/rc.apparmor.slackware | 8 +++++++- parser/rc.apparmor.suse | 10 ++++++++-- 7 files changed, 38 insertions(+), 8 deletions(-) diff --git a/parser/rc.aaeventd.redhat b/parser/rc.aaeventd.redhat index c2e92d126..4e56a0da2 100644 --- a/parser/rc.aaeventd.redhat +++ b/parser/rc.aaeventd.redhat @@ -112,13 +112,16 @@ fi case "$1" in start) start_aa_event + rc=$? ;; stop) stop_aa_event + rc=$? ;; restart|reload|force-reload|try-restart) stop_aa_event start_aa_event + rc=$? ;; status) echo -n "Checking for service AppArmor Event daemon:" @@ -134,4 +137,4 @@ case "$1" in exit 1 ;; esac -exit 0 +exit $rc diff --git a/parser/rc.aaeventd.suse b/parser/rc.aaeventd.suse index 8d73d822d..6983fbd53 100644 --- a/parser/rc.aaeventd.suse +++ b/parser/rc.aaeventd.suse @@ -107,13 +107,16 @@ fi case "$1" in start) start_aa_event + rc=$? ;; stop) stop_aa_event + rc=$? ;; restart|reload|force-reload|try-restart) stop_aa_event start_aa_event + rc=$? ;; status) echo -n "Checking for service AppArmor Event daemon:" @@ -129,5 +132,5 @@ case "$1" in exit 1 ;; esac -exit 0 +exit $rc diff --git a/parser/rc.apparmor.debian b/parser/rc.apparmor.debian index 856d5589d..3e4bd1058 100644 --- a/parser/rc.apparmor.debian +++ b/parser/rc.apparmor.debian @@ -90,25 +90,31 @@ test -x ${PARSER} || exit 0 # by debian policy case "$1" in start) apparmor_start + rc=$? ;; stop) apparmor_stop + rc=$? ;; restart|reload|force-reload) apparmor_restart + rc=$? ;; try-restart) apparmor_try_restart + rc=$? ;; kill) apparmor_kill + rc=$? ;; status) apparmor_status + rc=$? ;; *) usage exit 1 ;; esac -exit 0 +exit $rc diff --git a/parser/rc.apparmor.functions b/parser/rc.apparmor.functions index fd3e1a296..b231e4efb 100644 --- a/parser/rc.apparmor.functions +++ b/parser/rc.apparmor.functions @@ -422,7 +422,7 @@ apparmor_restart() { apparmor_try_restart() { if ! is_apparmor_loaded ; then - return 1 + return 0 fi __apparmor_restart diff --git a/parser/rc.apparmor.redhat b/parser/rc.apparmor.redhat index bee3c351a..33fc36b6d 100644 --- a/parser/rc.apparmor.redhat +++ b/parser/rc.apparmor.redhat @@ -97,26 +97,32 @@ fi case "$1" in start) apparmor_start + rc=$? ;; stop) apparmor_stop + rc=$? ;; restart|reload|force-reload) apparmor_restart + rc=$? ;; try-restart) apparmor_try_restart + rc=$? ;; kill) apparmor_kill + rc=$? ;; status) apparmor_status + rc=$? ;; *) usage exit 1 ;; esac -exit 0 +exit $rc diff --git a/parser/rc.apparmor.slackware b/parser/rc.apparmor.slackware index 3385a05c0..14a72e47f 100644 --- a/parser/rc.apparmor.slackware +++ b/parser/rc.apparmor.slackware @@ -71,26 +71,32 @@ fi case "$1" in start) apparmor_start + rc=$? ;; stop) apparmor_stop + rc=$? ;; restart|reload|force-reload) apparmor_restart + rc=$? ;; try-restart) apparmor_try_restart + rc=$? ;; kill) apparmor_kill + rc=$? ;; status) apparmor_status + rc=$? ;; *) usage exit 1 ;; esac -exit 0 +exit $rc diff --git a/parser/rc.apparmor.suse b/parser/rc.apparmor.suse index 4e54a79fd..9800f249d 100644 --- a/parser/rc.apparmor.suse +++ b/parser/rc.apparmor.suse @@ -32,7 +32,7 @@ ### BEGIN INIT INFO # Provides: apparmor # Required-Start: -# Rquired-Stop: +# Required-Stop: # Should-Start: $local_fs # Default-Start: B 2 3 5 # Default-Stop: @@ -99,26 +99,32 @@ fi case "$1" in start) apparmor_start + rc=$? ;; stop) apparmor_stop + rc=$? ;; restart|reload|force-reload) apparmor_restart + rc=$? ;; try-restart) apparmor_try_restart + rc=$? ;; kill) apparmor_kill + rc=$? ;; status) apparmor_status + rc=$? ;; *) usage exit 1 ;; esac -exit 0 +exit $rc