-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinit-client.sh
executable file
·45 lines (33 loc) · 1.58 KB
/
init-client.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#! /bin/bash
############################
# set environment variables for the Skyport2 client
############################
if [[ $_ == $0 ]]; then
echo "Error: please use command \"source ./init-client.sh\""
exit 1
fi
OS=`uname -s`
# setting this to this machines local IP address; for production use, set this to the IP address of your SKYPORT server
#
#if [ ${OS} == "Darwin" ]
#then
# MYIP=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p' | cut -f 1 | head -n 1)
#else
# # draft of a smarter ip detection method:
# # for i in $(ifconfig -a | cut -d ' ' -f 1 | cut -d $'\t' -f 1 | grep -Ev "^$" | grep -v "^veth\|^lo\|^docker\|^br" | cut -d : -f 1) ; do ifconfig $i ; done | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'
# MYIP=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
# if [ -z ${MYIP} ]
# then
# MYIP=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p' | cut -f 1 | head -n 1)
# fi
#fi
MYIP=$(for i in $(ifconfig -a | cut -d ' ' -f 1 | cut -d $'\t' -f 1 | grep -Ev "^$" | grep -v "^veth\|^lo\|^docker\|^br" | cut -d : -f 1) ; do ifconfig $i ; done | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
export SKYPORT_HOST=${MYIP}
export SKYPORT_TMPDIR=`pwd`/tmp
mkdir -p ${SKYPORT_TMPDIR}
# now set some variables for the building blocks
export AWE_SERVER=http://${SKYPORT_HOST}:8001/awe/api/
export SHOCK_SERVER=http://${SKYPORT_HOST}:8001/shock/api/
echo SKYPORT_HOST=${SKYPORT_HOST}
echo AWE_SERVER =${AWE_SERVER}
echo SHOCK_SERVER=${SHOCK_SERVER}