Files
CoolProp/dev/scripts/gitMirror.bsh
2014-12-08 10:28:57 +01:00

27 lines
595 B
Bash

#!/bin/bash
#
# Work around for Cron:
USER=coolprop
source /home/$USER/.bash_profile
#
FOLDER="/home/$USER/src/CoolProp.git"
ORIGIN="https://github.com/CoolProp/CoolProp.git"
MIRROR="ssh://git.code.sf.net-jorritw/p/coolprop/git"
#
if [ ! -d $FOLDER ]; then # repo does not exist, clone it
BASEFOLDER=${FOLDER%/*}
REPOFOLDER=${FOLDER##*/}
mkdir -p $BASEFOLDER
pushd $BASEFOLDER
git clone --bare $ORIGIN $REPOFOLDER
#pushd $REPOFOLDER
#git remote add sfmirror $MIRROR
#popd
popd
fi
pushd $FOLDER
git fetch $ORIGIN
git push --force --mirror $MIRROR
popd
exit 0