Commit 68f16d5a authored by jan.koester's avatar jan.koester
Browse files

test

parent 0dbee5b4
Loading
Loading
Loading
Loading
+23 −36
Original line number Diff line number Diff line
@@ -65,19 +65,39 @@ LIB_ORDER=(

# Parse arguments
CLEAN=0
PHASES=()
while [[ $# -gt 0 ]]; do
    case "$1" in
        --clean) CLEAN=1; shift ;;
        --arch) ARCH="$2"; shift 2 ;;
        -h|--help)
            echo "Usage: $0 [--clean] [--arch amd64] [PHASE...]"
            echo ""
            echo "Phases: chroot, toolchain, libraries, blogi, editor, all (default)"
            exit 0
            ;;
        chroot|toolchain|libraries|blogi|editor|all)
            PHASES+=("$1"); shift ;;
        *) echo "Unknown option: $1"; exit 1 ;;
    esac
done

# Default to all
if [[ ${#PHASES[@]} -eq 0 ]]; then
    PHASES=("all")
fi

# Only require root for non-editor phases
if [[ $EUID -ne 0 ]]; then
    # Allow editor-only without root
    for phase in "${PHASES[@]}"; do
        if [[ "$phase" != "editor" ]]; then
            echo "This script must be run as root (for nspawn)."
    echo "Usage: sudo $0 [--clean]"
            echo "Usage: sudo $0 [--clean] [PHASE...]"
            exit 1
        fi
    done
fi

# ─────────────────────────────────────────────────────────────
# Phase 1: Create minimal Debian chroot
@@ -504,39 +524,6 @@ build_blogi() {
# Main
# ─────────────────────────────────────────────────────────────

usage() {
    echo "Usage: $0 [--clean] [--arch amd64] [PHASE...]"
    echo ""
    echo "Phases: chroot, toolchain, libraries, blogi, editor, all (default)"
    echo ""
    echo "  chroot      Setup the nspawn chroot"
    echo "  toolchain   Build musl + LLVM runtimes + wrappers"
    echo "  libraries   Build all dependency libraries"
    echo "  blogi       Build blogi package in nspawn (musl)"
    echo "  editor      Build blogi-editor normally (system toolchain)"
    echo "  all         Run all phases (default)"
}

# Parse phases from arguments
PHASES=()
for arg in "$@"; do
    case "$arg" in
        --clean|--arch) ;; # handled elsewhere
        chroot|toolchain|libraries|blogi|editor|all)
            PHASES+=("$arg")
            ;;
        -h|--help)
            usage
            exit 0
            ;;
    esac
done

# Default to all
if [[ ${#PHASES[@]} -eq 0 ]]; then
    PHASES=("all")
fi

run_phase() {
    local phase="$1"
    case "$phase" in