-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstart_console
More file actions
executable file
·72 lines (62 loc) · 2.26 KB
/
Copy pathstart_console
File metadata and controls
executable file
·72 lines (62 loc) · 2.26 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
#!/bin/bash
# =============================================================================
# OpenEMR on EKS Console Launcher
# =============================================================================
#
# Purpose:
# Launches the OpenEMR on EKS TUI console application
#
# Usage:
# /start_console
#
# =============================================================================
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONSOLE_DIR="$SCRIPT_DIR/console"
# Check if console directory exists
if [ ! -d "$CONSOLE_DIR" ]; then
echo "Error: Console directory not found at $CONSOLE_DIR"
exit 1
fi
# Check if Go is installed
if ! command -v go >/dev/null 2>&1; then
echo "Error: Go is not installed. Please install Go to use the console."
echo "Visit: https://golang.org/dl/"
exit 1
fi
# Check Go version (requires 1.25 or later)
GO_VERSION=$(go version | awk '{print $3}' | sed 's/go//')
REQUIRED_VERSION="1.25"
if [ "$(printf '%s\n' "$REQUIRED_VERSION" "$GO_VERSION" | sort -V | head -n1)" != "$REQUIRED_VERSION" ]; then
echo "Error: Go version $GO_VERSION is installed, but version $REQUIRED_VERSION or later is required."
echo "Please upgrade Go: https://golang.org/dl/"
exit 1
fi
# Change to console directory
cd "$CONSOLE_DIR" || exit 1
# Check if go.mod exists, if not initialize
if [ ! -f "go.mod" ]; then
echo "Initializing Go module..."
go mod init github.com/openemr/openemr-on-eks/console 2>/dev/null || true
fi
# Download dependencies
echo "Downloading dependencies..."
go mod download 2>/dev/null || true
go mod tidy 2>/dev/null || true
# Get the project root directory (parent of console directory)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
# Build the console
echo "Building console..."
if go build -ldflags "-X main.embeddedProjectRoot=$PROJECT_ROOT" -o openemr-eks-console main.go; then
# Run the console
./openemr-eks-console
else
echo ""
echo "Error: Failed to build console application"
echo "Please check the error messages above and ensure:"
echo " - Go 1.25 or later is installed"
echo " - All dependencies are available"
echo " - The code compiles without errors"
exit 1
fi