This commit is contained in:
2026-01-08 18:33:14 +00:00
commit 51c83f846a
38 changed files with 3876 additions and 0 deletions

129
isobuild/scripts/build-iso.sh Executable file
View File

@@ -0,0 +1,129 @@
#!/bin/bash
#
# EcoOS ISO Build Script
# Wrapper script for building the EcoOS ISO
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
echo "=== EcoOS ISO Builder ==="
echo ""
# Check if running as root (required for live-build)
if [ "$EUID" -ne 0 ]; then
echo "This script requires root privileges for live-build."
echo "Running with sudo..."
exec sudo "$0" "$@"
fi
# Check prerequisites
echo "[1/6] Checking prerequisites..."
check_command() {
if ! command -v "$1" &> /dev/null; then
echo "Error: $1 is not installed"
echo "Install with: apt install $2"
exit 1
fi
}
check_command lb live-build
check_command debootstrap debootstrap
check_command xorriso xorriso
check_command deno deno
echo " All prerequisites found."
# Check Ubuntu version
. /etc/os-release
if [[ "$VERSION_ID" != "24.04" && "$VERSION_ID" != "24.10" ]]; then
echo "Warning: This script is designed for Ubuntu 24.04+"
echo "Current version: $VERSION_ID"
fi
# Bundle the daemon
echo ""
echo "[2/6] Bundling ecoos_daemon..."
DAEMON_DIR="$(dirname "$ROOT_DIR")/ecoos_daemon"
cd "$DAEMON_DIR"
deno compile --allow-all --output bundle/eco-daemon mod.ts
echo " Daemon bundled."
# Prepare build directory
echo ""
echo "[3/6] Preparing build directory..."
BUILD_DIR="$ROOT_DIR/build"
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Configure live-build
echo ""
echo "[4/6] Configuring live-build..."
lb config \
--architectures amd64 \
--distribution noble \
--archive-areas "main restricted universe multiverse" \
--binary-images iso-hybrid \
--debian-installer false \
--memtest none \
--firmware-binary true \
--firmware-chroot true \
--updates true \
--security true \
--bootloaders "grub-efi" \
--uefi-secure-boot enable \
--iso-application "EcoOS" \
--iso-publisher "EcoBridge" \
--iso-volume "EcoOS"
# Copy package lists
echo ""
echo "[5/6] Copying configuration files..."
cp "$ROOT_DIR/config/live-build/package-lists/"*.list.chroot config/package-lists/
# Prepare includes.chroot
mkdir -p config/includes.chroot/opt/eco/bin
mkdir -p config/includes.chroot/opt/eco/daemon
mkdir -p config/includes.chroot/etc/systemd/system
# Copy daemon
cp "$DAEMON_DIR/bundle/eco-daemon" config/includes.chroot/opt/eco/bin/
chmod +x config/includes.chroot/opt/eco/bin/eco-daemon
# Copy daemon source as backup
cp -r "$DAEMON_DIR/ts" config/includes.chroot/opt/eco/daemon/
cp "$DAEMON_DIR/mod.ts" config/includes.chroot/opt/eco/daemon/
cp "$DAEMON_DIR/deno.json" config/includes.chroot/opt/eco/daemon/
# Copy systemd service
cp "$ROOT_DIR/config/systemd/eco-daemon.service" config/includes.chroot/etc/systemd/system/
# Copy autoinstall config to binary includes
mkdir -p config/includes.binary/autoinstall
cp "$ROOT_DIR/config/autoinstall/user-data" config/includes.binary/autoinstall/
touch config/includes.binary/autoinstall/meta-data
echo " Configuration complete."
# Build ISO
echo ""
echo "[6/6] Building ISO (this may take 15-30 minutes)..."
echo ""
lb build
# Move ISO to output
mkdir -p "$ROOT_DIR/output"
mv *.iso "$ROOT_DIR/output/ecoos.iso" 2>/dev/null || true
echo ""
echo "=== Build Complete ==="
echo "ISO: $ROOT_DIR/output/ecoos.iso"

View File

@@ -0,0 +1,34 @@
#!/bin/bash
#
# Build EcoOS ISO using Docker
# This avoids needing to install live-build on the host
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ISOBUILD_DIR="$(dirname "$SCRIPT_DIR")"
ECO_OS_DIR="$(dirname "$ISOBUILD_DIR")"
echo "=== EcoOS ISO Builder (Docker) ==="
echo ""
cd "$ECO_OS_DIR"
# Build the Docker image
echo "[1/2] Building Docker image..."
docker build -t ecoos-builder -f isobuild/Dockerfile .
# Run the build
echo ""
echo "[2/2] Building ISO (this may take 15-30 minutes)..."
mkdir -p "$ISOBUILD_DIR/output"
docker run --rm \
--privileged \
-v "$ISOBUILD_DIR/output:/output" \
ecoos-builder
echo ""
echo "=== Build Complete ==="
echo "ISO: $ISOBUILD_DIR/output/ecoos.iso"

45
isobuild/scripts/test-qemu.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
#
# Test EcoOS ISO in QEMU
#
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
ISO_PATH="$ROOT_DIR/output/ecoos.iso"
if [ ! -f "$ISO_PATH" ]; then
echo "Error: ISO not found at $ISO_PATH"
echo "Run build-iso.sh first."
exit 1
fi
echo "Testing EcoOS ISO in QEMU..."
echo "ISO: $ISO_PATH"
echo ""
echo "Management UI will be available at: http://localhost:3006"
echo ""
# Create a temporary disk for installation testing
DISK_PATH="/tmp/ecoos-test.qcow2"
if [ ! -f "$DISK_PATH" ]; then
echo "Creating test disk..."
qemu-img create -f qcow2 "$DISK_PATH" 20G
fi
qemu-system-x86_64 \
-enable-kvm \
-m 4G \
-cpu host \
-smp 2 \
-cdrom "$ISO_PATH" \
-drive file="$DISK_PATH",format=qcow2,if=virtio \
-boot d \
-vga virtio \
-display gtk \
-device usb-tablet \
-device virtio-net-pci,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::3006-:3006,hostfwd=tcp::2222-:22 \
-bios /usr/share/ovmf/OVMF.fd
echo ""
echo "QEMU session ended."