-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsentinel.sh
More file actions
executable file
·38 lines (33 loc) · 1.08 KB
/
Copy pathsentinel.sh
File metadata and controls
executable file
·38 lines (33 loc) · 1.08 KB
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
34
35
36
37
38
#!/bin/bash
# Sentinel of Mnemosyne — Docker Compose wrapper
set -euo pipefail
PROFILES=()
ARGS=()
for arg in "$@"; do
case "$arg" in
--discord) PROFILES+=("discord") ;;
--imessage) echo "iMessage runs natively on Mac, not in Docker." && exit 1 ;;
--pf2e) PROFILES+=("pf2e") ;;
--music) PROFILES+=("music") ;;
--finance) PROFILES+=("finance") ;;
--trader) PROFILES+=("trader") ;;
--coder) PROFILES+=("coder") ;;
*) ARGS+=("$arg") ;;
esac
done
PROFILE_FLAGS=()
for p in ${PROFILES[@]+"${PROFILES[@]}"}; do
PROFILE_FLAGS+=("--profile" "$p")
done
# On teardown, include all known opt-in profiles so profiled services (e.g. pi-harness)
# are stopped even when the caller didn't pass their --flag.
ALL_KNOWN_PROFILES=(discord pf2e music finance trader coder)
for arg in ${ARGS[@]+"${ARGS[@]}"}; do
if [[ "$arg" == "down" ]]; then
for p in "${ALL_KNOWN_PROFILES[@]}"; do
PROFILE_FLAGS+=("--profile" "$p")
done
break
fi
done
docker compose ${PROFILE_FLAGS[@]+"${PROFILE_FLAGS[@]}"} ${ARGS[@]+"${ARGS[@]}"}