scripts: allow usage when gettext is not installed

Address the issue of our scripts not working so great when gettext is not
available. This has come up in multiple bug reports, and is relatively easy
to address by adding a simple check and a stub function if gettext was not
found that simply echos the original message.

Addresses concerns from FS#9214 and FS#9607.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2008-02-17 21:15:06 -06:00
parent 2374c81e55
commit 3559306546
6 changed files with 46 additions and 0 deletions

View file

@ -80,6 +80,13 @@ check_force () {
# PROGRAM START # PROGRAM START
# determine whether we have gettext; make it a no-op if we do not
if [ ! $(type -t gettext) ]; then
gettext() {
echo "$@"
}
fi
if [ "$1" = "-h" -o "$1" = "--help" ]; then if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage usage
exit 0 exit 0

View file

@ -1107,6 +1107,15 @@ This is free software; see the source for copying conditions.\n\
There is NO WARRANTY, to the extent permitted by law.\n")" There is NO WARRANTY, to the extent permitted by law.\n")"
} }
# PROGRAM START
# determine whether we have gettext; make it a no-op if we do not
if [ ! $(type -t gettext) ]; then
gettext() {
echo "$@"
}
fi
ARGLIST=$@ ARGLIST=$@
#preserve environment variables #preserve environment variables

View file

@ -70,6 +70,15 @@ die_r() {
die "$@" die "$@"
} }
# PROGRAM START
# determine whether we have gettext; make it a no-op if we do not
if [ ! $(type -t gettext) ]; then
gettext() {
echo "$@"
}
fi
if [ "$1" = "-h" -o "$1" = "--help" ]; then if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage usage
exit 0 exit 0

View file

@ -252,6 +252,13 @@ db_write_entry()
# PROGRAM START # PROGRAM START
# determine whether we have gettext; make it a no-op if we do not
if [ ! $(type -t gettext) ]; then
gettext() {
echo "$@"
}
fi
# check for help flags # check for help flags
if [ "$1" = "-h" -o "$1" = "--help" ]; then if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage usage

View file

@ -95,6 +95,13 @@ db_remove_entry() {
# PROGRAM START # PROGRAM START
# determine whether we have gettext; make it a no-op if we do not
if [ ! $(type -t gettext) ]; then
gettext() {
echo "$@"
}
fi
# check for help flags # check for help flags
if [ "$1" = "-h" -o "$1" = "--help" ]; then if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage usage

View file

@ -79,6 +79,13 @@ check_force () {
# PROGRAM START # PROGRAM START
# determine whether we have gettext; make it a no-op if we do not
if [ ! $(type -t gettext) ]; then
gettext() {
echo "$@"
}
fi
if [ "$1" = "-h" -o "$1" = "--help" ]; then if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage usage
exit 0 exit 0