File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,19 +60,50 @@ echo "Starting with echo server on port: $echo_port and the cmb service on port:
6060
6161# Setup -------------------------------------------------------------------------
6262
63+ try () {
64+ export ThrewError = false
65+ " $@ " || throw
66+ }
67+
68+ throw () {
69+ echo " An error occurred in: $BASH_COMMAND "
70+ export ThrewError = true
71+ }
72+
6373# Protocol Buffer Compiler ------------------------------------------------------
6474
6575echo " Updating modules..."
66- apt-get update
76+ sudo apt-get update
6777
6878# Install Protocol Buffer Compiler (using apt-get)
79+ echo " (sudo) Installing protocol bufffer compiler..."
80+ try sudo apt-get install -y protobuf-compiler
81+
82+ if $ThrewError ; then
6983echo " Installing protocol bufffer compiler..."
7084apt-get install -y protobuf-compiler
85+ fi
7186
7287# Add the PROTOC environment variable for Protocol Buffer Compiler
88+ try sudo export PROTOC=" /usr/bin/protoc"
89+ if $ThrewError ; then
7390export PROTOC=" /usr/bin/protoc"
91+ fi
7492echo " Set PROTOC = $PROTOC "
7593
94+ try $PROTOC /protoc --version
95+
96+ if $ThrewError ; then
97+ export PROTOC=which protoc
98+ try $PROTOC /protoc --version
99+ if $ThrewError ; then
100+ echo " Failed to properly run protoc!"
101+ exit -1
102+ fi
103+ echo " PROTOC path is: $PROTOC "
104+
105+
106+
76107# Add the Protocol Buffer Compiler install location to the PATH
77108export PATH=" $PROTOC :$PATH "
78109echo " \n Set PATH = $PATH "
You can’t perform that action at this time.
0 commit comments