Add Windows Terminal installer (install.ps1 / install.bat)

install.ps1 copies bash.exe to %LOCALAPPDATA%\Programs\BashForWindows,
adds it to the user PATH, and injects a "Bash for Windows" profile into
Windows Terminal's settings.json so the shell appears in the + dropdown.

install.bat is a double-click wrapper that bypasses the PS execution policy.

build.sh --release produces a release/ folder ready to zip and distribute.
Supports -Uninstall flag to cleanly remove everything.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Cametendo
2026-05-26 13:01:20 +02:00
parent 8c6a2ab4c2
commit dd388a7469
4 changed files with 261 additions and 4 deletions

View File

@@ -2,18 +2,39 @@
set -e
BUILD_DIR="build"
RELEASE_DIR="release"
mkdir -p "$BUILD_DIR"
echo "=== Building bash-for-windows ==="
# Linux build
echo " -> Linux..."
# Linux debug build
echo " -> Linux (debug)..."
go build -ldflags="-s -w" -o "$BUILD_DIR/bash-windows" .
# Windows cross-compile
# Windows release build
echo " -> Windows (x86_64)..."
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o "$BUILD_DIR/bash-windows.exe" .
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 \
go build -ldflags="-s -w" -o "$BUILD_DIR/bash-windows.exe" .
echo ""
echo "=== Build complete ==="
ls -lh "$BUILD_DIR/"
# ── Release package ───────────────────────────────────────────────────────────
if [[ "${1:-}" == "--release" ]]; then
echo ""
echo "=== Building release package ==="
rm -rf "$RELEASE_DIR"
mkdir -p "$RELEASE_DIR"
cp "$BUILD_DIR/bash-windows.exe" "$RELEASE_DIR/bash.exe"
cp install.ps1 "$RELEASE_DIR/"
cp install.bat "$RELEASE_DIR/"
echo ""
echo "Release folder: $RELEASE_DIR/"
ls -lh "$RELEASE_DIR/"
echo ""
echo "Distribute the contents of $RELEASE_DIR/ as a zip."
echo "Users run install.bat (or install.ps1) to install."
fi