deb-bootc-image-builder-new/build.sh
2025-09-05 07:10:12 -07:00

64 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
# Build script for debian-bootc-image-builder
# This script builds the Go binary for the debian-bootc-image-builder
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${GREEN}[INFO]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Check if we're in the right directory
if [ ! -f "bib/go.mod" ]; then
print_error "Please run this script from the project root directory"
exit 1
fi
# Create bin directory if it doesn't exist
mkdir -p bin
print_status "Building debian-bootc-image-builder..."
# Build the binary
cd bib
go build -o ../bin/debian-bootc-image-builder ./cmd/debian-bootc-image-builder
if [ $? -eq 0 ]; then
print_status "Build successful!"
print_status "Binary created at: bin/debian-bootc-image-builder"
# Show binary info
if [ -f "../bin/debian-bootc-image-builder" ]; then
print_status "Binary size: $(du -h ../bin/debian-bootc-image-builder | cut -f1)"
print_status "Binary info:"
if command -v file >/dev/null 2>&1; then
file ../bin/debian-bootc-image-builder
else
echo "Binary created successfully (file command not available)"
fi
fi
else
print_error "Build failed!"
exit 1
fi
cd ..
print_status "Build completed successfully!"