removed bashism from init.d script

debian-releases/etch
Yaroslav Halchenko 2006-05-22 19:38:51 +00:00
parent 537399dbc9
commit 1fbcf9a9a5
2 changed files with 20 additions and 8 deletions

View File

@ -85,21 +85,27 @@ do_stop()
return "$RETVAL" 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 log_end_msg_wrapper()
# clauses lets use array. Trailing 1s just for safety if new error codes come up {
log_ends=(0 0 1 1 1) [ $1 -lt $2 ] && value=0 || value=1
log_end_msg $value
}
case "$1" in case "$1" in
start) start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start do_start
[ "$VERBOSE" != no ] && log_end_msg ${log_ends[$?]} [ "$VERBOSE" != no ] && log_end_msg_wrapper $? 2
;; ;;
stop) stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop do_stop
[ "$VERBOSE" != no ] && log_end_msg ${log_ends[$?]} [ "$VERBOSE" != no ] && log_end_msg_wrapper $? 2
;; ;;
restart|force-reload) restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME" log_daemon_msg "Restarting $DESC" "$NAME"
@ -107,14 +113,13 @@ case "$1" in
case "$?" in case "$?" in
0|1) 0|1)
do_start do_start
# we need to shift by 1 in our log_ends log_end_msg_wrapper $? 1
log_end_msg ${log_ends[$(($?+1))]}
;; ;;
*) *)
# Failed to stop # Failed to stop
log_end_msg 1 log_end_msg 1
;; ;;
esac esac
;; ;;
status) status)
log_daemon_msg "Status of $DESC" log_daemon_msg "Status of $DESC"

7
debian/changelog vendored
View File

@ -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 <debian@onerussian.com> Mon, 22 May 2006 15:37:17 -0400
fail2ban (0.6.1-5) unstable; urgency=low fail2ban (0.6.1-5) unstable; urgency=low
* Further fixed debian packaging: to comply with policy empty target * Further fixed debian packaging: to comply with policy empty target