2014-03-13 17:33:45 +00:00
|
|
|
#! /usr/bin/env bash
|
2013-09-04 13:49:33 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Copying stuff from skeleton"
|
|
|
|
echo
|
|
|
|
for f in $(ls -A /vagrant/skel)
|
|
|
|
do
|
|
|
|
target="/home/vagrant/$f"
|
|
|
|
if [ -e $target ]
|
|
|
|
then
|
2015-05-15 18:07:49 +00:00
|
|
|
echo "$target already there"
|
2013-09-04 13:49:33 +00:00
|
|
|
else
|
2015-05-15 18:07:49 +00:00
|
|
|
echo "Copying $target from skeleton"
|
|
|
|
cp -r "/vagrant/skel/$f" $target
|
2014-11-13 15:52:09 +00:00
|
|
|
chown -R vagrant:vagrant $target
|
2013-09-04 13:49:33 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2013-12-30 16:08:32 +00:00
|
|
|
OFDIR=/home/vagrant/foam/
|
2013-09-04 13:49:33 +00:00
|
|
|
|
2014-11-14 13:33:52 +00:00
|
|
|
# make sure that a symbolic link is not erased
|
|
|
|
if [ ! -e $OFDIR ]; then
|
|
|
|
echo "Making directory $OFDIR"
|
|
|
|
mkdir -vp $OFDIR
|
|
|
|
fi
|
|
|
|
|
2013-09-04 13:49:33 +00:00
|
|
|
chown -R vagrant:vagrant $OFDIR
|
|
|
|
|
2014-02-10 17:03:40 +00:00
|
|
|
# for distros that don't have group vagrant
|
|
|
|
chown -R vagrant $OFDIR
|
|
|
|
|
2014-06-01 22:03:19 +00:00
|
|
|
OFClone=$OFDIR/foam-extend-3.1
|
2013-12-30 16:08:32 +00:00
|
|
|
OFReference=$OFClone-parent
|
2013-09-04 13:49:33 +00:00
|
|
|
|
2013-12-30 16:08:32 +00:00
|
|
|
OFParent=/FOAM-sources
|
2013-09-04 13:49:33 +00:00
|
|
|
|
|
|
|
if [ ! -e $OFClone ]
|
|
|
|
then
|
|
|
|
echo
|
|
|
|
echo "Cloning the OF-sources"
|
|
|
|
echo
|
|
|
|
if [ -e "$OFParent/.git" ]
|
|
|
|
then
|
2015-05-15 18:07:49 +00:00
|
|
|
echo
|
|
|
|
echo "Parent is git"
|
|
|
|
echo "Cloning. This may take some time"
|
|
|
|
echo
|
2014-03-13 16:52:52 +00:00
|
|
|
|
2015-05-15 18:07:49 +00:00
|
|
|
# su -c not correctly working on FreeBSD
|
|
|
|
su - vagrant -c "git clone $OFParent $OFClone"
|
2014-03-13 16:52:52 +00:00
|
|
|
|
2015-05-15 18:07:49 +00:00
|
|
|
echo
|
|
|
|
echo "Git cloned: TODO: set same branch as parent"
|
|
|
|
echo
|
2013-09-04 13:49:33 +00:00
|
|
|
elif [ -e "$OFParent/.hg" ]
|
|
|
|
then
|
2015-05-15 18:07:49 +00:00
|
|
|
echo
|
|
|
|
echo "Parent is mercurial. Hello Bernhard"
|
|
|
|
echo
|
|
|
|
# branchName=`hg branch -R $OFParent`
|
|
|
|
idName=`hg id -i -R $OFParent | sed -e "s/\+//"`
|
|
|
|
# sed removes + in case of a 'tainted' parent
|
2013-09-04 14:17:39 +00:00
|
|
|
|
2015-05-15 18:07:49 +00:00
|
|
|
echo "Parent is on id $idName"
|
|
|
|
echo "Cloning. This may take some time"
|
|
|
|
su - vagrant -c "hg clone -u $idName $OFParent $OFClone"
|
|
|
|
echo
|
2013-09-04 13:49:33 +00:00
|
|
|
else
|
2015-05-15 18:07:49 +00:00
|
|
|
echo
|
|
|
|
echo "Problem. Parent $OFParent is neither git nor mercurial"
|
|
|
|
echo
|
2013-09-04 13:49:33 +00:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Repository $OFClone already there. No cloning"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -e $OFReference ]
|
|
|
|
then
|
|
|
|
echo
|
|
|
|
echo "Linking $OFReference to $OFParent"
|
|
|
|
echo
|
|
|
|
ln -s $OFParent $OFReference
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
echo "Link $OFReference already there"
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
|
|
|
|
chown -R vagrant:vagrant $OFDIR
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Current ccache:"
|
|
|
|
export CCACHE_DIR=/vagrant/ccache4vm; ccache --show-stats
|