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>
41 lines
1.1 KiB
Bash
Executable File
41 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
BUILD_DIR="build"
|
|
RELEASE_DIR="release"
|
|
mkdir -p "$BUILD_DIR"
|
|
|
|
echo "=== Building bash-for-windows ==="
|
|
|
|
# Linux debug build
|
|
echo " -> Linux (debug)..."
|
|
go build -ldflags="-s -w" -o "$BUILD_DIR/bash-windows" .
|
|
|
|
# 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" .
|
|
|
|
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
|