blob: 6cab0bf92c338a922fadc13705fa2293264be9a8 [file] [log] [blame]
khenaidoofdbad6e2018-11-06 22:26:38 -05001#!/bin/bash
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16while getopts LGC:g:s: option
17do
18 case "${option}"
19 in
20 L) LOOKUP_OPT="-L";;
21 G) GLOBAL_REQUEST_OPT="-G";;
22 C) CONSUL_OPT="-C ${OPTARG}";;
23 g) GRPC_OPT="-g ${OPTARG}";;
24 s) SIM_OPT="-s ${OPTARG}";;
25 esac
26done
27
28if [ -z "$CONSUL_OPT" ]
29then
30 CONSUL_OPT="-C $DOCKER_HOST_IP:8500"
31fi
32
33echo "export DOCKER_HOST_IP=$DOCKER_HOST_IP" > /home/voltha/.bashrc
34echo "export PYTHONPATH=/voltha" >> /home/voltha/.bashrc
35echo "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" >> /home/voltha/.bashrc
36echo "export DOCKER_HOST_IP=$DOCKER_HOST_IP" > /home/voltha/.bash_profile
37echo "export PYTHONPATH=/voltha" >> /home/voltha/.bash_profile
38echo "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" >> /home/voltha/.bash_profile
39echo "/voltha/python/cli/main.py $LOOKUP_OPT $GLOBAL_REQUEST_OPT $CONSUL_OPT $GRPC_OPT $SIM_OPT" >> /home/voltha/.bash_profile
40echo "logout" >> /home/voltha/.bash_profile
41chown voltha.voltha /home/voltha/.bash_profile
42/usr/sbin/sshd -D
43