feat: Integrate apt-layer.sh with apt-ostree.py daemon via D-Bus
Some checks failed
Compile apt-layer (v2) / compile (push) Has been cancelled
Some checks failed
Compile apt-layer (v2) / compile (push) Has been cancelled
- Added 20-daemon-integration.sh scriptlet for D-Bus and daemon lifecycle management - Updated 99-main.sh with new daemon subcommands (start, stop, status, install, uninstall, test, layer, deploy, upgrade, rollback) - Enhanced help and usage text for daemon integration - Fixed bash syntax errors in daemon integration scriptlet - Updated compile.sh to include daemon integration in build process - Updated .gitignore to exclude src/rpm-ostree/ reference source - Updated CHANGELOG.md and TODO.md to document daemon integration milestone - Removed src/rpm-ostree/ from git tracking (reference only, not committed)
This commit is contained in:
parent
b913406438
commit
a23b4e53fd
69 changed files with 24120 additions and 8 deletions
655
apt-layer.sh
655
apt-layer.sh
|
|
@ -6,7 +6,7 @@
|
|||
# DO NOT modify this file directly as it will be overwritten #
|
||||
# #
|
||||
# apt-layer Tool #
|
||||
# Generated on: 2025-07-15 12:37:54 #
|
||||
# Generated on: 2025-07-15 16:55:26 #
|
||||
# #
|
||||
################################################################################################################
|
||||
|
||||
|
|
@ -7108,6 +7108,498 @@ validate_maintainer_scripts() {
|
|||
|
||||
# --- END OF SCRIPTLET: 15-ostree-atomic.sh ---
|
||||
|
||||
# ============================================================================
|
||||
# Daemon Integration (apt-ostree.py)
|
||||
# ============================================================================
|
||||
# ============================================================================
|
||||
# Daemon Integration (apt-ostree.py)
|
||||
# ============================================================================
|
||||
# Integration with apt-ostree.py daemon for atomic operations
|
||||
# Provides D-Bus client functionality for apt-layer.sh
|
||||
|
||||
# D-Bus service and interface names
|
||||
APT_OSTREE_DBUS_SERVICE="org.debian.aptostree1"
|
||||
APT_OSTREE_DBUS_PATH="/org/debian/aptostree1/Sysroot"
|
||||
APT_OSTREE_DBUS_INTERFACE="org.debian.aptostree1.Sysroot"
|
||||
|
||||
# Daemon executable path
|
||||
APT_OSTREE_DAEMON_PATH="/usr/local/bin/apt-ostree.py"
|
||||
APT_OSTREE_DAEMON_SERVICE="apt-ostree.service"
|
||||
|
||||
# Check if daemon is available and running
|
||||
check_daemon_status() {
|
||||
local status="unknown"
|
||||
|
||||
# Check if daemon executable exists
|
||||
if [[ ! -f "$APT_OSTREE_DAEMON_PATH" ]]; then
|
||||
status="not_installed"
|
||||
echo "$status"
|
||||
return
|
||||
fi
|
||||
|
||||
# Check if systemd service is running
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
if systemctl is-active --quiet "$APT_OSTREE_DAEMON_SERVICE" 2>/dev/null; then
|
||||
status="running"
|
||||
elif systemctl is-enabled --quiet "$APT_OSTREE_DAEMON_SERVICE" 2>/dev/null; then
|
||||
status="enabled"
|
||||
else
|
||||
status="disabled"
|
||||
fi
|
||||
else
|
||||
# Fallback: check if daemon process is running
|
||||
if pgrep -f "apt-ostree.py" >/dev/null 2>&1; then
|
||||
status="running"
|
||||
else
|
||||
status="stopped"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$status"
|
||||
}
|
||||
|
||||
# Start the daemon if not running
|
||||
start_daemon() {
|
||||
local status=$(check_daemon_status)
|
||||
|
||||
case "$status" in
|
||||
"not_installed")
|
||||
log_error "apt-ostree daemon not installed" "apt-layer"
|
||||
log_info "Install the daemon first: sudo $APT_OSTREE_DAEMON_PATH --install" "apt-layer"
|
||||
return 1
|
||||
;;
|
||||
"running")
|
||||
log_info "Daemon is already running" "apt-layer"
|
||||
return 0
|
||||
;;
|
||||
"enabled"|"disabled")
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
log_info "Starting daemon via systemctl..." "apt-layer"
|
||||
if systemctl start "$APT_OSTREE_DAEMON_SERVICE"; then
|
||||
log_success "Daemon started successfully" "apt-layer"
|
||||
return 0
|
||||
else
|
||||
log_error "Failed to start daemon via systemctl" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
log_warning "systemctl not available, attempting direct start" "apt-layer"
|
||||
nohup "$APT_OSTREE_DAEMON_PATH" >/dev/null 2>&1 &
|
||||
if [ $? -eq 0 ]; then
|
||||
log_success "Daemon started in background" "apt-layer"
|
||||
return 0
|
||||
else
|
||||
log_error "Failed to start daemon directly" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
"stopped")
|
||||
log_info "Starting daemon..." "apt-layer"
|
||||
nohup "$APT_OSTREE_DAEMON_PATH" >/dev/null 2>&1 &
|
||||
if [ $? -eq 0 ]; then
|
||||
log_success "Daemon started in background" "apt-layer"
|
||||
return 0
|
||||
else
|
||||
log_error "Failed to start daemon" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
log_error "Unknown daemon status: $status" "apt-layer"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Stop the daemon
|
||||
stop_daemon() {
|
||||
local status=$(check_daemon_status)
|
||||
|
||||
case "$status" in
|
||||
"running")
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
log_info "Stopping daemon via systemctl..." "apt-layer"
|
||||
systemctl stop "$APT_OSTREE_DAEMON_SERVICE"
|
||||
else
|
||||
log_info "Stopping daemon process..." "apt-layer"
|
||||
pkill -f "apt-ostree.py"
|
||||
fi
|
||||
log_success "Daemon stopped" "apt-layer"
|
||||
;;
|
||||
"stopped"|"disabled")
|
||||
log_info "Daemon is not running" "apt-layer"
|
||||
;;
|
||||
"not_installed")
|
||||
log_warning "Daemon not installed" "apt-layer"
|
||||
;;
|
||||
*)
|
||||
log_warning "Unknown daemon status: $status" "apt-layer"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Check if D-Bus is available
|
||||
check_dbus_available() {
|
||||
if ! command -v dbus-send >/dev/null 2>&1; then
|
||||
log_error "D-Bus client not available" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! dbus-send --system --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames >/dev/null 2>&1; then
|
||||
log_error "D-Bus system bus not accessible" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Call D-Bus method
|
||||
call_dbus_method() {
|
||||
local method="$1"
|
||||
local args="${2:-}"
|
||||
local timeout="${3:-5000}"
|
||||
|
||||
if ! check_dbus_available; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Ensure daemon is running
|
||||
if ! start_daemon; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Wait a moment for daemon to fully start
|
||||
sleep 1
|
||||
|
||||
# Call the D-Bus method
|
||||
local dbus_cmd="dbus-send --system --dest=$APT_OSTREE_DBUS_SERVICE --type=method_call --print-reply --reply-timeout=$timeout $APT_OSTREE_DBUS_PATH $APT_OSTREE_DBUS_INTERFACE.$method"
|
||||
|
||||
if [[ -n "$args" ]]; then
|
||||
dbus_cmd="$dbus_cmd $args"
|
||||
fi
|
||||
|
||||
log_debug "Calling D-Bus method: $method" "apt-layer"
|
||||
|
||||
if eval "$dbus_cmd" 2>/dev/null; then
|
||||
return 0
|
||||
else
|
||||
log_error "D-Bus method call failed: $method" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Get daemon status via D-Bus
|
||||
get_daemon_status() {
|
||||
call_dbus_method "GetStatus"
|
||||
}
|
||||
|
||||
# Register client with daemon
|
||||
register_client() {
|
||||
local client_id="${1:-apt-layer}"
|
||||
local options="dict:string:id,$client_id"
|
||||
|
||||
call_dbus_method "RegisterClient" "$options"
|
||||
}
|
||||
|
||||
# Unregister client from daemon
|
||||
unregister_client() {
|
||||
call_dbus_method "UnregisterClient" "dict:"
|
||||
}
|
||||
|
||||
# Get OS deployments via D-Bus
|
||||
get_os_deployments() {
|
||||
call_dbus_method "GetOS"
|
||||
}
|
||||
|
||||
# Start a transaction via daemon
|
||||
start_daemon_transaction() {
|
||||
local operation="$1"
|
||||
local description="$2"
|
||||
local packages="${3:-}"
|
||||
|
||||
# Register as client first
|
||||
register_client "apt-layer-$$"
|
||||
|
||||
# Start transaction (this would need to be implemented in the daemon)
|
||||
# For now, we'll use a placeholder
|
||||
log_transaction "Starting daemon transaction: $operation - $description" "apt-layer"
|
||||
|
||||
# Store transaction info for cleanup
|
||||
echo "$$:$operation:$description" > "$TRANSACTION_STATE"
|
||||
}
|
||||
|
||||
# Commit a transaction via daemon
|
||||
commit_daemon_transaction() {
|
||||
local transaction_id="${1:-}"
|
||||
|
||||
if [[ -n "$transaction_id" ]]; then
|
||||
log_transaction "Committing daemon transaction: $transaction_id" "apt-layer"
|
||||
# This would call the daemon's commit method
|
||||
fi
|
||||
|
||||
# Unregister client
|
||||
unregister_client
|
||||
|
||||
# Clear transaction state
|
||||
rm -f "$TRANSACTION_STATE"
|
||||
}
|
||||
|
||||
# Rollback a transaction via daemon
|
||||
rollback_daemon_transaction() {
|
||||
local transaction_id="${1:-}"
|
||||
|
||||
if [[ -n "$transaction_id" ]]; then
|
||||
log_transaction "Rolling back daemon transaction: $transaction_id" "apt-layer"
|
||||
# This would call the daemon's rollback method
|
||||
fi
|
||||
|
||||
# Unregister client
|
||||
unregister_client
|
||||
|
||||
# Clear transaction state
|
||||
rm -f "$TRANSACTION_STATE"
|
||||
}
|
||||
|
||||
# Layer packages via daemon
|
||||
daemon_layer_packages() {
|
||||
local packages=("$@")
|
||||
local operation="layer"
|
||||
local description="Layer packages: ${packages[*]}"
|
||||
|
||||
log_transaction "Starting daemon layer operation" "apt-layer"
|
||||
|
||||
# Start transaction
|
||||
if ! start_daemon_transaction "$operation" "$description" "${packages[*]}"; then
|
||||
log_error "Failed to start daemon transaction" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Perform the layer operation
|
||||
# This would call the daemon's PkgChange method
|
||||
local packages_str=$(printf "%s " "${packages[@]}")
|
||||
local args="array:string:$packages_str array:string: dict:"
|
||||
|
||||
if call_dbus_method "PkgChange" "$args"; then
|
||||
log_success "Daemon layer operation completed" "apt-layer"
|
||||
commit_daemon_transaction
|
||||
return 0
|
||||
else
|
||||
log_error "Daemon layer operation failed" "apt-layer"
|
||||
rollback_daemon_transaction
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Deploy via daemon
|
||||
daemon_deploy() {
|
||||
local deployment_name="$1"
|
||||
local revision="${2:-}"
|
||||
|
||||
log_transaction "Starting daemon deploy operation" "apt-layer"
|
||||
|
||||
# Start transaction
|
||||
if ! start_daemon_transaction "deploy" "Deploy $deployment_name"; then
|
||||
log_error "Failed to start daemon transaction" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Perform the deploy operation
|
||||
local args="string:$revision dict:"
|
||||
|
||||
if call_dbus_method "Deploy" "$args"; then
|
||||
log_success "Daemon deploy operation completed" "apt-layer"
|
||||
commit_daemon_transaction
|
||||
return 0
|
||||
else
|
||||
log_error "Daemon deploy operation failed" "apt-layer"
|
||||
rollback_daemon_transaction
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Upgrade via daemon
|
||||
daemon_upgrade() {
|
||||
log_transaction "Starting daemon upgrade operation" "apt-layer"
|
||||
|
||||
# Start transaction
|
||||
if ! start_daemon_transaction "upgrade" "System upgrade"; then
|
||||
log_error "Failed to start daemon transaction" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Perform the upgrade operation
|
||||
if call_dbus_method "Upgrade" "dict:"; then
|
||||
log_success "Daemon upgrade operation completed" "apt-layer"
|
||||
commit_daemon_transaction
|
||||
return 0
|
||||
else
|
||||
log_error "Daemon upgrade operation failed" "apt-layer"
|
||||
rollback_daemon_transaction
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Rollback via daemon
|
||||
daemon_rollback() {
|
||||
log_transaction "Starting daemon rollback operation" "apt-layer"
|
||||
|
||||
# Start transaction
|
||||
if ! start_daemon_transaction "rollback" "System rollback"; then
|
||||
log_error "Failed to start daemon transaction" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Perform the rollback operation
|
||||
if call_dbus_method "Rollback" "dict:"; then
|
||||
log_success "Daemon rollback operation completed" "apt-layer"
|
||||
commit_daemon_transaction
|
||||
return 0
|
||||
else
|
||||
log_error "Daemon rollback operation failed" "apt-layer"
|
||||
rollback_daemon_transaction
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Show daemon status
|
||||
show_daemon_status() {
|
||||
local status=$(check_daemon_status)
|
||||
|
||||
echo "apt-ostree Daemon Status:"
|
||||
echo " Status: $status"
|
||||
echo " Executable: $APT_OSTREE_DAEMON_PATH"
|
||||
echo " Service: $APT_OSTREE_DAEMON_SERVICE"
|
||||
echo " D-Bus Service: $APT_OSTREE_DBUS_SERVICE"
|
||||
echo " D-Bus Path: $APT_OSTREE_DBUS_PATH"
|
||||
|
||||
if [[ "$status" == "running" ]]; then
|
||||
echo ""
|
||||
echo "D-Bus Status:"
|
||||
if get_daemon_status; then
|
||||
echo " D-Bus communication: OK"
|
||||
else
|
||||
echo " D-Bus communication: FAILED"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "OS Deployments:"
|
||||
if get_os_deployments; then
|
||||
echo " Deployment list: OK"
|
||||
else
|
||||
echo " Deployment list: FAILED"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Install daemon
|
||||
install_daemon() {
|
||||
log_info "Installing apt-ostree daemon..." "apt-layer"
|
||||
|
||||
# Check if Python daemon directory exists
|
||||
local daemon_dir="$(dirname "$0")/../apt-ostree.py/python"
|
||||
if [[ ! -d "$daemon_dir" ]]; then
|
||||
log_error "Daemon source not found: $daemon_dir" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Run the daemon install script
|
||||
if [[ -f "$daemon_dir/install.py" ]]; then
|
||||
if python3 "$daemon_dir/install.py"; then
|
||||
log_success "Daemon installed successfully" "apt-layer"
|
||||
return 0
|
||||
else
|
||||
log_error "Daemon installation failed" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
log_error "Daemon install script not found" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Uninstall daemon
|
||||
uninstall_daemon() {
|
||||
log_info "Uninstalling apt-ostree daemon..." "apt-layer"
|
||||
|
||||
# Stop daemon first
|
||||
stop_daemon
|
||||
|
||||
# Remove systemd service
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
if systemctl is-enabled --quiet "$APT_OSTREE_DAEMON_SERVICE" 2>/dev/null; then
|
||||
systemctl disable "$APT_OSTREE_DAEMON_SERVICE"
|
||||
fi
|
||||
if [[ -f "/etc/systemd/system/$APT_OSTREE_DAEMON_SERVICE" ]]; then
|
||||
rm -f "/etc/systemd/system/$APT_OSTREE_DAEMON_SERVICE"
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove daemon executable
|
||||
if [[ -f "$APT_OSTREE_DAEMON_PATH" ]]; then
|
||||
rm -f "$APT_OSTREE_DAEMON_PATH"
|
||||
fi
|
||||
|
||||
# Remove Python package
|
||||
if command -v pip3 >/dev/null 2>&1; then
|
||||
pip3 uninstall -y apt-ostree 2>/dev/null || true
|
||||
fi
|
||||
|
||||
log_success "Daemon uninstalled" "apt-layer"
|
||||
}
|
||||
|
||||
# Test daemon functionality
|
||||
test_daemon() {
|
||||
log_info "Testing apt-ostree daemon..." "apt-layer"
|
||||
|
||||
# Check daemon status
|
||||
local status=$(check_daemon_status)
|
||||
if [[ "$status" != "running" ]]; then
|
||||
log_error "Daemon is not running (status: $status)" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Test D-Bus communication
|
||||
if ! get_daemon_status; then
|
||||
log_error "D-Bus communication test failed" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Test client registration
|
||||
if ! register_client "test-client"; then
|
||||
log_error "Client registration test failed" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Test client unregistration
|
||||
if ! unregister_client; then
|
||||
log_error "Client unregistration test failed" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_success "All daemon tests passed" "apt-layer"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Run daemon in foreground (for testing/debugging)
|
||||
run_daemon() {
|
||||
log_info "Starting apt-ostree daemon in foreground..." "apt-layer"
|
||||
|
||||
# Check if daemon executable exists
|
||||
if [[ ! -f "$APT_OSTREE_DAEMON_PATH" ]]; then
|
||||
log_error "Daemon executable not found: $APT_OSTREE_DAEMON_PATH" "apt-layer"
|
||||
log_info "Install the daemon first: sudo $0 daemon install" "apt-layer"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Run daemon in foreground
|
||||
log_info "Running daemon: $APT_OSTREE_DAEMON_PATH" "apt-layer"
|
||||
exec "$APT_OSTREE_DAEMON_PATH"
|
||||
}
|
||||
|
||||
# --- END OF SCRIPTLET: 20-daemon-integration.sh ---
|
||||
|
||||
# ============================================================================
|
||||
# Direct dpkg Installation (Performance Optimization)
|
||||
# ============================================================================
|
||||
|
|
@ -8223,6 +8715,18 @@ Builtin Commands:
|
|||
initramfs Enable or disable local initramfs regeneration
|
||||
usroverlay Apply a transient overlayfs to /usr
|
||||
|
||||
Daemon Management:
|
||||
daemon start Start the apt-ostree daemon
|
||||
daemon stop Stop the apt-ostree daemon
|
||||
daemon status Show daemon status
|
||||
daemon install Install the apt-ostree daemon
|
||||
daemon uninstall Uninstall the apt-ostree daemon
|
||||
daemon test Test daemon functionality
|
||||
daemon layer Layer packages via daemon
|
||||
daemon deploy Deploy via daemon
|
||||
daemon upgrade Upgrade via daemon
|
||||
daemon rollback Rollback via daemon
|
||||
|
||||
Layer Management:
|
||||
--container Create layer using container isolation
|
||||
--dpkg-install Install packages using direct dpkg
|
||||
|
|
@ -8347,6 +8851,37 @@ rpm-ostree COMPATIBILITY:
|
|||
apt-layer composefs action [args...]
|
||||
# Manage ComposeFS (rpm-ostree composefs compatibility)
|
||||
|
||||
DAEMON MANAGEMENT:
|
||||
apt-layer daemon start
|
||||
# Start the apt-ostree daemon
|
||||
|
||||
apt-layer daemon stop
|
||||
# Stop the apt-ostree daemon
|
||||
|
||||
apt-layer daemon status
|
||||
# Show daemon status and health
|
||||
|
||||
apt-layer daemon install
|
||||
# Install the apt-ostree daemon
|
||||
|
||||
apt-layer daemon uninstall
|
||||
# Uninstall the apt-ostree daemon
|
||||
|
||||
apt-layer daemon test
|
||||
# Test daemon functionality
|
||||
|
||||
apt-layer daemon layer packages
|
||||
# Layer packages via daemon (atomic operations)
|
||||
|
||||
apt-layer daemon deploy deployment-name [revision]
|
||||
# Deploy specific revision via daemon
|
||||
|
||||
apt-layer daemon upgrade
|
||||
# Upgrade system via daemon
|
||||
|
||||
apt-layer daemon rollback
|
||||
# Rollback system via daemon
|
||||
|
||||
IMAGE MANAGEMENT:
|
||||
apt-layer --list
|
||||
# List all available ComposeFS images/layers
|
||||
|
|
@ -8755,6 +9290,50 @@ Examples:
|
|||
EOF
|
||||
}
|
||||
|
||||
show_daemon_help() {
|
||||
cat << 'EOF'
|
||||
Daemon Management Commands
|
||||
|
||||
DAEMON CONTROL:
|
||||
apt-layer daemon start
|
||||
# Start the apt-ostree daemon
|
||||
|
||||
apt-layer daemon stop
|
||||
# Stop the apt-ostree daemon
|
||||
|
||||
apt-layer daemon status
|
||||
# Show daemon status and health
|
||||
|
||||
apt-layer daemon install
|
||||
# Install the apt-ostree daemon
|
||||
|
||||
apt-layer daemon uninstall
|
||||
# Uninstall the apt-ostree daemon
|
||||
|
||||
apt-layer daemon test
|
||||
# Test daemon functionality
|
||||
|
||||
ATOMIC OPERATIONS:
|
||||
apt-layer daemon layer packages
|
||||
# Layer packages via daemon (atomic operations)
|
||||
|
||||
apt-layer daemon deploy deployment-name [revision]
|
||||
# Deploy specific revision via daemon
|
||||
|
||||
apt-layer daemon upgrade
|
||||
# Upgrade system via daemon
|
||||
|
||||
apt-layer daemon rollback
|
||||
# Rollback system via daemon
|
||||
|
||||
Examples:
|
||||
apt-layer daemon start
|
||||
apt-layer daemon status
|
||||
apt-layer daemon layer firefox steam
|
||||
apt-layer daemon upgrade
|
||||
EOF
|
||||
}
|
||||
|
||||
# Show examples
|
||||
show_examples() {
|
||||
cat << 'EOF'
|
||||
|
|
@ -9153,6 +9732,12 @@ main() {
|
|||
exit 0
|
||||
fi
|
||||
;;
|
||||
daemon)
|
||||
if [[ "${2:-}" == "--help" || "${2:-}" == "-h" ]]; then
|
||||
show_daemon_help
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
dpkg-analyze)
|
||||
# Deep dpkg analysis and metadata extraction
|
||||
local subcommand="${2:-}"
|
||||
|
|
@ -9783,9 +10368,71 @@ main() {
|
|||
exit 0
|
||||
;;
|
||||
daemon)
|
||||
# Run in daemon mode
|
||||
shift 1
|
||||
run_daemon
|
||||
# Daemon management and integration
|
||||
local subcommand="${2:-}"
|
||||
case "$subcommand" in
|
||||
start)
|
||||
shift 2
|
||||
start_daemon
|
||||
;;
|
||||
stop)
|
||||
shift 2
|
||||
stop_daemon
|
||||
;;
|
||||
status)
|
||||
shift 2
|
||||
show_daemon_status
|
||||
;;
|
||||
install)
|
||||
shift 2
|
||||
install_daemon
|
||||
;;
|
||||
uninstall)
|
||||
shift 2
|
||||
uninstall_daemon
|
||||
;;
|
||||
test)
|
||||
shift 2
|
||||
test_daemon
|
||||
;;
|
||||
layer)
|
||||
shift 2
|
||||
if [[ $# -eq 0 ]]; then
|
||||
log_error "Packages required for daemon layering" "apt-layer"
|
||||
log_info "Usage: apt-layer daemon layer <package1> [package2] ..." "apt-layer"
|
||||
show_usage
|
||||
exit 1
|
||||
fi
|
||||
daemon_layer_packages "$@"
|
||||
;;
|
||||
deploy)
|
||||
local deployment_name="${3:-}"
|
||||
local revision="${4:-}"
|
||||
if [[ -z "$deployment_name" ]]; then
|
||||
log_error "Deployment name required" "apt-layer"
|
||||
log_info "Usage: apt-layer daemon deploy <deployment-name> [revision]" "apt-layer"
|
||||
show_usage
|
||||
exit 1
|
||||
fi
|
||||
shift 2
|
||||
daemon_deploy "$deployment_name" "$revision"
|
||||
;;
|
||||
upgrade)
|
||||
shift 2
|
||||
daemon_upgrade
|
||||
;;
|
||||
rollback)
|
||||
shift 2
|
||||
daemon_rollback
|
||||
;;
|
||||
*)
|
||||
log_error "Invalid daemon subcommand: $subcommand" "apt-layer"
|
||||
log_info "Valid subcommands: start, stop, status, install, uninstall, test, layer, deploy, upgrade, rollback" "apt-layer"
|
||||
show_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
;;
|
||||
maintenance)
|
||||
# Run maintenance tasks
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue