#!/usr/bin/env bash set -u SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) SETUP_SCRIPT="$SCRIPT_DIR/../setup_20.04.sh" fail() { printf 'FAIL: %s\n' "$1" >&2 exit 1 } [ -f "$SETUP_SCRIPT" ] || fail "setup script not found" forbidden_patterns=( 'report_event' 'hub\.2\.chatwoot\.com/events' 'installation_identifier.*event_name' 'raw\.githubusercontent\.com/chatwoot/chatwoot/master/VERSION_CWCTL' 'get\.chatwoot\.app/linux/install\.sh' 'cwctl_upgrade_check' 'upgrade_cwctl' ) for pattern in "${forbidden_patterns[@]}"; do if grep -E -q "$pattern" "$SETUP_SCRIPT"; then fail "forbidden cwctl telemetry or vendor updater pattern: $pattern" else grep_status=$? if [ "$grep_status" -ne 1 ]; then fail "unable to scan setup script for pattern: $pattern (grep status $grep_status)" fi fi done printf '%s\n' 'PASS: cwctl privacy test'