Phase 2.2: Basic ComposeFS Integration - Implemented comprehensive layer management with atomic operations, validation, testing, and rollback capabilities
Some checks failed
Compile apt-layer (v2) / compile (push) Has been cancelled

This commit is contained in:
robojerk 2025-07-15 12:21:34 -07:00
parent 703577e88a
commit 5089ee421f
4 changed files with 1327 additions and 1 deletions

View file

@ -589,6 +589,17 @@ BASIC LAYER CREATION:
apt-layer dpkg-analyze validate <deb-file> [validation-mode]
apt-layer dpkg-analyze install <deb-file> <target-dir> [preserve-metadata]
# Basic ComposeFS Integration (Phase 2.2)
apt-layer composefs create <source-dir> <layer-path> [layer-name]
apt-layer composefs atomic-create <source-dir> <layer-path> [layer-name] [preserve-metadata] [conflict-resolution]
apt-layer composefs mount <layer-path> <mount-point>
apt-layer composefs unmount <mount-point>
apt-layer composefs compose <base-layer> <overlay-layer> <output-layer> [conflict-resolution]
apt-layer composefs validate <layer-path>
apt-layer composefs test <layer-path> [test-mount-point]
apt-layer composefs rollback <current-layer> <backup-layer>
apt-layer composefs status
LIVE SYSTEM MANAGEMENT:
# Install packages on running system
apt-layer --live-install firefox
@ -995,6 +1006,126 @@ main() {
esac
exit 0
;;
composefs)
# Basic ComposeFS Integration (Phase 2.2)
local subcommand="${2:-}"
case "$subcommand" in
create)
local source_dir="${3:-}"
local layer_path="${4:-}"
local layer_name="${5:-}"
if [[ -z "$source_dir" ]] || [[ -z "$layer_path" ]]; then
log_error "Source directory and layer path required" "apt-layer"
log_info "Usage: apt-layer composefs create <source-dir> <layer-path> [layer-name]" "apt-layer"
show_usage
exit 1
fi
shift 2
create_composefs_layer "$source_dir" "$layer_path" "$layer_name"
;;
atomic-create)
local source_dir="${3:-}"
local layer_path="${4:-}"
local layer_name="${5:-}"
local preserve_metadata="${6:-true}"
local conflict_resolution="${7:-keep-latest}"
if [[ -z "$source_dir" ]] || [[ -z "$layer_path" ]]; then
log_error "Source directory and layer path required" "apt-layer"
log_info "Usage: apt-layer composefs atomic-create <source-dir> <layer-path> [layer-name] [preserve-metadata] [conflict-resolution]" "apt-layer"
show_usage
exit 1
fi
shift 2
atomic_create_composefs_layer "$source_dir" "$layer_path" "$layer_name" "$preserve_metadata" "$conflict_resolution"
;;
mount)
local layer_path="${3:-}"
local mount_point="${4:-}"
if [[ -z "$layer_path" ]] || [[ -z "$mount_point" ]]; then
log_error "Layer path and mount point required" "apt-layer"
log_info "Usage: apt-layer composefs mount <layer-path> <mount-point>" "apt-layer"
show_usage
exit 1
fi
shift 2
mount_composefs_layer "$layer_path" "$mount_point"
;;
unmount)
local mount_point="${3:-}"
if [[ -z "$mount_point" ]]; then
log_error "Mount point required" "apt-layer"
log_info "Usage: apt-layer composefs unmount <mount-point>" "apt-layer"
show_usage
exit 1
fi
shift 2
unmount_composefs_layer "$mount_point"
;;
compose)
local base_layer="${3:-}"
local overlay_layer="${4:-}"
local output_layer="${5:-}"
local conflict_resolution="${6:-keep-latest}"
if [[ -z "$base_layer" ]] || [[ -z "$overlay_layer" ]] || [[ -z "$output_layer" ]]; then
log_error "Base layer, overlay layer, and output layer required" "apt-layer"
log_info "Usage: apt-layer composefs compose <base-layer> <overlay-layer> <output-layer> [conflict-resolution]" "apt-layer"
show_usage
exit 1
fi
shift 2
compose_composefs_layers "$base_layer" "$overlay_layer" "$output_layer" "$conflict_resolution"
;;
validate)
local layer_path="${3:-}"
if [[ -z "$layer_path" ]]; then
log_error "Layer path required" "apt-layer"
log_info "Usage: apt-layer composefs validate <layer-path>" "apt-layer"
show_usage
exit 1
fi
shift 2
validate_layer_integrity "$layer_path"
;;
test)
local layer_path="${3:-}"
local test_mount_point="${4:-}"
if [[ -z "$layer_path" ]]; then
log_error "Layer path required" "apt-layer"
log_info "Usage: apt-layer composefs test <layer-path> [test-mount-point]" "apt-layer"
show_usage
exit 1
fi
if [[ -z "$test_mount_point" ]]; then
test_mount_point=$(mktemp -d)
fi
shift 2
test_composefs_layer "$layer_path" "$test_mount_point"
;;
rollback)
local current_layer="${3:-}"
local backup_layer="${4:-}"
if [[ -z "$current_layer" ]] || [[ -z "$backup_layer" ]]; then
log_error "Current layer and backup layer required" "apt-layer"
log_info "Usage: apt-layer composefs rollback <current-layer> <backup-layer>" "apt-layer"
show_usage
exit 1
fi
shift 2
rollback_composefs_layer "$current_layer" "$backup_layer"
;;
status)
shift 2
composefs_status
;;
*)
log_error "Invalid composefs subcommand: $subcommand" "apt-layer"
log_info "Valid subcommands: create, atomic-create, mount, unmount, compose, validate, test, rollback, status" "apt-layer"
show_usage
exit 1
;;
esac
exit 0
;;
--list)
list_branches
exit 0