blob: 56c44c277e945282ca0adf70f6a8e5dcfe20abd1 [file] [log] [blame]
Sergio Slobodrianab11c642017-04-24 07:16:58 -04001#!/bin/bash
Zack Williams41513bf2018-07-07 20:08:35 -07002# 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.
Richard Jankowski29dd1982017-06-28 13:30:18 -040015
khenaidoo108f05c2017-07-06 11:15:29 -040016while getopts LGC:g:s: option
Richard Jankowski29dd1982017-06-28 13:30:18 -040017do
18 case "${option}"
19 in
20 L) LOOKUP_OPT="-L";;
khenaidoo108f05c2017-07-06 11:15:29 -040021 G) GLOBAL_REQUEST_OPT="-G";;
Richard Jankowski29dd1982017-06-28 13:30:18 -040022 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
Sergio Slobodrianab11c642017-04-24 07:16:58 -040033echo "export DOCKER_HOST_IP=$DOCKER_HOST_IP" > /home/voltha/.bashrc
34echo "export PYTHONPATH=/cli" >> /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=/cli" >> /home/voltha/.bash_profile
38echo "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" >> /home/voltha/.bash_profile
khenaidoo108f05c2017-07-06 11:15:29 -040039echo "/cli/cli/main.py $LOOKUP_OPT $GLOBAL_REQUEST_OPT $CONSUL_OPT $GRPC_OPT $SIM_OPT" >> /home/voltha/.bash_profile
Sergio Slobodrianab11c642017-04-24 07:16:58 -040040echo "logout" >> /home/voltha/.bash_profile
41chown voltha.voltha /home/voltha/.bash_profile
42/usr/sbin/sshd -D
43