Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / vagrantSandbox / initGeneralScript.sh
blob9b9c46a3c9260f887155469cee51b66dcee02cfb
1 #! /usr/bin/env bash
3 echo
4 echo "Copying stuff from skeleton"
5 echo
6 for f in $(ls -A /vagrant/skel)
7 do
8 target="/home/vagrant/$f"
9 if [ -e $target ]
10 then
11 echo "$target already there"
12 else
13 echo "Copying $target from skeleton"
14 cp -r "/vagrant/skel/$f" $target
15 chown -R vagrant:vagrant $target
17 done
19 OFDIR=/home/vagrant/foam/
21 # make sure that a symbolic link is not erased
22 if [ ! -e $OFDIR ]; then
23 echo "Making directory $OFDIR"
24 mkdir -vp $OFDIR
27 chown -R vagrant:vagrant $OFDIR
29 # for distros that don't have group vagrant
30 chown -R vagrant $OFDIR
32 OFClone=$OFDIR/foam-extend-3.2
33 OFReference=$OFClone-parent
35 OFParent=/FOAM-sources
37 if [ ! -e $OFClone ]
38 then
39 echo
40 echo "Cloning the OF-sources"
41 echo
42 if [ -e "$OFParent/.git" ]
43 then
44 echo
45 echo "Parent is git"
46 echo "Cloning. This may take some time"
47 echo
49 # su -c not correctly working on FreeBSD
50 su - vagrant -c "git clone $OFParent $OFClone"
52 echo
53 echo "Git cloned: TODO: set same branch as parent"
54 echo
55 elif [ -e "$OFParent/.hg" ]
56 then
57 echo
58 echo "Parent is mercurial. Hello Bernhard"
59 echo
60 # branchName=`hg branch -R $OFParent`
61 idName=`hg id -i -R $OFParent | sed -e "s/\+//"`
62 # sed removes + in case of a 'tainted' parent
64 echo "Parent is on id $idName"
65 echo "Cloning. This may take some time"
66 su - vagrant -c "hg clone -u $idName $OFParent $OFClone"
67 echo
68 else
69 echo
70 echo "Problem. Parent $OFParent is neither git nor mercurial"
71 echo
73 else
74 echo "Repository $OFClone already there. No cloning"
77 if [ ! -e $OFReference ]
78 then
79 echo
80 echo "Linking $OFReference to $OFParent"
81 echo
82 ln -s $OFParent $OFReference
83 else
84 echo
85 echo "Link $OFReference already there"
86 echo
89 chown -R vagrant:vagrant $OFDIR
91 echo
92 echo "Current ccache:"
93 export CCACHE_DIR=/vagrant/ccache4vm; ccache --show-stats