33 lines
625 B
Bash
Executable File
33 lines
625 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Build script for Go updater
|
|
# Usage: ./build.sh [os] [arch]
|
|
# Default: builds for current OS/architecture
|
|
|
|
MODULE="gitea.sanplex.xyz/Sansan/dimma-updater"
|
|
OUTPUT_DIR="../build"
|
|
BIN_NAME="go-updater"
|
|
|
|
OS=${1:-$(go env GOOS)}
|
|
ARCH=${2:-$(go env GOARCH)}
|
|
|
|
case "$OS" in
|
|
windows) EXT=".exe" ;;
|
|
*) EXT="" ;;
|
|
esac
|
|
|
|
OUTPUT="${OUTPUT_DIR}/${BIN_NAME}-${OS}-${ARCH}${EXT}"
|
|
|
|
mkdir -p "$OUTPUT_DIR"
|
|
|
|
echo "Building Go updater for ${OS}/${ARCH}..."
|
|
echo "Output: ${OUTPUT}"
|
|
|
|
go build -o "$OUTPUT" ./
|
|
|
|
if [ "$OS" = "linux" ] || [ "$OS" = "darwin" ]; then
|
|
chmod +x "$OUTPUT"
|
|
fi
|
|
|
|
echo "Build complete: ${OUTPUT}"
|