debian-bootc-simple/bootc-compat.sh
2025-08-21 07:31:52 -07:00

57 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
set -euo pipefail
if [ ! -d "/ostree/repo/objects" ]; then
echo "Initializing ostree repository..."
ostree admin init-fs / || true
ostree admin stateroot-init debian || true
fi
setup_boot() {
echo "Setting up boot configuration..."
if command -v bootctl &> /dev/null; then
bootctl install --path=/boot || true
fi
if command -v update-grub &> /dev/null; then
update-grub || true
fi
}
setup_deployment() {
echo "Setting up deployment structure..."
mkdir -p /var/lib/containers /etc/containers /usr/lib/bootc
cat > /usr/lib/bootc/status.json << EOJSON
{
"apiVersion": "org.containers.bootc/v1alpha1",
"kind": "BootcHost",
"spec": {
"image": {
"image": "localhost/debian-bootc:latest"
}
},
"status": {
"booted": {
"image": {
"image": "localhost/debian-bootc:latest"
}
}
}
}
EOJSON
}
main() {
echo "Starting Debian bootc compatibility layer..."
setup_deployment
setup_boot
echo "Bootc compatibility setup complete."
if [ "${1:-}" = "--init" ]; then
exec /sbin/init
else
exec "$@"
fi
}
main "$@"