1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

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
# 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
usage
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")"
}
# 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=$@
#preserve environment variables

View File

@ -70,6 +70,15 @@ die_r() {
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
usage
exit 0

View File

@ -252,6 +252,13 @@ db_write_entry()
# 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
if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage

View File

@ -95,6 +95,13 @@ db_remove_entry() {
# 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
if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage

View File

@ -79,6 +79,13 @@ check_force () {
# 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
usage
exit 0