-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathset_env_vars.sh
executable file
·60 lines (51 loc) · 1.65 KB
/
set_env_vars.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
### This script will set up the envs based on passed in BALENA
## PLATFORM is set via the dockerfile
PLATFORM="${PLATFORM}"
### FROM get_platform_info.sh
# Defaults
SERIAL_NUMBER="${RESIN_DEVICE_NAME_AT_INIT}"
WIFI_ACCESS_POINT=unknown
IS_WIFI_ENABLED=false
IS_I2C_ENABLED=false
IS_USB_I2C_ENABLED=false
DEFAULT_I2C_BUS=none
DEFAULT_MUX_ADDRESS=0x77
# This matches all raspberry pis
if [[ ($PLATFORM == "raspberry-pi"*) || ($PLATFORM == "raspberrypi"*) || ($PLATFORM == "fin"*) ]]; then
IS_WIFI_ENABLED=true
IS_I2C_ENABLED=true
DEFAULT_I2C_BUS=1
IS_USB_I2C_ENABLED=false
fi
# Beagle Bone Black
if [[ $PLATFORM == "beaglebone-black"* ]]; then
IS_WIFI_ENABLED=true
IS_I2C_ENABLED=true
DEFAULT_I2C_BUS=2
IS_USB_I2C_ENABLED=false
fi
# Export platform information
export PLATFORM=$PLATFORM
export SERIAL_NUMBER=$SERIAL_NUMBER
export WIFI_ACCESS_POINT=$WIFI_ACCESS_POINT
export REMOTE_DEVICE_UI_URL=$REMOTE_DEVICE_UI_URL
export IS_WIFI_ENABLED=$IS_WIFI_ENABLED
export IS_I2C_ENABLED=$IS_I2C_ENABLED
export IS_USB_I2C_ENABLED=$IS_USB_I2C_ENABLED
export DEFAULT_I2C_BUS=$DEFAULT_I2C_BUS
export DEFAULT_MUX_ADDRESS=$DEFAULT_MUX_ADDRESS
# Show platform information
printf "\nGetting platform info...\n\n"
echo PLATFORM: $PLATFORM
echo SERIAL_NUMBER: $SERIAL_NUMBER
echo WIFI_ACCESS_POINT: $WIFI_ACCESS_POINT
echo REMOTE_DEVICE_UI_URL: $REMOTE_DEVICE_UI_URL
echo IS_WIFI_ENABLED: $IS_WIFI_ENABLED
echo IS_I2C_ENABLED: $IS_I2C_ENABLED
echo IS_USB_I2C_ENABLED: $IS_USB_I2C_ENABLED
echo DEFAULT_I2C_BUS: $DEFAULT_I2C_BUS
echo DEFAULT_MUX_ADDRESS: $DEFAULT_MUX_ADDRESS
echo ""
### From get_network_settings.sh
export LD_LIBRARY_PATH=/usr/local/lib