From 6502092087f752f6734f4991196ec2f1de9693c2 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Fri, 26 Dec 2025 12:11:18 +0000 Subject: [PATCH] fix: Add --disk-exclude support to install script Users can now pass disk exclusion patterns during agent installation: curl ... | bash -s -- --disk-exclude '/mnt/*' --url ... --token ... The flag is repeatable for multiple exclusion patterns. Related to #896 --- scripts/install.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index 9b4472ca0..fd07be647 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -16,6 +16,7 @@ # --disable-proxmox Disable Proxmox integration even if detected # --interval Reporting interval (default: 30s) # --agent-id Custom agent identifier (default: auto-generated) +# --disk-exclude Exclude mount points matching pattern (repeatable) # --insecure Skip TLS certificate verification # --enable-commands Enable AI command execution on agent (disabled by default) # --uninstall Remove the agent @@ -74,6 +75,7 @@ UNINSTALL="false" INSECURE="false" AGENT_ID="" ENABLE_COMMANDS="false" +DISK_EXCLUDES=() # Array for multiple --disk-exclude values # Track if flags were explicitly set (to override auto-detection) DOCKER_EXPLICIT="false" @@ -172,6 +174,10 @@ build_exec_args() { if [[ "$INSECURE" == "true" ]]; then EXEC_ARGS="$EXEC_ARGS --insecure"; fi if [[ "$ENABLE_COMMANDS" == "true" ]]; then EXEC_ARGS="$EXEC_ARGS --enable-commands"; fi if [[ -n "$AGENT_ID" ]]; then EXEC_ARGS="$EXEC_ARGS --agent-id ${AGENT_ID}"; fi + # Add disk exclude patterns + for pattern in "${DISK_EXCLUDES[@]}"; do + EXEC_ARGS="$EXEC_ARGS --disk-exclude '${pattern}'" + done } # Build exec args as array for direct execution (proper quoting) @@ -191,6 +197,10 @@ build_exec_args_array() { if [[ "$INSECURE" == "true" ]]; then EXEC_ARGS_ARRAY+=(--insecure); fi if [[ "$ENABLE_COMMANDS" == "true" ]]; then EXEC_ARGS_ARRAY+=(--enable-commands); fi if [[ -n "$AGENT_ID" ]]; then EXEC_ARGS_ARRAY+=(--agent-id "$AGENT_ID"); fi + # Add disk exclude patterns + for pattern in "${DISK_EXCLUDES[@]}"; do + EXEC_ARGS_ARRAY+=(--disk-exclude "$pattern") + done } # --- Parse Arguments --- @@ -212,6 +222,7 @@ while [[ $# -gt 0 ]]; do --enable-commands) ENABLE_COMMANDS="true"; shift ;; --uninstall) UNINSTALL="true"; shift ;; --agent-id) AGENT_ID="$2"; shift 2 ;; + --disk-exclude) DISK_EXCLUDES+=("$2"); shift 2 ;; *) fail "Unknown argument: $1" ;; esac done @@ -675,6 +686,12 @@ if [[ "$OS" == "darwin" ]]; then --agent-id ${AGENT_ID}" fi + # Add disk exclude patterns + for pattern in "${DISK_EXCLUDES[@]}"; do + PLIST_ARGS="${PLIST_ARGS} + --disk-exclude + ${pattern}" + done cat > "$PLIST" <