|
|
328582 |
#!/bin/bash
|
|
|
328582 |
#
|
|
|
328582 |
# cli_checkRepoDirTarget.sh -- This function provides input validation
|
|
|
328582 |
# to repository entries considered as target location.
|
|
|
328582 |
#
|
|
|
69a93e |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
fa95b1 |
#
|
|
|
fa95b1 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa95b1 |
# it under the terms of the GNU General Public License as published by
|
|
|
fa95b1 |
# the Free Software Foundation; either version 2 of the License, or
|
|
|
fa95b1 |
# (at your option) any later version.
|
|
|
fa95b1 |
#
|
|
|
328582 |
# This program is distributed in the hope that it will be useful, but
|
|
|
328582 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
328582 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
328582 |
# General Public License for more details.
|
|
|
328582 |
#
|
|
|
328582 |
# You should have received a copy of the GNU General Public License
|
|
|
328582 |
# along with this program; if not, write to the Free Software
|
|
|
328582 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
328582 |
# USA.
|
|
|
328582 |
# ----------------------------------------------------------------------
|
|
|
571f97 |
# $Id$
|
|
|
328582 |
# ----------------------------------------------------------------------
|
|
|
328582 |
|
|
|
328582 |
function cli_checkRepoDirTarget {
|
|
|
328582 |
|
|
|
0c579a |
local LOCATION="$1"
|
|
|
328582 |
|
|
|
328582 |
# Redefine target value to build repository absolute path from
|
|
|
328582 |
# repository top level on. As we are removing
|
|
|
328582 |
# /home/centos/artwork/ from all centos-art.sh output (in order to
|
|
|
328582 |
# save horizontal output space), we need to be sure that all
|
|
|
328582 |
# strings begining with trunk/..., branches/..., and tags/... use
|
|
|
328582 |
# the correct absolute path. That is, you can refer trunk's
|
|
|
328582 |
# entries using both /home/centos/artwork/trunk/... or just
|
|
|
328582 |
# trunk/..., the /home/centos/artwork/ part is automatically added
|
|
|
328582 |
# here.
|
|
|
0c579a |
if [[ $LOCATION =~ '^(trunk|branches|tags)/.+$' ]];then
|
|
|
0c579a |
LOCATION=${HOME}/artwork/$LOCATION
|
|
|
328582 |
fi
|
|
|
328582 |
|
|
|
0c579a |
# Print target location.
|
|
|
0c579a |
echo $LOCATION
|
|
|
328582 |
|
|
|
328582 |
}
|