Skip to content

Commit

Permalink
Make build script compatible with older gzip (prometheus#11256)
Browse files Browse the repository at this point in the history
* Add RHEL7 compatibility for gzip options

Signed-off-by: Matthew Themis <matthew.themis@anatwine.com>
Signed-off-by: Matt <33697686+mttradebyte@users.noreply.github.com>
Co-authored-by: Julien Pivotto <roidelapluie@o11y.eu>
  • Loading branch information
mttradebyte and roidelapluie authored Sep 6, 2022
1 parent fc1a36d commit 7541baf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/compress_assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ set -euo pipefail

cd web/ui
cp embed.go.tmpl embed.go

GZIP_OPTS="-fk"
# gzip option '-k' may not always exist in the latest gzip available on different distros.
if ! gzip -k -h &>/dev/null; then GZIP_OPTS="-f"; fi

find static -type f -name '*.gz' -delete
find static -type f -exec gzip -fk '{}' \; -print0 | xargs -0 -I % echo %.gz | xargs echo //go:embed >> embed.go
find static -type f -exec gzip $GZIP_OPTS '{}' \; -print0 | xargs -0 -I % echo %.gz | xargs echo //go:embed >> embed.go
echo var EmbedFS embed.FS >> embed.go

0 comments on commit 7541baf

Please sign in to comment.