From 2ec22adadc390e992d234d0c85b06c9ec1a16197 Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Thu, 26 Mar 2009 21:22:42 +0100 Subject: [PATCH 05/15] Replace the deprecated and bash-only $"string" syntax by eval_gettext --- config/ctdb.init | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/config/ctdb.init b/config/ctdb.init index 716b8cb..bd50228 100755 --- a/config/ctdb.init +++ b/config/ctdb.init @@ -26,6 +26,16 @@ elif [ -f /etc/rc.d/init.d/functions ] ; then . /etc/rc.d/init.d/functions fi +#gettext +if [ -f /usr/bin/gettext.sh ] ; then + . /usr/bin/gettext.sh +fi +if ! type 'eval_gettext' >/dev/null; then + eval_gettext() { + echo -n "$1" | (export PATH `envsubst --variables "$1"`; envsubst "$1") + } +fi + [ -f /etc/rc.status ] && { . /etc/rc.status rc_reset @@ -95,7 +105,7 @@ set_retval() { start_server() { killall -q ctdbd - echo -n $"Starting ctdbd service: " + eval_gettext "Starting ctdbd service: " # check all persistent databases that they look ok case $init_style in @@ -152,7 +162,7 @@ start_server() { } stop_server() { - echo -n $"Shutting down ctdbd service: " + eval_gettext "Shutting down ctdbd service: " ctdb ping > /dev/null 2>&1 || { echo -n " Warning: ctdbd not running ! " case $init_style in @@ -177,7 +187,7 @@ stop_server() { sleep 1 count=`expr $count + 1` [ $count -gt 10 ] && { - echo -n $"killing ctdbd " + eval_gettext "killing ctdbd " killall -q -9 ctdbd pkill -9 -f $CTDB_BASE/events.d/ } @@ -204,7 +214,7 @@ restart_server() { } status() { - echo -n $"Checking for ctdbd service: " + eval_gettext "Checking for ctdbd service: " ctdb ping > /dev/null 2>&1 || { RETVAL=$? echo -n " ctdbd not running. " @@ -245,7 +255,8 @@ case "$1" in ctdb status > /dev/null || restart_server ;; *) - echo $"Usage: $0 {start|stop|restart|status|cron|condrestart}" >&2 + eval_gettext "Usage: $0 {start|stop|restart|status|cron|condrestart}" >&2 + echo >&2 exit 1 ;; esac -- 1.6.2