view fetch_databases.sh @ 0:f6ebec6e235e draft

Uploaded
author petrn
date Thu, 19 Dec 2019 13:46:43 +0000
parents
children
line wrap: on
line source

#!/bin/bash
#set -euo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "protein databases necessary for full clustering analysis"
echo "are downloaded from bitbucket repository using git"
echo ""
cd $DIR
git clone https://bitbucket.org/petrnovak/re_databases.git 2> $DIR/.fetchdb.log 
GITEXIT=$?
if [ $GITEXIT -eq "0" ]
then
    echo "databases successfully downloaded"
    ln -sf $DIR/re_databases/* $DIR/databases/
fi
# cat $DIR/.fetchdb.log
if [ $GITEXIT -eq "128" ]
then
    if grep -q -F "Authentication failed" $DIR/.fetchdb.log
    then
        echo "get login credential from (neumann at umbr.cas.cz)!"
    fi
    if grep -q -F "already exist" $DIR/.fetchdb.log
    then
        echo "repository alredy exists, updating..."
        cd $DIR/re_databases
        git pull && ln -f -s $DIR/re_databases/* $DIR/databases/ && find . -type f -exec touch {} +
    fi

fi