#!/bin/bash # guardctl - unified CLI for guard-lib's file-guard and package-block primitives. set -euo pipefail GUARD_LIB_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # When installed to /usr/local/bin, lib/ lives alongside it at # /usr/local/lib/guard-lib; fall back to the repo layout for local runs. if [[ -d "$GUARD_LIB_ROOT/lib" ]]; then LIB_DIR="$GUARD_LIB_ROOT/lib" elif [[ -d "/usr/local/lib/guard-lib" ]]; then LIB_DIR="/usr/local/lib/guard-lib" else echo "guardctl: error: cannot locate lib/ directory" >&2 exit 1 fi # shellcheck source=lib/common.sh source "$LIB_DIR/common.sh" # shellcheck source=lib/file_guard.sh source "$LIB_DIR/file_guard.sh" # shellcheck source=lib/package_block.sh source "$LIB_DIR/package_block.sh" usage() { cat <<'EOF' Usage: guardctl [args...] Primitives: file-guard install --target [--canonical ] [--bind-mount] [--plugin