dev-env/bin/script/foreachSystem
2024-09-14 13:48:22 +00:00

29 lines
682 B
Bash
Executable File

#!/bin/bash
COMMAND="$@"
ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/../.." &> /dev/null && pwd )
source ${ENV_DIR}/bin/dexec
if [ $# -lt 1 ]; then
echo "Verwendung: foreachSystem up -d"
return 1
fi
for SYSTEM in $ENV_DIR/systems/*/*/ ; do
relative_path="${SYSTEM#*/systems/}"
relative_path="${relative_path%/}"
typePart="${relative_path%/*}" # before "/" eg. backend / frontend
systemPart="${relative_path##*/}" # after "/" eg. bee / auth / etc
SYSTEM_CODE="$systemPart-$typePart"
DENV_COMMAND="dexec"
if [[ "$COMMAND" == "init" ]]; then
$ENV_DIR/systems/$typePart/$systemPart/bin/script/init
else
$DENV_COMMAND $SYSTEM_CODE $COMMAND
fi
done