-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitGeneralScript.sh
executable file
·93 lines (79 loc) · 1.99 KB
/
initGeneralScript.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#! /usr/bin/env bash
echo
echo "Copying stuff from skeleton"
echo
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
chown -R vagrant:vagrant $target
fi
done
OFDIR=/home/vagrant/foam/
# make sure that a symbolic link is not erased
if [ ! -e $OFDIR ]; then
echo "Making directory $OFDIR"
mkdir -vp $OFDIR
fi
chown -R vagrant:vagrant $OFDIR
# for distros that don't have group vagrant
chown -R vagrant $OFDIR
OFClone=$OFDIR/foam-extend-3.2
OFReference=$OFClone-parent
OFParent=/FOAM-sources
if [ ! -e $OFClone ]
then
echo
echo "Cloning the OF-sources"
echo
if [ -e "$OFParent/.git" ]
then
echo
echo "Parent is git"
echo "Cloning. This may take some time"
echo
# su -c not correctly working on FreeBSD
su - vagrant -c "git clone $OFParent $OFClone"
echo
echo "Git cloned: TODO: set same branch as parent"
echo
elif [ -e "$OFParent/.hg" ]
then
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
echo "Parent is on id $idName"
echo "Cloning. This may take some time"
su - vagrant -c "hg clone -u $idName $OFParent $OFClone"
echo
else
echo
echo "Problem. Parent $OFParent is neither git nor mercurial"
echo
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