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

31 lines
783 B
Bash

#!/bin/bash
#
# This script relys on a modified ~/.ssh/config to specify the
# correct identity files to be used with the host aliases
# git.code.sf.net-ibell and git.code.sf.net-jorritw
#
# 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 --mirror $ORIGIN $REPOFOLDER
#pushd $REPOFOLDER
#git remote add sfmirror $MIRROR
#popd
popd
fi
pushd $FOLDER
git fetch --force $ORIGIN
git push --force --mirror $MIRROR
popd
exit 0