| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function cli_checkRepoDirSource { |
| |
| |
| |
| |
| |
| local LOCATION=$1 |
| |
| |
| |
| |
| if [[ "$LOCATION" == '' ]];then |
| cli_printMessage "`gettext "The first positional parameter is required."`" --as-error-line |
| fi |
| |
| |
| |
| cli_checkPathComponent $LOCATION |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| if [[ $LOCATION =~ '^(trunk|branches|tags)' ]];then |
| LOCATION=${HOME}/artwork/$LOCATION |
| fi |
| |
| |
| |
| |
| |
| |
| |
| |
| if [[ -d ${LOCATION} ]];then |
| |
| |
| pushd "$LOCATION" > /dev/null |
| |
| |
| if [[ $(pwd) =~ "^${HOME}/artwork" ]];then |
| |
| LOCATION=$(pwd) |
| else |
| cli_printMessage "`eval_gettext "The location \\\"\\\$LOCATION\\\" is not valid."`" --as-error-line |
| fi |
| |
| # Remove directory from the directory stack. |
| popd > /dev/null |
| |
| elif [[ -f ${LOCATION} ]];then |
| |
| # Add directory to the top of the directory stack. |
| pushd "$(dirname "$LOCATION")" > /dev/null |
| |
| # Check directory existence inside the repository. |
| if [[ $(pwd) =~ "^${HOME}/artwork" ]];then |
| # Re-define source value using absolute path. |
| LOCATION=$(pwd)/$(basename "$LOCATION") |
| else |
| cli_printMessage "`eval_gettext "The location \\\"\\\$LOCATION\\\" is not valid."`" --as-error-line |
| fi |
| |
| # Remove directory from the directory stack. |
| popd > /dev/null |
| |
| fi |
| |
| # Output sanitated location. |
| echo $LOCATION |
| |
| } |
| |