-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·130 lines (114 loc) · 4.02 KB
/
dev.sh
File metadata and controls
executable file
·130 lines (114 loc) · 4.02 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env bash
# Development harness for ScheduleObserved.
#
# Common flow: ./dev.sh (build + start stack + launch game)
# Subcommands: build | stack | play | logs | status | down | help
set -euo pipefail
APP_ID=3164500
GAME_DIR="${GAME_DIR:-$HOME/.local/share/Steam/steamapps/common/Schedule I}"
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MONITORING_DIR="$PROJECT_DIR/monitoring"
LOG_FILE="$GAME_DIR/MelonLoader/Latest.log"
DOTNET="${DOTNET:-$HOME/.dotnet/dotnet}"
c_reset=$'\e[0m'; c_cyan=$'\e[36m'; c_green=$'\e[32m'; c_yellow=$'\e[33m'; c_red=$'\e[31m'
step() { echo "${c_cyan}→${c_reset} $*"; }
ok() { echo "${c_green}✓${c_reset} $*"; }
warn() { echo "${c_yellow}!${c_reset} $*"; }
err() { echo "${c_red}✗${c_reset} $*" >&2; }
cmd_build() {
step "Building mod..."
(cd "$PROJECT_DIR" && "$DOTNET" build -c Release | tail -5)
}
cmd_stack() {
step "Ensuring monitoring stack is up..."
if [ ! -f "$MONITORING_DIR/.env" ]; then
warn ".env not found. Copy .env.example and set GAME_DIR first:"
warn " cp $MONITORING_DIR/.env.example $MONITORING_DIR/.env"
exit 1
fi
(cd "$MONITORING_DIR" && docker-compose up -d)
ok "Prometheus: http://localhost:9090"
ok "Grafana: http://localhost:3000 (admin / scheduleobserved)"
ok "Loki: http://localhost:3100"
}
cmd_play() {
step "Launching Schedule 1 (app $APP_ID) via Steam..."
steam "steam://rungameid/$APP_ID" >/dev/null 2>&1 &
disown
ok "Launched. Tail the log with: $0 logs"
}
cmd_logs() {
if [ ! -f "$LOG_FILE" ]; then
err "Log file not found: $LOG_FILE"
err "Launch the game at least once so MelonLoader creates it."
exit 1
fi
step "Tailing $LOG_FILE (Ctrl+C to stop)..."
tail -F "$LOG_FILE" | grep --line-buffered -E "ScheduleObserved|\[ERROR\]|\[WARNING\]" || true
}
cmd_status() {
step "Branch:"
if [ -f "$GAME_DIR/GameAssembly.dll" ]; then
ok "IL2CPP (GameAssembly.dll present)"
elif [ -f "$GAME_DIR/Schedule I_Data/Managed/Assembly-CSharp.dll" ]; then
ok "Mono (Managed/Assembly-CSharp.dll present)"
else
warn "Unknown — neither branch marker found at $GAME_DIR"
fi
step "Deployed mod:"
if [ -f "$GAME_DIR/Mods/ScheduleObserved.dll" ]; then
stat -c " %y %n (%s bytes)" "$GAME_DIR/Mods/ScheduleObserved.dll"
else
warn "Not deployed"
fi
step "Monitoring stack:"
if (cd "$MONITORING_DIR" && docker-compose ps --status=running 2>/dev/null | tail -n +2 | grep -q .); then
(cd "$MONITORING_DIR" && docker-compose ps)
else
warn "Stack is down (run: $0 stack)"
fi
step "Metrics endpoint:"
if curl -s -o /dev/null -w "%{http_code}" --max-time 1 http://localhost:9184/metrics | grep -q 200; then
ok "Responding on http://localhost:9184/metrics"
else
warn "No response on :9184 — game may not be running"
fi
}
cmd_down() {
step "Stopping monitoring stack..."
(cd "$MONITORING_DIR" && docker-compose down)
}
cmd_help() {
cat <<EOF
Usage: $0 [command]
Commands:
(default) build + stack + play
build dotnet build -c Release (branch auto-detected)
stack docker-compose up -d the monitoring stack
play launch Schedule 1 via Steam
logs tail MelonLoader Latest.log, filtered to ScheduleObserved + errors
status branch detection, mod deployment, stack state, metrics endpoint
down docker-compose down the monitoring stack
help this
Environment:
GAME_DIR override the game install path
(default: \$HOME/.local/share/Steam/steamapps/common/Schedule I)
DOTNET path to dotnet (default: \$HOME/.dotnet/dotnet)
EOF
}
cmd_all() {
cmd_build
cmd_stack
cmd_play
}
case "${1:-all}" in
build) cmd_build ;;
stack) cmd_stack ;;
play) cmd_play ;;
logs) cmd_logs ;;
status) cmd_status ;;
down) cmd_down ;;
help|-h|--help) cmd_help ;;
all|"") cmd_all ;;
*) err "Unknown command: $1"; cmd_help; exit 1 ;;
esac