|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
37881a |
# cli_checkRepoDirSource.sh -- This function provides input validation
|
|
|
37881a |
# to repository entries considered as source locations.
|
|
|
4c79b5 |
#
|
|
|
c9be1c |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
4c79b5 |
#
|
|
|
7cd8e9 |
# This program is free software; you can redistribute it and/or
|
|
|
7cd8e9 |
|
|
|
7cd8e9 |
|
|
|
7cd8e9 |
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
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 |
# ----------------------------------------------------------------------
|
|
|
418249 |
# $Id$
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
37881a |
function cli_checkRepoDirSource {
|
|
|
55d653 |
|
|
|
69462e |
|
|
|
69462e |
|
|
|
69462e |
cli_checkPathComponent "$ACTIONVAL" '--default'
|
|
|
4c79b5 |
|
|
|
37881a |
|
|
|
a58b61 |
|
|
|
a58b61 |
# /home/centos/artwork/ from all centos-art.sh output (in order to
|
|
|
a58b61 |
|
|
|
a58b61 |
|
|
|
a58b61 |
|
|
|
a58b61 |
|
|
|
a58b61 |
|
|
|
a58b61 |
|
|
|
a58b61 |
if [[ $ACTIONVAL =~ '^(trunk|branches|tags)' ]];then
|
|
|
a58b61 |
ACTIONVAL=/home/centos/artwork/$ACTIONVAL
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
37881a |
# Re-define source value to build repository absolute path from
|
|
|
a58b61 |
|
|
|
37881a |
|
|
|
37881a |
|
|
|
37881a |
|
|
|
a58b61 |
|
|
|
a58b61 |
|
|
|
a58b61 |
if [[ -d ${ACTIONVAL} ]];then
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
a58b61 |
pushd "$ACTIONVAL" > /dev/null
|
|
|
4c79b5 |
|
|
|
a58b61 |
|
|
|
23c7a5 |
if [[ $(pwd) =~ '^/home/centos/artwork' ]];then
|
|
|
37881a |
# Re-define source value using absolute path.
|
|
|
a58b61 |
ACTIONVAL=$(pwd)
|
|
|
a58b61 |
else
|
|
|
55d653 |
cli_printMessage "`eval_gettext "The location \\\`\\\$ACTIONVAL' is not valid."`" 'AsErrorLine'
|
|
|
02e00f |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
a58b61 |
fi
|
|
|
a58b61 |
|
|
|
a58b61 |
|
|
|
a58b61 |
popd > /dev/null
|
|
|
a58b61 |
|
|
|
a58b61 |
elif [[ -f ${ACTIONVAL} ]];then
|
|
|
a58b61 |
|
|
|
a58b61 |
|
|
|
67b9ac |
pushd "$(dirname "$ACTIONVAL")" > /dev/null
|
|
|
a58b61 |
|
|
|
a58b61 |
|
|
|
23c7a5 |
if [[ $(pwd) =~ '^/home/centos/artwork' ]];then
|
|
|
37881a |
# Re-define source value using absolute path.
|
|
|
67b9ac |
ACTIONVAL=$(pwd)/$(basename "$ACTIONVAL")
|
|
|
a58b61 |
else
|
|
|
55d653 |
cli_printMessage "`eval_gettext "The location \\\`\\\$ACTIONVAL' is not valid."`" 'AsErrorLine'
|
|
|
02e00f |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
a58b61 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
popd > /dev/null
|
|
|
4c79b5 |
|
|
|
37881a |
else
|
|
|
37881a |
|
|
|
37881a |
|
|
|
37881a |
|
|
|
37881a |
|
|
|
37881a |
|
|
|
55d653 |
cli_printMessage "`eval_gettext "The location \\\`\\\$ACTIONVAL' is not valid."`" 'AsErrorLine'
|
|
|
37881a |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
37881a |
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|