1010# Install dependencies
1111apt-get install -y curl git
1212
13- # Capture the working directory
14- DIR =$( pwd )
13+ # Capture the top directory
14+ TOP_DIR =$( dirname $( readlink -f $0 ) )
1515
1616# Add apt repositories for NodeJS and Yarn
1717curl -sL https://deb.nodesource.com/setup_12.x | bash -
@@ -21,10 +21,6 @@ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.lis
2121# Install NodeJS and Yarn
2222apt-get update && apt-get install -y nodejs yarn
2323
24- # Create and cd into the directory required to run the provision_node script
25- mkdir -p /home/vagrant
26- cd /home/vagrant
27-
2824# Provision a Node
2925#! /usr/bin/env bash
3026
@@ -48,32 +44,30 @@ apt-get install -y python3 python3-pip python3-mock dh-python \
4844 python-setuptools python-all python3-setuptools python3-stdeb \
4945 python-is-python3
5046
51- git clone https://github.com/bbc/nmos-common.git
52- git clone https://github.com/bbc/nmos-reverse-proxy.git
53- git clone https://github.com/bbc/nmos-node.git
54- git clone https://github.com/bbc/nmos-mdns-bridge.git
47+ git submodule update --init
48+ NMOS_DEP_DIR=${TOP_DIR} /nmos-dep
5549
56- cd /home/vagrant /nmos-common
50+ cd ${NMOS_DEP_DIR} /nmos-common
5751pip3 install -e .
5852install -m 666 /dev/null /var/log/nmos.log
5953
60- cd /home/vagrant /nmos-reverse-proxy
54+ cd ${NMOS_DEP_DIR} /nmos-reverse-proxy
6155sed -i " s/, python3-nmoscommon//" stdeb.cfg
6256make dsc
6357mk-build-deps --install deb_dist/nmosreverseproxy_* .dsc --tool " $APT_TOOL "
6458make deb
6559dpkg -i dist/python3-nmosreverseproxy_* _all.deb
6660apt-get -f -y install
6761
68- cd /home/vagrant /nmos-mdns-bridge
62+ cd ${NMOS_DEP_DIR} /nmos-mdns-bridge
6963sed -i " s/, python3-nmoscommon//" stdeb.cfg
7064make dsc
7165mk-build-deps --install deb_dist/mdnsbridge_* .dsc --tool " $APT_TOOL "
7266make deb
7367dpkg -i dist/python3-mdnsbridge_* _all.deb
7468apt-get -f -y install
7569
76- cd /home/vagrant /nmos-node
70+ cd ${NMOS_DEP_DIR} /nmos-node
7771sed -i " s/, python3-nmoscommon//" stdeb.cfg
7872make dsc
7973mk-build-deps --install deb_dist/nodefacade_* .dsc --tool " $APT_TOOL "
@@ -84,4 +78,4 @@ apt-get -f -y install
8478service apache2 restart
8579
8680# Move back to the starting directory
87- cd $DIR
81+ cd $TOP_DIR
0 commit comments