commit 882552f4e7ebde6ca0f2dacdd8ecf89809f2f34f Author: robojerk Date: Tue Aug 12 15:59:34 2025 -0700 initial commit diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5280c0b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,74 @@ +name: Build Simple CLI + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main ] + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=sha,prefix={{branch}}- + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push container image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Containerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Generate bootable image + run: | + mkdir -p output + docker run --rm --privileged \ + -v $PWD/output:/output \ + -v /var/lib/containers/storage:/var/lib/containers/storage \ + quay.io/centos-bootc/bootc-image-builder:latest \ + --type iso,raw \ + --output /output \ + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} + + - name: Upload bootable images + uses: actions/upload-artifact@v4 + with: + name: bootable-images + path: output/ + retention-days: 30 diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..f90465a --- /dev/null +++ b/Containerfile @@ -0,0 +1,63 @@ +# Simple CLI - Debian-based particle-os system +# Based on Aurora's architecture pattern +FROM debian:trixie-slim + +# Install core system packages +RUN apt-get update && apt-get install -y \ + systemd \ + systemd-sysv \ + udev \ + procps \ + util-linux \ + mount \ + passwd \ + login \ + bash \ + coreutils \ + ostree \ + ostree-boot \ + linux-image-amd64 \ + linux-headers-amd64 \ + initramfs-tools \ + curl \ + wget \ + vim \ + less \ + locales \ + ca-certificates \ + tzdata \ + && rm -rf /var/lib/apt/lists/* + +# Configure locale +RUN locale-gen en_US.UTF-8 +ENV LANG=en_US.UTF-8 + +# Configure timezone +ENV TZ=UTC + +# Create user +RUN useradd -m -s /bin/bash simple + +# Configure OSTree +RUN mkdir -p /usr/lib/ostree-boot + +# Copy configuration files (will be layered in) +COPY usr/ /usr/ +COPY etc/ /etc/ +COPY config/ /config/ + +# Set up firstboot scripts +RUN mkdir -p /usr/share/particle-os/firstboot +COPY usr/share/particle-os/firstboot/ /usr/share/particle-os/firstboot/ + +# Set up ujust commands +RUN mkdir -p /usr/share/particle-os/just +COPY usr/share/particle-os/just/ /usr/share/particle-os/just/ + +# Clean up package management files +RUN rm -f /var/lib/dpkg/info/*.postinst \ + && rm -f /var/lib/dpkg/info/*.postrm \ + && rm -f /var/lib/dpkg/info/*.prerm + +# Set default command +CMD ["/bin/bash"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..82ad3ed --- /dev/null +++ b/README.md @@ -0,0 +1,108 @@ +# Simple CLI + +A simple, CLI-focused Debian-based particle-os system built on Universal Blue's framework. Simple CLI provides a minimal, immutable Linux distribution optimized for command-line usage and server workloads. + +## Features + +- **Immutable Filesystem**: Built on OSTree for reliable, atomic updates +- **Container-Native**: Built as a container image, deployed with bootc +- **Minimal Footprint**: Focused on essential CLI tools and system utilities +- **Modern Boot**: Uses bootupd for modern bootloader management +- **Debian Base**: Built on Debian Trixie for stability and package availability + +## Quick Start + +### Building the Image + +```bash +# Clone the repository +git clone https://github.com/your-username/simple-cli.git +cd simple-cli + +# Build the container image +just build + +# Test the image +just test + +# Generate bootable images +just generate-bootable +``` + +### Using the System + +```bash +# Show system information +ujust info + +# Check OSTree status +ujust ostree-status + +# Update the system +ujust update + +# View system services +ujust services +``` + +## Architecture + +Simple CLI follows the particle-os architecture: + +1. **Container Image**: The OS is built as a container image using the Containerfile +2. **OSTree Deployment**: Container images are converted to OSTree commits +3. **Bootable Images**: bootc-image-builder creates bootable disk images +4. **System Management**: bootupd handles bootloader updates and management + +## Directory Structure + +``` +simple-cli/ +├── Containerfile # Main container build definition +├── recipe.yml # particle-os recipe configuration +├── justfile # Build automation commands +├── config/ # System configuration files +├── usr/ # User space configurations +├── etc/ # System-wide configuration +├── build_files/ # Build-time specifications +└── .github/workflows/ # CI/CD automation +``` + +## Development + +### Prerequisites + +- Podman or Docker +- Just command runner +- bootc-image-builder (for bootable image generation) + +### Setup Development Environment + +```bash +just setup-dev +``` + +### Available Commands + +```bash +just --list +``` + +## Contributing + +1. Fork the repository +2. Create a feature branch +3. Make your changes +4. Test with `just test` +5. Submit a pull request + +## License + +This project is licensed under the Apache 2.0 License - see the LICENSE file for details. + +## Acknowledgments + +- Built on [particle-os](https://github.com/particle-os) framework +- Inspired by [Aurora](https://github.com/particle-os/aurora) and other particle-os projects +- Uses [bootc](https://github.com/containers/bootc) for container-native boot +- Powered by [OSTree](https://ostreedev.github.io/ostree/) for immutable filesystems diff --git a/build_files/packages.json b/build_files/packages.json new file mode 100644 index 0000000..2f3e450 --- /dev/null +++ b/build_files/packages.json @@ -0,0 +1,66 @@ +{ + "packages": { + "core": { + "description": "Core system packages", + "packages": [ + "systemd", + "systemd-sysv", + "udev", + "procps", + "util-linux", + "mount", + "passwd", + "login", + "bash", + "coreutils" + ] + }, + "ostree": { + "description": "OSTree and boot management", + "packages": [ + "ostree", + "ostree-boot" + ] + }, + "kernel": { + "description": "Kernel and boot essentials", + "packages": [ + "linux-image-amd64", + "linux-headers-amd64", + "initramfs-tools" + ] + }, + "tools": { + "description": "Essential command line tools", + "packages": [ + "curl", + "wget", + "vim", + "less", + "locales", + "ca-certificates", + "tzdata" + ] + }, + "development": { + "description": "Development tools (optional)", + "packages": [ + "build-essential", + "git", + "python3", + "python3-pip" + ] + } + }, + "repositories": { + "debian": { + "url": "http://deb.debian.org/debian", + "suite": "trixie", + "components": ["main", "contrib", "non-free"] + } + }, + "post_install": [ + "usr/share/particle-os/firstboot/setup-system.sh", + "usr/share/particle-os/firstboot/configure-network.sh" + ] +} diff --git a/justfile b/justfile new file mode 100644 index 0000000..bd7e69f --- /dev/null +++ b/justfile @@ -0,0 +1,94 @@ +#!/usr/bin/env just --justfile + +# Simple CLI - particle-os build automation +# Based on Aurora's Justfile pattern + +# Default recipe to display help +default: + @just --list + +# Build the container image +build: + #!/usr/bin/env bash + echo "Building Simple CLI container image..." + podman build -f Containerfile -t localhost/simple-cli:latest . + echo "Build complete: localhost/simple-cli:latest" + +# Build and push to registry +build-push registry="localhost": + #!/usr/bin/env bash + echo "Building and pushing to {{registry}}..." + podman build -f Containerfile -t {{registry}}/simple-cli:latest . + podman push {{registry}}/simple-cli:latest + echo "Pushed to {{registry}}/simple-cli:latest" + +# Generate bootable image using bootc-image-builder +generate-bootable: + #!/usr/bin/env bash + echo "Generating bootable image..." + mkdir -p output + podman run --rm --privileged \ + -v $PWD/output:/output \ + -v /var/lib/containers/storage:/var/lib/containers/storage \ + quay.io/centos-bootc/bootc-image-builder:latest \ + --type iso,raw \ + --output /output \ + localhost/simple-cli:latest + echo "Bootable image generated in output/" + +# Test the container +test: + #!/usr/bin/env bash + echo "Testing Simple CLI container..." + podman run --rm localhost/simple-cli:latest \ + bash -c "echo 'System info:' && uname -a && echo 'Packages:' && dpkg -l | wc -l" + echo "Test complete" + +# Clean build artifacts +clean: + #!/usr/bin/env bash + echo "Cleaning build artifacts..." + rm -rf output/ + podman image prune -f + podman system prune -f + echo "Cleanup complete" + +# Install ujust recipes for end users +install-ujust: + #!/usr/bin/env bash + sudo mkdir -p /usr/share/particle-os/just + sudo cp -r usr/share/particle-os/just/* /usr/share/particle-os/just/ + echo "ujust recipes installed system-wide" + +# Validate the recipe +validate: + #!/usr/bin/env bash + echo "Validating recipe.yml..." + if command -v bluebuild >/dev/null 2>&1; then + bluebuild validate recipe.yml + else + echo "bluebuild not installed, skipping validation" + fi + +# Full build pipeline +pipeline: build test generate-bootable + @echo "Full build pipeline completed" + +# Development environment setup +setup-dev: + #!/usr/bin/env bash + echo "Setting up development environment..." + sudo apt update + sudo apt install -y podman just + echo "Development environment ready" + +# Show system information +info: + #!/usr/bin/env bash + echo "=== Simple CLI System Information ===" + echo "Container image: localhost/simple-cli:latest" + echo "Base: Debian Trixie" + echo "Architecture: particle-os with OSTree" + echo "Bootloader: bootupd" + echo "Kernel: linux-image-amd64" + echo "================================" diff --git a/readme-simple.md b/readme-simple.md new file mode 100644 index 0000000..832c058 --- /dev/null +++ b/readme-simple.md @@ -0,0 +1,4 @@ +This is a testing system. +no Dekstop or other apps. +just a server like install. +use oci image debian:trixie-slim \ No newline at end of file diff --git a/recipe.yml b/recipe.yml new file mode 100644 index 0000000..460a051 --- /dev/null +++ b/recipe.yml @@ -0,0 +1,73 @@ +name: simple-cli +description: Simple CLI-focused Debian-based particle-os system +base-image: debian:trixie-slim +image-version: "13" + +# Build configuration +build: + containerfile: Containerfile + registry: localhost + tag: simple-cli:latest + +# Package management +packages: + system: + - systemd + - systemd-sysv + - udev + - procps + - util-linux + - mount + - passwd + - login + - bash + - coreutils + - ostree + - ostree-boot + - linux-image-amd64 + - linux-headers-amd64 + - initramfs-tools + - curl + - wget + - vim + - less + - locales + - ca-certificates + - tzdata + +# Configuration files to layer +files: + - source: usr/ + destination: /usr/ + - source: etc/ + destination: /etc/ + - source: config/ + destination: /config/ + +# Firstboot configuration +firstboot: + - usr/share/particle-os/firstboot/setup-system.sh + - usr/share/particle-os/firstboot/configure-network.sh + +# ujust commands +ujust: + - usr/share/particle-os/just/simple-cli.just + +# System configuration +system: + locale: en_US.UTF-8 + timezone: UTC + user: simple + shell: /bin/bash + +# OSTree configuration +ostree: + repo: simple-cli-repo + branch: simple-cli/debian-trixie + mode: archive + +# Boot configuration +boot: + bootloader: bootupd + kernel: linux-image-amd64 + initramfs: initramfs-tools diff --git a/usr/share/particle-os/firstboot/configure-network.sh b/usr/share/particle-os/firstboot/configure-network.sh new file mode 100755 index 0000000..47d05e5 --- /dev/null +++ b/usr/share/particle-os/firstboot/configure-network.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# Simple CLI Network Configuration Script +# Based on Aurora's network configuration pattern + +set -euo pipefail + +echo "=== Configuring Network ===" + +# Enable network services +echo "Enabling network services..." +systemctl enable systemd-networkd +systemctl enable systemd-resolved + +# Configure network interfaces +echo "Configuring network interfaces..." +cat > /etc/systemd/network/10-eth0.network << EOF +[Match] +Name=eth0 + +[Network] +DHCP=yes +IPv6AcceptRA=yes +EOF + +# Configure wireless if available +if [ -d /sys/class/net/wlan0 ]; then + echo "Configuring wireless network..." + cat > /etc/systemd/network/25-wireless.network << EOF +[Match] +Name=wlan0 + +[Network] +DHCP=yes +IPv6AcceptRA=yes +EOF +fi + +# Configure DNS +echo "Configuring DNS..." +cat > /etc/systemd/resolved.conf << EOF +[Resolve] +DNS=8.8.8.8 8.8.4.4 +FallbackDNS=1.1.1.1 1.0.0.1 +EOF + +# Start network services +echo "Starting network services..." +systemctl start systemd-networkd +systemctl start systemd-resolved + +echo "=== Network configuration complete ===" +echo "Network services are running" diff --git a/usr/share/particle-os/firstboot/setup-system.sh b/usr/share/particle-os/firstboot/setup-system.sh new file mode 100755 index 0000000..a8cb4dc --- /dev/null +++ b/usr/share/particle-os/firstboot/setup-system.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Simple CLI First Boot Setup Script +# Based on Aurora's firstboot pattern + +set -euo pipefail + +echo "=== Simple CLI First Boot Setup ===" + +# Configure system locale +echo "Configuring locale..." +locale-gen en_US.UTF-8 +update-locale LANG=en_US.UTF-8 + +# Configure timezone +echo "Configuring timezone..." +ln -sf /usr/share/zoneinfo/UTC /etc/localtime + +# Create user directories +echo "Setting up user directories..." +mkdir -p /home/simple/.config +mkdir -p /home/simple/.local/share +chown -R simple:simple /home/simple + +# Configure systemd services +echo "Configuring systemd services..." +systemctl enable systemd-networkd +systemctl enable systemd-resolved +systemctl enable systemd-timesyncd + +# Configure networking +echo "Configuring networking..." +cat > /etc/systemd/network/20-wired.network << EOF +[Match] +Name=en* + +[Network] +DHCP=yes +EOF + +# Configure OSTree +echo "Configuring OSTree..." +mkdir -p /usr/lib/ostree-boot +ostree admin init-fs /usr/lib/ostree-boot + +# Set up bootupd +echo "Configuring bootupd..." +bootupd install + +echo "=== First boot setup complete ===" +echo "System is ready for use!" diff --git a/usr/share/particle-os/just/simple-cli.just b/usr/share/particle-os/just/simple-cli.just new file mode 100644 index 0000000..87ab195 --- /dev/null +++ b/usr/share/particle-os/just/simple-cli.just @@ -0,0 +1,91 @@ +# Simple CLI ujust Commands +# Based on Aurora's ujust pattern + +# Show system information +info: + #!/usr/bin/env bash + echo "=== Simple CLI System Information ===" + echo "OS: $(cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2)" + echo "Kernel: $(uname -r)" + echo "Architecture: $(uname -m)" + echo "Hostname: $(hostname)" + echo "Uptime: $(uptime -p)" + echo "================================" + +# Show OSTree status +ostree-status: + #!/usr/bin/env bash + echo "=== OSTree Status ===" + ostree status + echo "===================" + +# Update system +update: + #!/usr/bin/env bash + echo "Updating Simple CLI system..." + sudo ostree admin upgrade + echo "Update complete. Reboot to apply changes." + +# Show package information +packages: + #!/usr/bin/env bash + echo "=== Installed Packages ===" + dpkg -l | wc -l + echo "=========================" + +# Show system services +services: + #!/usr/bin/env bash + echo "=== System Services ===" + systemctl list-units --type=service --state=running + echo "======================" + +# Show network status +network: + #!/usr/bin/env bash + echo "=== Network Status ===" + ip addr show + echo "=====================" + +# Show disk usage +disk: + #!/usr/bin/env bash + echo "=== Disk Usage ===" + df -h + echo "=================" + +# Show memory usage +memory: + #!/usr/bin/env bash + echo "=== Memory Usage ===" + free -h + echo "===================" + +# Show process information +processes: + #!/usr/bin/env bash + echo "=== Top Processes ===" + ps aux --sort=-%cpu | head -10 + echo "====================" + +# Show system logs +logs: + #!/usr/bin/env bash + echo "=== Recent System Logs ===" + journalctl -n 20 --no-pager + echo "=========================" + +# Help command +help: + @echo "Simple CLI ujust Commands:" + @echo " info - Show system information" + @echo " ostree-status - Show OSTree status" + @echo " update - Update system" + @echo " packages - Show package count" + @echo " services - Show running services" + @echo " network - Show network status" + @echo " disk - Show disk usage" + @echo " memory - Show memory usage" + @echo " processes - Show top processes" + @echo " logs - Show recent logs" + @echo " help - Show this help"