Blame Scripts/Functions/Prepare/prepare_doEnvironment.sh

c29817
#!/bin/bash
c29817
#
1700f3
# prepare_doEnvironment.sh -- This function outputs a brief description
c29817
# of environment variables used by `centos-art.sh' script.
c29817
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
c29817
# 
7cd8e9
# This program is free software; you can redistribute it and/or
7cd8e9
# modify it under the terms of the GNU General Public License as
7cd8e9
# published by the Free Software Foundation; either version 2 of the
7cd8e9
# License, or (at your option) any later version.
c29817
# 
c29817
# This program is distributed in the hope that it will be useful, but
c29817
# WITHOUT ANY WARRANTY; without even the implied warranty of
c29817
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
c29817
# General Public License for more details.
c29817
#
c29817
# You should have received a copy of the GNU General Public License
c29817
# along with this program; if not, write to the Free Software
c29817
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
c29817
# USA.
c29817
# 
c29817
# ----------------------------------------------------------------------
c29817
# $Id$
c29817
# ----------------------------------------------------------------------
c29817
1700f3
function prepare_doEnvironment {
c29817
409e1e
    # Verify `--packages' option.
eea485
    if [[ $FLAG_ENVIRONMENT == 'false' ]];then
409e1e
        return
409e1e
    fi
409e1e
409e1e
    # Print line separator.
409e1e
    cli_printMessage '-' 'AsSeparatorLine'
409e1e
eea485
    # Print action message.
eea485
    cli_printMessage "`gettext "Checking environment variables"`" 'AsResponseLine'
eea485
eea485
    # Print line separator.
eea485
    cli_printMessage '-' 'AsSeparatorLine'
eea485
c29817
    local -a VARS
c29817
    local -a INFO
c29817
    local COUNT=0
c29817
c29817
    # Define name of environment variables used by centos-art.sh
c29817
    # script.
c29817
    VARS[0]='EDITOR'
c29817
    VARS[1]='TZ'
c29817
    VARS[2]='TEXTDOMAIN'
c29817
    VARS[3]='TEXTDOMAINDIR'
c29817
    VARS[4]='LANG'
c29817
c29817
    # Define description of environment variables.
c29817
    INFO[0]="`gettext "Default text editor"`"
c29817
    INFO[1]="`gettext "Default time zone representation"`"
c29817
    INFO[2]="`gettext "Default domain used to retrieve translated messages"`"
c29817
    INFO[3]="`gettext "Default directory used to retrive translated messages"`"
c29817
    INFO[4]="`gettext "Default locale information"`"
c29817
c29817
    until [[ $COUNT -eq ${#VARS[*]} ]];do
c29817
4b8e06
        # Let user to reduce output using regular expression as
c29817
        # reference.
558b58
        if [[ ${VARS[$COUNT]} =~ $FLAG_FILTER ]];then
c29817
c29817
            # Output list of environment variables using indirect
c29817
            # expansion (what a beautiful feature!) to output variable
c29817
            # value.
c29817
            cli_printMessage "${INFO[$COUNT]}:"
c29817
            cli_printMessage "${VARS[$COUNT]}=${!VARS[$COUNT]}" 'AsResponseLine'
c29817
c29817
        fi
c29817
c29817
        # Increment counter.
c29817
        COUNT=$(($COUNT + 1))
c29817
c29817
    done
c29817
c29817
}