#! /bin/bash
echo
echo "Copying stuff from skeleton"
for f in $(ls -A /vagrant/skel)
do
target="/home/vagrant/$f"
if [ -e $target ]
then
echo "$target already there"
else
echo "Copying $target from skeleton"
cp -r "/vagrant/skel/$f" $target
fi
done
OFDIR=/home/vagrant/OpenFOAM/
mkdir -vp $OFDIR
chown -R vagrant:vagrant $OFDIR
OFClone=$OFDIR/OpenFOAM-1.6-ext
OFReference=$OFDIR/OpenFOAM-1.6-ext-parent
OFParent=/OpenFOAM-sources
if [ ! -e $OFClone ]
echo "Cloning the OF-sources"
if [ -e "$OFParent/.git" ]
echo "Parent is git"
su vagrant - -c "git clone $OFParent $OFClone"
echo "Git cloned: TODO: set same branch as parent"
elif [ -e "$OFParent/.hg" ]
echo "Parent is mercurial. Hello Bernhard"
branchName=`hg branch -R $OFParent`
echo "Parent is on branch $branchName"
su vagrant - -c "hg clone -r $branchName $OFParent $OFClone"
echo "Problem. Parent $OFParent is neither git nor mercurial"
echo "Repository $OFClone already there. No cloning"
if [ ! -e $OFReference ]
echo "Linking $OFReference to $OFParent"
ln -s $OFParent $OFReference
echo "Link $OFReference already there"
echo "Current ccache:"
export CCACHE_DIR=/vagrant/ccache4vm; ccache --show-stats