#!/bin/bash
# Build script for Miasma OS installer

set -e

echo "Building Miasma OS installer..."

# Check if Go is installed
if ! command -v go &> /dev/null
then
    echo "Error: Go is not installed. Please install Go first."
    exit 1
fi

# Build the Go binary
echo "Compiling Go binary..."
go build -o miasma-installer main.go

# Make sure the post-install script is executable
chmod +x miasma-post-install.sh

echo "Build complete!"
echo "Generated files:"
echo "  - miasma-installer (the main installer binary)"
echo "  - alis.conf (will be generated at runtime)"
echo "  - alis-packages.conf (packages configuration)"
echo "  - miasma-post-install.sh (post-installation script)"

echo ""
echo "To run the installer:"
echo "  sudo ./miasma-installer"