139 lines
3.5 KiB
Bash
Executable file
139 lines
3.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Setup script for Debian Forge build environment
|
|
# This script installs required dependencies for testing and development
|
|
|
|
set -e
|
|
|
|
echo "Setting up Debian Forge build environment..."
|
|
|
|
# Check if running as root
|
|
if [[ $EUID -eq 0 ]]; then
|
|
echo "This script should not be run as root"
|
|
exit 1
|
|
fi
|
|
|
|
# Install system dependencies
|
|
echo "Installing system dependencies..."
|
|
if command -v dnf &> /dev/null; then
|
|
# Fedora/RHEL/CentOS
|
|
sudo dnf install -y \
|
|
debootstrap \
|
|
ostree \
|
|
python3-pip \
|
|
python3-requests \
|
|
python3-six \
|
|
python3-dateutil \
|
|
python3-iniparse \
|
|
python3-configparser \
|
|
sbuild \
|
|
schroot \
|
|
debian-archive-keyring
|
|
elif command -v apt &> /dev/null; then
|
|
# Debian/Ubuntu
|
|
sudo apt update
|
|
sudo apt install -y \
|
|
debootstrap \
|
|
ostree \
|
|
python3-pip \
|
|
python3-requests \
|
|
python3-six \
|
|
python3-dateutil \
|
|
python3-iniparse \
|
|
python3-configparser \
|
|
sbuild \
|
|
schroot \
|
|
debian-archive-keyring
|
|
else
|
|
echo "No supported package manager found (dnf or apt)"
|
|
exit 1
|
|
fi
|
|
|
|
# Install Python dependencies
|
|
echo "Installing Python dependencies..."
|
|
pip3 install --user \
|
|
requests \
|
|
six \
|
|
python-dateutil \
|
|
iniparse \
|
|
configparser
|
|
|
|
# Create build directories
|
|
echo "Creating build directories..."
|
|
mkdir -p builds
|
|
mkdir -p test-outputs
|
|
mkdir -p ostree-repos
|
|
|
|
# Set up sbuild configuration
|
|
echo "Setting up sbuild configuration..."
|
|
if command -v sbuild &> /dev/null; then
|
|
# Create sbuild configuration
|
|
mkdir -p ~/.sbuild
|
|
cat > ~/.sbuild/sbuild.conf << 'EOF'
|
|
# sbuild configuration for Debian Forge
|
|
$build_environment = 'chroot';
|
|
$build_arch_all = 1;
|
|
$build_source = 1;
|
|
$build_binary = 1;
|
|
$build_arch_any = 1;
|
|
$build_indep = 1;
|
|
$build_dep = 1;
|
|
$build_conf = 1;
|
|
$build_progress = 1;
|
|
$build_verbose = 1;
|
|
EOF
|
|
echo "Created sbuild configuration"
|
|
else
|
|
echo "Warning: sbuild not found, skipping sbuild configuration"
|
|
fi
|
|
|
|
# Set up OSTree repository
|
|
echo "Setting up OSTree repository..."
|
|
if command -v ostree &> /dev/null; then
|
|
ostree init --repo ostree-repos/debian-atomic
|
|
echo "Created OSTree repository: ostree-repos/debian-atomic"
|
|
else
|
|
echo "Warning: ostree not found, skipping repository setup"
|
|
fi
|
|
|
|
# Test basic functionality
|
|
echo "Testing basic functionality..."
|
|
|
|
# Test debootstrap
|
|
if command -v debootstrap &> /dev/null; then
|
|
echo "✅ debootstrap: available"
|
|
else
|
|
echo "❌ debootstrap: not available"
|
|
fi
|
|
|
|
# Test ostree
|
|
if command -v ostree &> /dev/null; then
|
|
echo "✅ ostree: available"
|
|
else
|
|
echo "❌ ostree: not available"
|
|
fi
|
|
|
|
# Test sbuild
|
|
if command -v sbuild &> /dev/null; then
|
|
echo "✅ sbuild: available"
|
|
else
|
|
echo "❌ sbuild: not available"
|
|
fi
|
|
|
|
# Test Python modules
|
|
python3 -c "import requests, six, dateutil, iniparse, configparser" 2>/dev/null && \
|
|
echo "✅ Python dependencies: available" || \
|
|
echo "❌ Python dependencies: missing"
|
|
|
|
echo ""
|
|
echo "Build environment setup complete!"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Test the stages: python3 debian-forge/test-debian-stages.py"
|
|
echo "2. Run a test build: python3 debian-forge/build-orchestrator.py debian-forge/test-debian-manifest.json"
|
|
echo "3. Check build status and outputs in the builds/ directory"
|
|
echo ""
|
|
echo "Build directories created:"
|
|
echo " - builds/ (build outputs)"
|
|
echo " - test-outputs/ (test results)"
|
|
echo " - ostree-repos/ (OSTree repositories)"
|