dev-env/script/foreachSystem/dcom
2025-05-25 22:21:05 +02:00

25 lines
676 B
Bash
Executable File

#!/bin/bash
ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/../.." &> /dev/null && pwd )
source $ENV_DIR/bin/messages
source $ENV_DIR/bin/dcom
COMMAND="$@"
CONFIG_FILE="$ENV_DIR/.systems"
# Check if .systems configuration exists
if [ ! -f "$CONFIG_FILE" ]; then
errormsg "$CONFIG_FILE not found."
exit 1
fi
importantmsg "[dev-env]: Executing docker-compose $COMMAND for all systems"
while IFS=' ' read -r IDENTIFIER DIRECTORY GIT; do # Iterate through all lines in .systems configuration
if [[ "$IDENTIFIER" =~ ^#.* ]] || [ -z "$IDENTIFIER" ]; then # Skip comments and emtpy lines
continue
fi
dcom $IDENTIFIER $COMMAND
echo ""
done < "$CONFIG_FILE"