-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·49 lines (44 loc) · 1.19 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·49 lines (44 loc) · 1.19 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
#!/bin/bash
set -e
cd "$(dirname "$0")"
# Install npm deps if needed (one-command setup)
if [ ! -d web/node_modules ]; then
echo "Installing frontend dependencies..."
(cd web && npm install)
fi
echo "Building frontend..."
(cd web && npm run build)
echo "Building backend..."
go build -o bolt-viewer .
# Resolve DB path: explicit --db, TRIVY_DB env, or common cache locations
resolve_db() {
if [ -n "$TRIVY_DB" ] && [ -f "$TRIVY_DB" ]; then
echo "$TRIVY_DB"
return
fi
for p in "$HOME/.cache/trivy/db/trivy.db" \
"$HOME/Library/Caches/trivy/db/trivy.db" \
"$HOME/Downloads/db/dev/db/trivy.db"; do
if [ -f "$p" ]; then
echo "$p"
return
fi
done
echo ""
}
# Pass all args to bolt-viewer; use default --db if none given
if [ $# -eq 0 ]; then
DB="$(resolve_db)"
if [ -z "$DB" ]; then
echo "Error: No Trivy DB found. Either:"
echo " 1. Pass -d /path/to/trivy.db"
echo " 2. Set TRIVY_DB=/path/to/trivy.db"
echo " 3. Run 'trivy image --download-db-only' to create one in cache"
exit 1
fi
echo "Starting bolt-viewer (db=$DB)..."
exec ./bolt-viewer -d "$DB"
else
echo "Starting bolt-viewer..."
exec ./bolt-viewer "$@"
fi