#!/bin/bash # Demonstration of working alternative solution # Shows complete Debian Atomic pipeline: debootstrap + ostree โ†’ bootable image set -euo pipefail echo "๐Ÿš€ Debian Atomic Pipeline Demonstration" echo "Using working alternative solution: debootstrap + ostree" echo "=" * 60 # Configuration WORKSPACE_PATH="/home/rob/Documents/Projects/overseer" DEB_BOOTC_PATH="$WORKSPACE_PATH/deb-bootc-image-builder" ATOMIC_CONFIGS_PATH="$WORKSPACE_PATH/debian-atomic-configs" # Step 1: Create OSTree commit using alternative solution echo echo "Step 1: Creating OSTree commit using debootstrap + ostree" echo "Running: create-debian-atomic.py minimal" cd "$ATOMIC_CONFIGS_PATH" # Run the alternative solution with a persistent work directory WORK_DIR="/tmp/debian-atomic-demo" if [[ -d "$WORK_DIR" ]]; then rm -rf "$WORK_DIR" fi echo "Creating persistent build in: $WORK_DIR" if distrobox-enter debian-trixie -- bash -c "cd '$ATOMIC_CONFIGS_PATH' && sudo python3 create-debian-atomic.py minimal '$WORK_DIR'"; then echo "โœ… Step 1 completed: OSTree commit created successfully" else echo "โŒ Step 1 failed" exit 1 fi # Step 2: Verify the repository and commit echo echo "Step 2: Verifying OSTree repository and commit" REPO_PATH="$WORK_DIR/repo" if [[ ! -d "$REPO_PATH" ]]; then echo "โŒ Repository not found at $REPO_PATH" exit 1 fi echo "โœ… Repository found at: $REPO_PATH" # List references echo "Repository references:" ostree refs --repo="$REPO_PATH" || echo "No references found" # List commits echo "Repository commits:" find "$REPO_PATH/objects" -type d -name "????????????????????????????????????????????????????????????????" 2>/dev/null | head -5 || echo "No commits found" # Step 3: Extract rootfs from OSTree commit echo echo "Step 3: Extracting rootfs from OSTree commit" ROOTFS_PATH="/tmp/debian-atomic-rootfs" if [[ -d "$ROOTFS_PATH" ]]; then rm -rf "$ROOTFS_PATH" fi # Get the reference REF_FILE=$(find "$REPO_PATH/refs" -type f | head -1) if [[ -z "$REF_FILE" ]]; then echo "โŒ No reference found" exit 1 fi COMMIT_ID=$(cat "$REF_FILE") echo "Using commit: $COMMIT_ID" # Extract rootfs echo "Extracting rootfs to: $ROOTFS_PATH" if ostree checkout --repo="$REPO_PATH" --subpath=/ "$COMMIT_ID" "$ROOTFS_PATH"; then echo "โœ… Rootfs extracted successfully" else echo "โŒ Failed to extract rootfs" exit 1 fi # Verify rootfs structure if [[ -d "$ROOTFS_PATH/usr" ]] && [[ -d "$ROOTFS_PATH/etc" ]]; then echo "โœ… Rootfs structure verified" else echo "โŒ Invalid rootfs structure" exit 1 fi # Step 4: Create bootable image echo echo "Step 4: Creating bootable image using deb-bootc-image-builder" # Build deb-bootc-image-builder if needed BIB_BIN="$DEB_BOOTC_PATH/bib/create-ostree-bootable-image" if [[ ! -f "$BIB_BIN" ]]; then echo "Building deb-bootc-image-builder..." cd "$DEB_BOOTC_PATH" if ! go build -o bib/create-ostree-bootable-image ./bib/create-ostree-bootable-image.go; then echo "โŒ Failed to build deb-bootc-image-builder" exit 1 fi echo "โœ… deb-bootc-image-builder built successfully" fi # Create bootable image OUTPUT_IMAGE="/tmp/debian-atomic-minimal.img" echo "Creating bootable image: $OUTPUT_IMAGE" if "$BIB_BIN" "$ROOTFS_PATH" "$OUTPUT_IMAGE"; then echo "โœ… Bootable image created successfully" # Show image information if [[ -f "$OUTPUT_IMAGE" ]]; then IMAGE_SIZE=$(du -h "$OUTPUT_IMAGE" | cut -f1) echo "Image size: $IMAGE_SIZE" # Copy to workspace FINAL_IMAGE="$WORKSPACE_PATH/debian-atomic-minimal-demo.img" cp "$OUTPUT_IMAGE" "$FINAL_IMAGE" echo "Image copied to: $FINAL_IMAGE" echo echo "๐ŸŽ‰ Pipeline completed successfully!" echo echo "๐Ÿ“‹ Summary:" echo "โœ… OSTree commit created using debootstrap + ostree" echo "โœ… Rootfs extracted from OSTree commit" echo "โœ… Bootable image created: $FINAL_IMAGE" echo echo "๐Ÿงช To test the image:" echo "qemu-system-x86_64 -m 2G -drive file=$FINAL_IMAGE,format=raw -nographic" else echo "โŒ Output image not found" exit 1 fi else echo "โŒ Failed to create bootable image" exit 1 fi echo echo "๐Ÿ” Repository details:" echo "Repository: $REPO_PATH" echo "Commit: $COMMIT_ID" echo "Rootfs: $ROOTFS_PATH" echo "Image: $OUTPUT_IMAGE" echo echo "๐Ÿ’ก This demonstrates that the alternative solution (debootstrap + ostree)" echo " is fully functional and can generate bootable images, bypassing the" echo " apt-ostree integration issues."