Complete file structure reorganization for 1:1 osbuild compatibility

This commit is contained in:
robojerk 2025-08-26 15:38:59 -07:00
parent 61e7caaddb
commit 56f029cbc0
77 changed files with 5 additions and 956 deletions

102
tools/setup-apt-cacher.sh Executable file
View file

@ -0,0 +1,102 @@
#!/bin/bash
# Setup script for apt-cacher-ng to support Debian Forge development
# This script installs and configures apt-cacher-ng for local development
set -e
echo "Setting up apt-cacher-ng for Debian Forge development..."
# Check if running as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root (use sudo)"
exit 1
fi
# Install apt-cacher-ng
echo "Installing apt-cacher-ng..."
if command -v dnf &> /dev/null; then
dnf install -y apt-cacher-ng
elif command -v apt &> /dev/null; then
apt update
apt install -y apt-cacher-ng
else
echo "No supported package manager found (dnf or apt)"
exit 1
fi
# Create configuration directory
mkdir -p /etc/apt-cacher-ng
# Configure apt-cacher-ng for Debian repositories
cat > /etc/apt-cacher-ng/acng.conf << 'EOF'
# apt-cacher-ng configuration for Debian Forge development
# Cache directory
CacheDir: /var/cache/apt-cacher-ng
# Log directory
LogDir: /var/log/apt-cacher-ng
# Port to listen on
Port: 3142
# Bind address (listen on all interfaces)
BindAddress: 192.168.1.101
# Verbose logging for development
VerboseLog: 1
# Allow access from localhost
AllowUser: *
# Cache Debian repositories
Backend: http://deb.debian.org/debian
Backend: http://deb.debian.org/debian-security
Backend: http://deb.debian.org/debian-backports
# Cache size limit (5GB)
MaxStandbyConcurrency: 10
MaxStandbyConcurrencyPerMirror: 2
MaxStandbyConcurrencyPerBackend: 2
# Keep packages for 30 days
ExTreshold: 30
EOF
# Start and enable apt-cacher-ng service
echo "Starting apt-cacher-ng service..."
systemctl daemon-reload
systemctl enable apt-cacher-ng
systemctl start apt-cacher-ng
# Check service status
if systemctl is-active --quiet apt-cacher-ng; then
echo "✅ apt-cacher-ng is running on http://192.168.1.101:3142"
echo "You can now use 'apt_proxy: \"http://192.168.1.101:3142\"' in your manifests"
else
echo "❌ Failed to start apt-cacher-ng service"
systemctl status apt-cacher-ng
exit 1
fi
# Test the proxy
echo "Testing apt-cacher-ng..."
if curl -s http://localhost:3142/acng-report.html > /dev/null; then
echo "✅ apt-cacher-ng is responding correctly"
else
echo "❌ apt-cacher-ng is not responding"
exit 1
fi
echo ""
echo "apt-cacher-ng setup complete!"
echo ""
echo "Usage in your manifests:"
echo " \"apt_proxy\": \"http://192.168.1.101:3142\""
echo ""
echo "To view cache statistics: http://localhost:3142/acng-report.html"
echo "To view cache contents: http://localhost:3142/deb.debian.org/debian/"
echo ""
echo "To stop the service: sudo systemctl stop apt-cacher-ng"
echo "To start the service: sudo systemctl start apt-cacher-ng"

139
tools/setup-build-env.sh Executable file
View file

@ -0,0 +1,139 @@
#!/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)"