From bbb179114ed9a98db083b831b5846d32bd6c72e0 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Dec 16 2013 18:54:29 +0000 Subject: Update variable name space inside tcar-scripts. - Previously, TCAR_SCRIPT_NAME variable was set define the script name as "tcar.sh". This update removes the TCAR_SCRIPT_NAME variable and uses TCAR_SCRIPT_PACKAGE variable instead which is set to "tcar". - Previously, TCAR_SCRIPT_COMMAND variable was set to define the script command as "tcar". This update removes TCAR_SCRIPT_NAME variable and uses TCAR_SCRIPT_PACKAGE variable instead, which is set to "tcar" as well. --- diff --git a/tcar-scripts/tcar.sh b/tcar-scripts/tcar.sh index 050d2db..34709c0 100755 --- a/tcar-scripts/tcar.sh +++ b/tcar-scripts/tcar.sh @@ -28,9 +28,8 @@ # Identity ###################################################################### -declare -xr TCAR_SCRIPT_NAME="tcar.sh" -declare -xr TCAR_SCRIPT_VERSION='0.8' -declare -xr TCAR_SCRIPT_COMMAND="tcar" +declare -xr TCAR_SCRIPT_PACKAGE="tcar" +declare -xr TCAR_SCRIPT_VERSION="$(rpm -q -qf "%{VERSION}" ${TCAR_SCRIPT_PACKAGE})" ###################################################################### # Paths @@ -44,7 +43,7 @@ declare -xr TCAR_BASEDIR=/usr/share/tcar/scripts declare -xr TCAR_WORKDIR=/tmp # Directory to store temporal files. -declare -xr TCAR_SCRIPT_TEMPDIR=$(mktemp -p /tmp -d ${TCAR_SCRIPT_NAME}-XXXXXX) +declare -xr TCAR_SCRIPT_TEMPDIR=$(mktemp -p /tmp -d ${TCAR_SCRIPT_PACKAGE}-XXXXXX) # Configuration files in order of reading preference. The last file in # the list overlaps options set in previous files in the list. Use @@ -83,7 +82,7 @@ declare -xr TCAR_SCRIPT_LANG_CC=$(echo ${TCAR_SCRIPT_LANG_LC} | cut -d'_' -f2) # system to retrieve translated strings from machine object (MO) files # with this name. This variable is reset each time a new module is # loaded, so the correct files can be used. -declare -x TEXTDOMAIN="${TCAR_SCRIPT_NAME}" +declare -x TEXTDOMAIN="${TCAR_SCRIPT_PACKAGE}" # Set the script text domain directory. This information is used by # gettext system to know where the machine objects are stored in. This diff --git a/tcar-scripts/tcar_printHelp.sh b/tcar-scripts/tcar_printHelp.sh index fb4404b..b48eef9 100755 --- a/tcar-scripts/tcar_printHelp.sh +++ b/tcar-scripts/tcar_printHelp.sh @@ -42,7 +42,7 @@ function tcar_printHelp { if [[ ${TCAR_MANPAGE_NAME} =~ '^--help=[[:alnum:]_-.]+' ]];then TCAR_MANPAGE_NAME=$(echo ${TCAR_MANPAGE_NAME} | cut -d'=' -f2) else - TCAR_MANPAGE_NAME=${TCAR_SCRIPT_NAME} + TCAR_MANPAGE_NAME=${TCAR_SCRIPT_PACKAGE} fi fi diff --git a/tcar-scripts/tcar_printMessage.sh b/tcar-scripts/tcar_printMessage.sh index 06cff88..9b11543 100755 --- a/tcar-scripts/tcar_printMessage.sh +++ b/tcar-scripts/tcar_printMessage.sh @@ -109,7 +109,7 @@ function tcar_printMessage { local COUNT=$(( ${#FN[*]} - 2 )) local SEPARATOR='`--' local SPACES=0 - echo "${TCAR_SCRIPT_BASEDIR}/${TCAR_SCRIPT_NAME}" 1>&2 + echo "${TCAR_SCRIPT_BASEDIR}/${TCAR_SCRIPT_PACKAGE}" 1>&2 while [[ ${COUNT} -gt 0 ]];do if [[ ${COUNT} -eq $(( ${#FN[*]} - 2 )) ]];then echo ${SEPARATOR} ${FN[${COUNT}]} 1>&2 @@ -123,7 +123,7 @@ function tcar_printMessage { ;; --as-toknowmore-line ) - tcar_printMessage "`gettext "To know more, run"` ${TCAR_SCRIPT_COMMAND} ${MESSAGE} --help" --as-stderr-line + tcar_printMessage "`gettext "To know more, run"` ${TCAR_SCRIPT_PACKAGE} ${MESSAGE} --help" --as-stderr-line ;; --as-yesornorequest-line ) diff --git a/tcar-scripts/tcar_printVersion.sh b/tcar-scripts/tcar_printVersion.sh index de276bb..794259a 100755 --- a/tcar-scripts/tcar_printVersion.sh +++ b/tcar-scripts/tcar_printVersion.sh @@ -27,14 +27,14 @@ function tcar_printVersion { - local PROGRAM_NAME=${1:-${TCAR_SCRIPT_NAME}} + local PROGRAM_NAME=${1:-${TCAR_SCRIPT_PACKAGE}} local YEAR=$(tcar_printCopyrightInfo --year) local HOLDER=$(tcar_printCopyrightInfo --holder) - if [[ ${PROGRAM_NAME} == ${TCAR_SCRIPT_NAME} ]];then - tcar_printMessage "${TCAR_SCRIPT_NAME} ${TCAR_SCRIPT_VERSION}" --as-stdout-line + if [[ ${PROGRAM_NAME} == ${TCAR_SCRIPT_PACKAGE} ]];then + tcar_printMessage "${TCAR_SCRIPT_PACKAGE} ${TCAR_SCRIPT_VERSION}" --as-stdout-line else - tcar_printMessage "${PROGRAM_NAME} (${TCAR_SCRIPT_NAME}) ${TCAR_SCRIPT_VERSION}" --as-stdout-line + tcar_printMessage "${PROGRAM_NAME} (${TCAR_SCRIPT_PACKAGE}) ${TCAR_SCRIPT_VERSION}" --as-stdout-line fi tcar_printMessage "Copyright (C) ${YEAR} ${HOLDER}" --as-stdout-line tcar_printMessage "`eval_gettext "\\\$PROGRAM_NAME comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of \\\$PROGRAM_NAME under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING."`" --as-stdout-line | fold --width=66 --spaces diff --git a/tcar-scripts/tcar_setModuleArguments.sh b/tcar-scripts/tcar_setModuleArguments.sh index fe884a5..9f3118a 100755 --- a/tcar-scripts/tcar_setModuleArguments.sh +++ b/tcar-scripts/tcar_setModuleArguments.sh @@ -63,7 +63,7 @@ function tcar_setModuleArguments { # Process positional parameters using getopt's option validation. TCAR_MODULE_ARGUMENT=$(getopt -o "${ARGSS}" -l "${ARGSL}" \ - -n "${TCAR_SCRIPT_COMMAND} (${TCAR_MODULE_NAME})" -- "${@}") + -n "${TCAR_SCRIPT_PACKAGE} (${TCAR_MODULE_NAME})" -- "${@}") # Verify getopt's exit status and finish the script execution # with an error message, if it failed.