Emran Billah
7e3b6d7c60
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 8m51s
32 lines
803 B
Bash
32 lines
803 B
Bash
# flash-devices-batch.sh
|
|
# Expects .env file to have the following structure:
|
|
#
|
|
# DEVICES="
|
|
# /dev/ttyUSB0,230400
|
|
# /dev/ttyUSB1,230400
|
|
# /dev/ttyUSB2,230400
|
|
# "
|
|
#
|
|
|
|
#!/bin/sh
|
|
|
|
# Load environment variables from .env file
|
|
. ./.env
|
|
|
|
# Iterate over each device in the DEVICES string
|
|
for device in $DEVICES; do
|
|
# Split the device string into path and baud rate
|
|
DEVICE_PATH=$(echo $device | cut -d',' -f1)
|
|
BAUD_RATE=$(echo $device | cut -d',' -f2)
|
|
|
|
# Export the variables for docker-compose to use
|
|
export DEVICE_PATH
|
|
export BAUD_RATE
|
|
|
|
# Run docker-compose with the current device
|
|
docker compose -f docker-compose-flash-device.yml up --build
|
|
|
|
# Optionally, bring down the containers after each run
|
|
docker compose -f docker-compose-flash-device.yml down
|
|
done
|