From 1fbcf9a9a57ad318e9df3f25cb3bb73606ac40dd Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 22 May 2006 19:38:51 +0000 Subject: [PATCH] removed bashism from init.d script --- config/debian-initd | 21 +++++++++++++-------- debian/changelog | 7 +++++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/config/debian-initd b/config/debian-initd index 375209ad..a6373ce6 100644 --- a/config/debian-initd +++ b/config/debian-initd @@ -85,21 +85,27 @@ do_stop() return "$RETVAL" } + +# yoh: +# shortcut function to don't duplicate case statements and to don't use +# bashisms (arrays). Fixes #368218 # -# yoh hates code duplication that is why to prevent multiple cloned case -# clauses lets use array. Trailing 1s just for safety if new error codes come up -log_ends=(0 0 1 1 1) +log_end_msg_wrapper() +{ + [ $1 -lt $2 ] && value=0 || value=1 + log_end_msg $value +} case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" do_start - [ "$VERBOSE" != no ] && log_end_msg ${log_ends[$?]} + [ "$VERBOSE" != no ] && log_end_msg_wrapper $? 2 ;; stop) [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" do_stop - [ "$VERBOSE" != no ] && log_end_msg ${log_ends[$?]} + [ "$VERBOSE" != no ] && log_end_msg_wrapper $? 2 ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" @@ -107,14 +113,13 @@ case "$1" in case "$?" in 0|1) do_start - # we need to shift by 1 in our log_ends - log_end_msg ${log_ends[$(($?+1))]} + log_end_msg_wrapper $? 1 ;; *) # Failed to stop log_end_msg 1 ;; - esac + esac ;; status) log_daemon_msg "Status of $DESC" diff --git a/debian/changelog b/debian/changelog index 9f03c78b..c7bae3a3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +fail2ban (0.6.1-6) unstable; urgency=low + + * Removed bashism (arrays) from init.d script to make it POSIX shell + complient (closes: #368218) + + -- Yaroslav Halchenko Mon, 22 May 2006 15:37:17 -0400 + fail2ban (0.6.1-5) unstable; urgency=low * Further fixed debian packaging: to comply with policy empty target