summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <florin.coras@gmail.com>2016-06-15 18:17:55 +0000
committerGerrit Code Review <gerrit@fd.io>2016-06-15 18:17:55 +0000
commit5edd501a09021d7225a275783f82d1c0879054ed (patch)
tree5adf3653be172514592090566b02fa72ad3653e5
parent9b9b4ff50703cd969842bb8c5f869a38edf2ea18 (diff)
parent40841eaf9aa969c275a900f05ad2352d75e6aab4 (diff)
Merge "Minor additions to setup script."
-rwxr-xr-xtutorial/setup_lisp_topo.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/tutorial/setup_lisp_topo.sh b/tutorial/setup_lisp_topo.sh
index d349e8d..872ccd8 100755
--- a/tutorial/setup_lisp_topo.sh
+++ b/tutorial/setup_lisp_topo.sh
@@ -1,5 +1,19 @@
+#!/usr/bin/env bash
+
+if [ $USER != "root" ] ; then
+ echo "Restarting script with sudo..."
+ sudo $0 ${*}
+ exit
+fi
+
+
+SRC=${1:-/vpp}
+[ $# -eq 0 ] && { echo "(using default vpp src $SRC. This can be passed as parameter to script)"; }
+
# path to vpp executable and configurations folder
-VPP_LITE_BIN=/vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp
+[ -f $SRC/build-root/install-vpp_lite_debug-native/vpp/bin/vpp ] || { echo "VPP lite not found, build it by 'cd $SRC; PLATFORM=vpp_lite make build'"; exit 1; }
+
+VPP_LITE_BIN=$SRC/build-root/install-vpp_lite_debug-native/vpp/bin/vpp
VPP_LITE_CONF=/etc/vpp/lite/
# make sure there are no vpp instances running