|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# initFunctions.sh -- Initializes functions and sets environment
|
|
|
4c79b5 |
# variables used by centos-art.sh scripts.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# Copyright (C) 2009-2010 Alain Reguera Delgado
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# This program is free software; you can redistribute it and/or modify
|
|
|
4c79b5 |
# it under the terms of the GNU General Public License as published by
|
|
|
4c79b5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
|
4c79b5 |
# (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 |
|
|
|
4c79b5 |
# Initizalize gettext internazionalization.
|
|
|
4c79b5 |
. gettext.sh
|
|
|
4c79b5 |
export TEXTDOMAIN=centos-art.sh
|
|
|
4c79b5 |
export TEXTDOMAINDIR=/home/centos/artwork/trunk/Scripts/Bash/Locale
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Initialize centos-art.sh script functions.
|
|
|
4c79b5 |
FILES=$(ls /home/centos/artwork/trunk/Scripts/Bash/Functions/{cli,cli_*}.sh)
|
|
|
4c79b5 |
MISSINGFILES=''
|
|
|
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
|
|
|
4c79b5 |
MISSINGFILES="$FILE $MISSINGFILES"
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
done
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if [[ $MISSINGFILES != '' ]];then
|
|
|
4c79b5 |
for FILE in $MISSINGFILES;do
|
|
|
4c79b5 |
echo `gettext "The $FILE needs to have execution rights."`
|
|
|
4c79b5 |
done
|
|
|
4c79b5 |
exit
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Unset all except gettext's initialization variables in order to
|
|
|
4c79b5 |
# start cli execution with a clean environment. Only gettext's
|
|
|
4c79b5 |
# initialization variables are required to pass.
|
|
|
4c79b5 |
unset FILE
|
|
|
4c79b5 |
unset FILES
|
|
|
4c79b5 |
unset MISSINGFILES
|
|
|
4c79b5 |
unset FUNCTION
|