Factor out general stuff into a separate script to allow scripts for different distros
--HG-- branch : bgschaid/feature/vagrantSandboxBranch rename : vagrantSandbox/initUbunutuScript.sh => vagrantSandbox/initGeneralScript.sh
This commit is contained in:
parent
56712ce212
commit
6aa988de47
2 changed files with 79 additions and 72 deletions
77
vagrantSandbox/initGeneralScript.sh
Executable file
77
vagrantSandbox/initGeneralScript.sh
Executable file
|
@ -0,0 +1,77 @@
|
||||||
|
#! /bin/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
|
||||||
|
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 ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "Cloning the OF-sources"
|
||||||
|
echo
|
||||||
|
if [ -e "$OFParent/.git" ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "Parent is git"
|
||||||
|
echo
|
||||||
|
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
|
||||||
|
su vagrant - -c "hg clone $OFParent $OFClone"
|
||||||
|
branchName=`hg branch -R $OFParent`
|
||||||
|
echo
|
||||||
|
echo "Parent is on branch $branchName"
|
||||||
|
su vagrant - -c "hg update -R $OFClone $branchName"
|
||||||
|
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
|
|
@ -64,80 +64,10 @@ apt-get -y install debhelper devscripts cdbs
|
||||||
apt-get -y install emacs
|
apt-get -y install emacs
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Copying stuff from skeleton"
|
echo "Ubuntu-specific ended. Now doing general stuff"
|
||||||
echo
|
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
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
OFDIR=/home/vagrant/OpenFOAM/
|
/vagrant/initGeneralScript.sh
|
||||||
|
|
||||||
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 ]
|
|
||||||
then
|
|
||||||
echo
|
|
||||||
echo "Cloning the OF-sources"
|
|
||||||
echo
|
|
||||||
if [ -e "$OFParent/.git" ]
|
|
||||||
then
|
|
||||||
echo
|
|
||||||
echo "Parent is git"
|
|
||||||
echo
|
|
||||||
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
|
|
||||||
su vagrant - -c "hg clone $OFParent $OFClone"
|
|
||||||
branchName=`hg branch -R $OFParent`
|
|
||||||
echo
|
|
||||||
echo "Parent is on branch $branchName"
|
|
||||||
su vagrant - -c "hg update -R $OFClone $branchName"
|
|
||||||
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
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Ended"
|
echo "Ended"
|
||||||
|
|
Reference in a new issue