mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-03-30 12:05:38 +00:00
- Clarified comments in docker-compose.yml regarding build configuration and updated pull_policy to 'missing' for clearer intent. - Enhanced docker-setup.sh to ensure .env file creation and updates are more robust, with improved error handling and verification steps for Docker image configuration.
33 lines
1.1 KiB
Bash
Executable File
33 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Quick script to find and update the serial device in config.ini
|
|
|
|
CONFIG_FILE="data/config/config.ini"
|
|
|
|
# Find the actual device the symlink points to
|
|
SYMLINK="/dev/serial/by-id/usb-RAKwireless_WisCore_RAK4631_Board_B2C39A2D9735430C-if00"
|
|
|
|
if [ -L "$SYMLINK" ]; then
|
|
ACTUAL_DEVICE=$(readlink -f "$SYMLINK" 2>/dev/null)
|
|
if [ -n "$ACTUAL_DEVICE" ] && [ -e "$ACTUAL_DEVICE" ]; then
|
|
echo "Found device: $SYMLINK -> $ACTUAL_DEVICE"
|
|
|
|
# Update config.ini
|
|
if [[ "$(uname -s)" == "Darwin" ]]; then
|
|
sed -i '' "s|^serial_port[[:space:]]*=.*|serial_port = $ACTUAL_DEVICE|" "$CONFIG_FILE"
|
|
else
|
|
sed -i "s|^serial_port[[:space:]]*=.*|serial_port = $ACTUAL_DEVICE|" "$CONFIG_FILE"
|
|
fi
|
|
|
|
echo "✓ Updated config.ini to use: $ACTUAL_DEVICE"
|
|
echo ""
|
|
echo "Restart the container:"
|
|
echo " docker compose restart"
|
|
else
|
|
echo "Error: Could not resolve symlink"
|
|
fi
|
|
else
|
|
echo "Symlink not found: $SYMLINK"
|
|
echo "Available serial devices:"
|
|
ls -la /dev/ttyACM* /dev/ttyUSB* 2>/dev/null || echo " None found"
|
|
fi
|