-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartHeimdall.sh
More file actions
55 lines (39 loc) · 1.74 KB
/
startHeimdall.sh
File metadata and controls
55 lines (39 loc) · 1.74 KB
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
#! /bin/sh
if [ `whoami` != root ]; then
echo Please run this script as root or using sudo
exit
fi
# Stop/Disable Bluetooth (not needed)
systemctl stop bluetooth.service
systemctl disable bluetooth.service
service bluetooth status
# Go to heimdall location
cd /home/heimdall/Desktop/heimdall
# Read config
export `cat env.vars`
echo $WIFI_DEVICE_ID
echo $WIFI_SSID
echo $WIFI_PASSWORD
# Setup WiFi
echo "___________"
echo "Setup Wifi - Using Device: $WIFI_DEVICE_ID"
# Get List of Network Devices:
# nmcli device
# nmcli device wifi
nmcli device wifi hotspot ifname "$WIFI_DEVICE_ID" con-name "$WIFI_SSID" ssid "$WIFI_SSID" band bg password "$WIFI_PASSWORD"
# nmcli device wifi connect <ssid> password <password> ifname 'wlp2s0'
# Set IP-Adress
echo "\r\n___________\r\nSet IP Address"
ifconfig "$WIFI_DEVICE_ID" 192.168.1.177 netmask 255.255.255.0
echo "\r\n___________\r\nRestart DHCP-Server"
service isc-dhcp-server restart
echo "\r\n___________\r\nWorkaround for annoying Docker bug.. network is not binding properly.. therefore we need to recreate it.. but first.. remove containers that depend on the network"
docker-compose stop heimdall-proxy mqtt-broker heimdall-camera-proxy
docker-compose rm -f heimdall-proxy mqtt-broker heimdall-camera-proxy
echo "\r\n___________\r\nRecreating bridge network for camera"
# Since the default network bridge network create by docker does not have a proper IPv4 Binding, the camera can't access it via the Hotspot
docker network ls --no-trunc
docker network rm bridge-iot
docker network create -o "com.docker.network.bridge.host_binding_ipv4"="192.168.1.177" bridge-iot
echo "\r\n___________\r\nStarting docker container.."
docker-compose up heimdall-backend heimdall-frontend heimdall-proxy heimdall-camera-proxy