#!/bin/bash echo "=== Restoring Working apt-ostree State ===" echo "" # Check current git status echo "1. Checking current git status..." if command -v git &> /dev/null; then echo "Current branch:" git branch --show-current 2>/dev/null || echo "Could not determine branch" echo "" echo "Recent commits:" git log --oneline -5 2>/dev/null || echo "Could not get git log" echo "" echo "Git status:" git status --porcelain 2>/dev/null || echo "Could not get git status" else echo "Git not available" fi echo "" echo "2. Checking for working OCI implementation..." # Check if OCI implementation is commented out if grep -q "// TODO: OCI image building not yet implemented" src/main.rs; then echo "❌ OCI implementation is commented out (broken state)" echo " This matches the reverted state you mentioned" else echo "✅ OCI implementation appears to be active" fi # Check for bubblewrap integration if [ -f "src/bubblewrap_sandbox.rs" ]; then echo "✅ Bubblewrap integration exists" else echo "❌ Bubblewrap integration missing" fi # Check for OCI module if [ -f "src/oci.rs" ]; then echo "✅ OCI module exists" else echo "❌ OCI module missing" fi echo "" echo "3. Checking for working daemon..." # Check if daemon binary exists if [ -f "/usr/libexec/apt-ostreed" ]; then echo "✅ Daemon binary exists at /usr/libexec/apt-ostreed" else echo "❌ Daemon binary missing" fi # Check if CLI binary exists if [ -f "/usr/bin/apt-ostree" ]; then echo "✅ CLI binary exists at /usr/bin/apt-ostree" else echo "❌ CLI binary missing" fi echo "" echo "=== RECOVERY OPTIONS ===" echo "" echo "Based on the analysis, here are your options:" echo "" echo "Option 1: Restore from git history" echo " git log --oneline -20 # Find the working commit" echo " git checkout # Switch to working commit" echo " git checkout -b working-restore # Create new branch" echo "" echo "Option 2: Fix the current implementation" echo " # Uncomment the OCI implementation in src/main.rs" echo " # Lines 692-705 need to be uncommented" echo "" echo "Option 3: Rebuild from scratch" echo " cargo build --release" echo " sudo cp target/release/apt-ostree /usr/bin/apt-ostree" echo " sudo cp target/release/apt-ostreed /usr/libexec/apt-ostreed" echo "" echo "Option 4: Check remote repository" echo " git remote -v" echo " git fetch origin" echo " git log origin/main --oneline -10" echo "" echo "The issue is that you pushed a commit that reverted the working OCI implementation." echo "You need to either restore from a previous commit or fix the current implementation."