Skip to content

Commit 1636c28

Browse files
update
Trying a few things including using sudo.
1 parent bf7f665 commit 1636c28

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

Tools/CI/run_cmb_service.sh

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff 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

6575
echo "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
6983
echo "Installing protocol bufffer compiler..."
7084
apt-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
7390
export PROTOC="/usr/bin/protoc"
91+
fi
7492
echo "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
77108
export PATH="$PROTOC:$PATH"
78109
echo "\n Set PATH = $PATH"

0 commit comments

Comments
 (0)