#! /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/foam/
mkdir -vp $OFDIR
chown -R vagrant:vagrant $OFDIR
# for distros that don't have group vagrant
chown -R vagrant $OFDIR
OFClone=$OFDIR/foam-extend-3.0
OFReference=$OFClone-parent
OFParent=/FOAM-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`
idName=`hg id -i -R $OFParent | sed -e "s/\+//"`
# sed removes + in case of a 'tainted' parent
echo "Parent is on id $idName"
su vagrant - -c "hg clone -u $idName $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