Blame Scripts/Bash/initEnvironment.sh

4c79b5
#!/bin/bash
4c79b5
#
59b678
# initFunctions.sh -- Initializes environment variables and functions
59b678
# used by centos-art.sh scripts.
4c79b5
#
72c8a5
# Copyright (C) 2009-2011  Alain Reguera Delgado
4c79b5
# 
72c8a5
# This program is free software; you can redistribute it and/or
72c8a5
# modify it under the terms of the GNU General Public License as
72c8a5
# published by the Free Software Foundation; either version 2 of the
72c8a5
# License, or (at your option) any later version.
4c79b5
# 
4c79b5
# This program is distributed in the hope that it will be useful, but
4c79b5
# WITHOUT ANY WARRANTY; without even the implied warranty of
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c79b5
# General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with this program; if not, write to the Free Software
4c79b5
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4c79b5
# USA.
4c79b5
# 
4c79b5
# ----------------------------------------------------------------------
4c79b5
# $Id: initFunctions.sh 80 2010-09-18 06:57:26Z al $
4c79b5
# ----------------------------------------------------------------------
4c79b5
59b678
# Initizalize centos-art.sh gettext internazionalization.
4c79b5
. gettext.sh
4c79b5
export TEXTDOMAIN=centos-art.sh
4c79b5
export TEXTDOMAINDIR=/home/centos/artwork/trunk/Scripts/Bash/Locale
4c79b5
f8803c
# Initialize centos-art.sh personal information.
f8803c
export CLINAME='centos-art'
f8803c
59b678
# Initialize centos-art.sh function scripts.
4c79b5
FILES=$(ls /home/centos/artwork/trunk/Scripts/Bash/Functions/{cli,cli_*}.sh)
4c79b5
for FILE in $FILES;do
4c79b5
    if [[ -x $FILE ]];then
4c79b5
        . $FILE
4c79b5
        FUNCTION=$(grep '^function ' $FILE | cut -d' ' -f2)
4c79b5
        export -f $FUNCTION
4c79b5
    else
59b678
        echo `gettext "The $FILE needs to have execution rights."`
59b678
        exit
4c79b5
    fi
4c79b5
done
4c79b5
59b678
# Unset all variables not considered global in order to start cli
59b678
# execution with a clean environment.
4c79b5
unset FILE
4c79b5
unset FILES
4c79b5
unset FUNCTION