libraries, autospec: refactoring library loading to fix some issues
Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
parent
868c8b882a
commit
40a6110422
@ -20,11 +20,10 @@
|
|||||||
|
|
||||||
me=(${0##*/} "@version@" "@date@")
|
me=(${0##*/} "@version@" "@date@")
|
||||||
|
|
||||||
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
|
[ -r @libdir@/libtranslate.lib ] ||
|
||||||
. /etc/sysconfig/i18n
|
{ echo "$me: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
|
||||||
[ "$LANG" ] && export LANG
|
exit 1; }
|
||||||
fi
|
. @libdir@/libtranslate.lib
|
||||||
TEXTDOMAIN="@package@"; export TEXTDOMAIN
|
|
||||||
|
|
||||||
# default values
|
# default values
|
||||||
let "pck_update = 0"
|
let "pck_update = 0"
|
||||||
|
@ -14,12 +14,10 @@ libmsgmng.lib: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
|
|||||||
exit 1; }
|
exit 1; }
|
||||||
. @libdir@/libtranslate.lib
|
. @libdir@/libtranslate.lib
|
||||||
|
|
||||||
notify.debug $"loading"": \`libmsgmng.lib'..."
|
|
||||||
|
|
||||||
# notify family of message handling functions:
|
# notify family of message handling functions:
|
||||||
|
# - notify.debug
|
||||||
# - notify.warning
|
# - notify.warning
|
||||||
# - notify.error
|
# - notify.error
|
||||||
# - notify.debug
|
|
||||||
# - notify.note
|
# - notify.note
|
||||||
# args:
|
# args:
|
||||||
# $1 : message to print
|
# $1 : message to print
|
||||||
@ -31,6 +29,13 @@ notify.debug $"loading"": \`libmsgmng.lib'..."
|
|||||||
|
|
||||||
notify_def_msg="<"$"no message"">"
|
notify_def_msg="<"$"no message"">"
|
||||||
|
|
||||||
|
function notify.debug() {
|
||||||
|
[ ${verbose:-0} -gt 1 ] || return
|
||||||
|
echo -e "${WARN}DEBUG${NORM}: ${1:-$notify_def_msg}" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
notify.debug $"loading"": \`libmsgmng.lib'..."
|
||||||
|
|
||||||
function notify.warning() {
|
function notify.warning() {
|
||||||
echo -e "${WARN}WARNING${NORM}: ${1:-$notify_def_msg}" 1>&2
|
echo -e "${WARN}WARNING${NORM}: ${1:-$notify_def_msg}" 1>&2
|
||||||
}
|
}
|
||||||
@ -40,11 +45,6 @@ function notify.error() {
|
|||||||
${EXIT_FUNC:-"exit"} 1
|
${EXIT_FUNC:-"exit"} 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function notify.debug() {
|
|
||||||
[ ${verbose:-0} -gt 1 ] || return
|
|
||||||
echo -e "${WARN}DEBUG${NORM}: ${1:-$notify_def_msg}" 1>&2
|
|
||||||
}
|
|
||||||
|
|
||||||
function notify.note() {
|
function notify.note() {
|
||||||
[ ${verbose:-0} -ge 0 ] || return
|
[ ${verbose:-0} -ge 0 ] || return
|
||||||
echo -e "${1:-$notify_def_msg}"
|
echo -e "${1:-$notify_def_msg}"
|
||||||
|
@ -8,18 +8,18 @@ libtest_is_loaded=1
|
|||||||
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 3 ] &&
|
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 3 ] &&
|
||||||
{ echo $"this script requires bash version 3 or better" >&2 && exit 1; }
|
{ echo $"this script requires bash version 3 or better" >&2 && exit 1; }
|
||||||
|
|
||||||
[ -r @libdir@/libmsgmng.lib ] ||
|
|
||||||
{ echo "\
|
|
||||||
libtest.lib: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2
|
|
||||||
exit 1; }
|
|
||||||
. @libdir@/libmsgmng.lib
|
|
||||||
|
|
||||||
[ -r @libdir@/libtranslate.lib ] ||
|
[ -r @libdir@/libtranslate.lib ] ||
|
||||||
{ echo "\
|
{ echo "\
|
||||||
libtest.lib: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
|
libtest.lib: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
|
||||||
exit 1; }
|
exit 1; }
|
||||||
. @libdir@/libtranslate.lib
|
. @libdir@/libtranslate.lib
|
||||||
|
|
||||||
|
[ -r @libdir@/libmsgmng.lib ] ||
|
||||||
|
{ echo "\
|
||||||
|
libtest.lib: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2
|
||||||
|
exit 1; }
|
||||||
|
. @libdir@/libmsgmng.lib
|
||||||
|
|
||||||
notify.debug $"loading"": \`libtest.lib'..."
|
notify.debug $"loading"": \`libtest.lib'..."
|
||||||
|
|
||||||
[ -n "$testdir" ] ||
|
[ -n "$testdir" ] ||
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
# Copyright (C) 2012 Davide Madrisan <davide.madrisan@gmail.com>
|
# Copyright (C) 2012 Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
|
|
||||||
[ "$libtranslate_is_loaded" = 1 ] || {
|
[ "$libtranslate_is_loaded" = 1 ] || {
|
||||||
libtest_is_loaded=1
|
libtranslate_is_loaded=1
|
||||||
|
|
||||||
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
|
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
|
||||||
{ echo $"this script requires bash version 2 or better" >&2 && exit 1; }
|
{ echo $"this script requires bash version 2 or better" >&2 && exit 1; }
|
||||||
|
|
||||||
notify.debug $"loading"": \`libtranslate.lib'..."
|
# do not load any other library to avoid loops
|
||||||
|
|
||||||
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
|
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
|
||||||
. /etc/sysconfig/i18n
|
. /etc/sysconfig/i18n
|
||||||
|
Loading…
Reference in New Issue
Block a user