From cd9fd2a7ccb7a47e7c76914045705cf1304ca929 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Thu, 10 Nov 2011 19:18:27 -0500 Subject: functions: move all logic to the end of the file ...where it belongs Signed-off-by: Dave Reisner --- functions | 82 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/functions b/functions index 6cec95b..8218d68 100644 --- a/functions +++ b/functions @@ -122,47 +122,6 @@ parse_envfile() { return $ret } -if [[ $DAEMON_LOCALE = [yY][eE][sS] ]]; then - LANG=${LOCALE:-C} - if [[ -r /etc/locale.conf ]]; then - parse_envfile /etc/locale.conf "${localevars[@]}" - fi -else - export LANG=C -fi - -# set colors -if [[ $USECOLOR = [yY][eE][sS] ]]; then - if tput setaf 0 &>/dev/null; then - C_CLEAR=$(tput sgr0) # clear text - C_MAIN=${C_CLEAR}$(tput bold) # main text - C_OTHER=${C_MAIN}$(tput setaf 4) # prefix & brackets - C_SEPARATOR=${C_MAIN}$(tput setaf 0) # separator - C_BUSY=${C_CLEAR}$(tput setaf 6) # busy - C_FAIL=${C_MAIN}$(tput setaf 1) # failed - C_DONE=${C_MAIN} # completed - C_BKGD=${C_MAIN}$(tput setaf 5) # backgrounded - C_H1=${C_MAIN} # highlight text 1 - C_H2=${C_MAIN}$(tput setaf 6) # highlight text 2 - else - C_CLEAR="\e[m" # clear text - C_MAIN="\e[;1m" # main text - C_OTHER="\e[1;34m" # prefix & brackets - C_SEPARATOR="\e[1;30m" # separator - C_BUSY="\e[;36m" # busy - C_FAIL="\e[1;31m" # failed - C_DONE=${C_MAIN} # completed - C_BKGD="\e[1;35m" # backgrounded - C_H1=${C_MAIN} # highlight text 1 - C_H2="\e[1;36m" # highlight text 2 - fi -fi - -# prefixes: - -PREFIX_REG="::" -PREFIX_HL=" >" - # functions: deltext() { @@ -641,6 +600,47 @@ EOF fi } +if [[ $DAEMON_LOCALE = [yY][eE][sS] ]]; then + LANG=${LOCALE:-C} + if [[ -r /etc/locale.conf ]]; then + parse_envfile /etc/locale.conf "${localevars[@]}" + fi +else + export LANG=C +fi + +# set colors +if [[ $USECOLOR = [yY][eE][sS] ]]; then + if tput setaf 0 &>/dev/null; then + C_CLEAR=$(tput sgr0) # clear text + C_MAIN=${C_CLEAR}$(tput bold) # main text + C_OTHER=${C_MAIN}$(tput setaf 4) # prefix & brackets + C_SEPARATOR=${C_MAIN}$(tput setaf 0) # separator + C_BUSY=${C_CLEAR}$(tput setaf 6) # busy + C_FAIL=${C_MAIN}$(tput setaf 1) # failed + C_DONE=${C_MAIN} # completed + C_BKGD=${C_MAIN}$(tput setaf 5) # backgrounded + C_H1=${C_MAIN} # highlight text 1 + C_H2=${C_MAIN}$(tput setaf 6) # highlight text 2 + else + C_CLEAR="\e[m" # clear text + C_MAIN="\e[;1m" # main text + C_OTHER="\e[1;34m" # prefix & brackets + C_SEPARATOR="\e[1;30m" # separator + C_BUSY="\e[;36m" # busy + C_FAIL="\e[1;31m" # failed + C_DONE=${C_MAIN} # completed + C_BKGD="\e[1;35m" # backgrounded + C_H1=${C_MAIN} # highlight text 1 + C_H2="\e[1;36m" # highlight text 2 + fi +fi + +# prefixes: + +PREFIX_REG="::" +PREFIX_HL=" >" + # Source additional functions at the end to allow overrides for f in /etc/rc.d/functions.d/*; do [[ -e $f ]] && . "$f" -- cgit v1.2.3