#!/bin/bash set -euo pipefail # Renders a file that is compiled into the agent so it can identify its own # versions and the version of collectd it is using. # Caller must set the envvars used in the template. SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" target_file=${1-"$SCRIPT_DIR/../internal/core/common/constants/versions.go"} old_content=$(cat $target_file 2>/dev/null || echo -n "") new_content=$(eval "cat < $target_file