From de284944344a9746cf4d7465e3b23a2018a2ecba Mon Sep 17 00:00:00 2001 From: Arve Knudsen Date: Thu, 25 Jan 2024 14:27:43 +0100 Subject: [PATCH] Make update-copy.sh work for both OSX and GNU sed Signed-off-by: Arve Knudsen --- storage/remote/otlptranslator/update-copy.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/storage/remote/otlptranslator/update-copy.sh b/storage/remote/otlptranslator/update-copy.sh index ee7198706..10dc194d0 100755 --- a/storage/remote/otlptranslator/update-copy.sh +++ b/storage/remote/otlptranslator/update-copy.sh @@ -18,5 +18,10 @@ rm -rf ./prometheus/*_test.go rm -rf ./tmp -sed -i 's#github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus#github.com/prometheus/prometheus/storage/remote/otlptranslator/prometheus#g' ./prometheusremotewrite/*.go -sed -i '1s#^#// DO NOT EDIT. COPIED AS-IS. SEE ../README.md\n\n#g' ./prometheusremotewrite/*.go ./prometheus/*.go +case $(sed --help 2>&1) in + *GNU*) set sed -i;; + *) set sed -i '';; +esac + +"$@" -e 's#github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus#github.com/prometheus/prometheus/storage/remote/otlptranslator/prometheus#g' ./prometheusremotewrite/*.go +"$@" -e '1s#^#// DO NOT EDIT. COPIED AS-IS. SEE ../README.md\n\n#g' ./prometheusremotewrite/*.go ./prometheus/*.go