-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch.sh
More file actions
33 lines (26 loc) · 791 Bytes
/
Copy pathlaunch.sh
File metadata and controls
33 lines (26 loc) · 791 Bytes
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
#!/bin/bash
# Change to the directory where the script is located
cd "$(dirname "$0")"
IP_FILE="robot_ip.txt"
rm -f "$IP_FILE"
echo "Detecting Robot Gateway IP..."
# Try getting the default gateway IP using ip route
GATEWAY_IP=$(ip route | grep default | awk '{print $3}')
# Fallback to nmcli if ip route didn't work
if [ -z "$GATEWAY_IP" ]; then
GATEWAY_IP=$(nmcli -t -f IP4.GATEWAY dev show | head -n 1 | cut -d: -f2)
fi
if [ -n "$GATEWAY_IP" ]; then
echo "$GATEWAY_IP" > "$IP_FILE"
echo "Found IP: $GATEWAY_IP"
else
echo "Could not find Gateway IP."
fi
# Launch the Unity application
if [ -f "./MARP.x86_64" ]; then
echo "Launching MARP..."
chmod +x ./MARP.x86_64
./MARP.x86_64 "$@"
else
echo "Error: MARP.x86_64 not found in current directory."
fi