Skip to content
Snippets Groups Projects
Commit 07e5d248 authored by Jonas Höppner's avatar Jonas Höppner
Browse files

remote-station: Setup wifi only if device found

parent 48b9eefb
No related branches found
No related tags found
1 merge request!243remote-station: Add Makefile to create self installation script
......@@ -66,12 +66,16 @@ chmod +x $SERVICES_DIR/rs485echo.sh
#=======================
# RS232 #1
#=======================
# For now, leave echo on ttymxc0 unused.
# Not needed on pbb, but I don't know, if it is used anywhere
if false;then
cat << EOF -> $SERVICES_DIR/rs232#1echo.sh
#!/bin/sh
/opt/ltp/testcases/bin/rs485echo -n -e -d /dev/ttymxc0 -s 115200 -x 100 -b 32
EOF
chmod +x $SERVICES_DIR/rs232#1echo.sh
fi
#=======================
# RS232 #2
......@@ -96,19 +100,28 @@ EOF
chmod +x $SERVICES_DIR/bluetoothecho.sh
#=======================
# Network setup
# wifi hotspot setup
#=======================
SSID="test"
WIFIPASS="secret_passphrase"
nmcli connection down wlan0-sconfig-autogenerated
nmcli con add type wifi ifname wlan0 con-name Hotspot autoconnect no ssid "$SSID"
nmcli con modify Hotspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared wifi-sec.key-mgmt wpa-psk wifi-sec.psk "$WIFIPASS"
nmcli con modify Hotspot ipv4.addresses 192.168.3.100/24
nmcli con up Hotspot
nmcli connection modify Hotspot connection.autoconnect yes
# Check if there is a wifi device
wifi_device="$(find /sys/class/net/ -follow -maxdepth 2 -type d -name wireless 2>/dev/null | head -n 1 )"
wifi_device="${wifi_device%/*}"
wifi_device="${wifi_device##*/}"
if [ -z "$wifi_device" ];then
echo "No wifi device found, skipped wifi setup."
else
nmcli connection down wlan0-sconfig-autogenerated
nmcli con add type wifi ifname "$wifi_device" con-name Hotspot autoconnect no ssid "$SSID"
nmcli con modify Hotspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared wifi-sec.key-mgmt wpa-psk wifi-sec.psk "$WIFIPASS"
nmcli con modify Hotspot ipv4.addresses 192.168.3.100/24
nmcli con up Hotspot
nmcli connection modify Hotspot connection.autoconnect yes
nmcli connection modify eth0-sconfig-autogenerated connection.autoconnect yes
nmcli connection modify eth0-sconfig-autogenerated connection.autoconnect yes
fi
#=======================
# Install network echo server
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment