From c9ca22bafc92367d8288812262fc8482bb8d49f7 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 12 Jun 2026 19:15:24 +0000 Subject: [PATCH] =?UTF-8?q?feat(agent):=20ajout=20du=20num=C3=A9ro=20de=20?= =?UTF-8?q?version=20v0.2.0=20affich=C3=A9=20au=20d=C3=A9marrage=20+=20scr?= =?UTF-8?q?ipt=20build=20multiplateforme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent/build.sh | 20 ++++++++++++++++++++ agent/main.go | 5 ++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 agent/build.sh diff --git a/agent/build.sh b/agent/build.sh new file mode 100755 index 0000000..2865262 --- /dev/null +++ b/agent/build.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +VERSION="0.2.0" +LDFLAGS="-X main.version=${VERSION}" + +echo "Building EduBox Agent v${VERSION}..." + +export PATH=$PATH:/usr/local/go/bin + +GOOS=windows GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o edubox-agent.exe . +echo " edubox-agent.exe (Windows amd64)" + +GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o edubox-agent . +echo " edubox-agent (Linux amd64)" + +GOOS=darwin GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o edubox-agent-mac . +echo " edubox-agent-mac (macOS amd64)" + +echo "Done." diff --git a/agent/main.go b/agent/main.go index 1d9e06c..6d88a11 100644 --- a/agent/main.go +++ b/agent/main.go @@ -8,6 +8,9 @@ import ( "path/filepath" ) +// version is injected at build time via -ldflags "-X main.version=X.Y.Z" +var version = "dev" + var ( serverAddr = flag.String("server", "ws://localhost:3001", "Adresse WebSocket du serveur") nodeID = flag.String("node-id", defaultNodeID(), "ID du nœud (défaut: hostname)") @@ -42,7 +45,7 @@ func main() { log.Fatalf("Cannot create data-dir: %v", err) } - fmt.Printf("EduBox Agent - node: %s - data-dir: %s\n", *nodeID, *dataDir) + fmt.Printf("EduBox Agent v%s - node: %s - data-dir: %s\n", version, *nodeID, *dataDir) if *uiEnabled { go startUI(*dataDir, *nodeID, *serverAddr)