Skip to content

Commit

Permalink
Add masOS compatibility for 'sed' usage in scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Schmid <[email protected]>
  • Loading branch information
PhilipSchmid committed Dec 4, 2023
1 parent 6ab6d21 commit 4637d15
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
16 changes: 9 additions & 7 deletions api/export-doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ cp v1/README.md $TMP_FILE

# cleanup the generated documentation for the website
# remove the link to the top of the page
sed -i '/<p align="right"><a href="#top">Top<\/a><\/p>/d' $TMP_FILE
sed -i '/<a name="top"><\/a>/d' $TMP_FILE
sed -i'' -e '/<p align="right"><a href="#top">Top<\/a><\/p>/d' $TMP_FILE
sed -i'' -e '/<a name="top"><\/a>/d' $TMP_FILE
# remove title
sed -i '/^# Protocol Documentation/d' $TMP_FILE
sed -i'' -e '/^# Protocol Documentation/d' $TMP_FILE
# remove table of content
sed -i -e '/## Table of Contents/,/##/{//!d}' $TMP_FILE
sed -i '/^## Table of Contents/d' $TMP_FILE
sed -i'' -e '/## Table of Contents/,/##/{//!d}' $TMP_FILE
sed -i'' -e '/^## Table of Contents/d' $TMP_FILE
# cleanup unecessary consecutive whitelines
sed -i '/^[[:space:]]*$/N;/^[[:space:]]*\n[[:space:]]*$/D' $TMP_FILE
sed -i'' -e '/^[[:space:]]*$/N;/^[[:space:]]*\n[[:space:]]*$/D' $TMP_FILE

# Cleanup backup file that might be created by macOS sed:
rm ${TMP_FILE}-e 2>/dev/null || true

# add a frontmatter and a small introduction
echo '---
Expand All @@ -42,4 +45,3 @@ The Tetragon API is an independant Go module that can be found in the Tetragon
repository under [api](https://github.com/cilium/tetragon/tree/main/api). The
version 1 of this API is defined in
[github.com/cilium/tetragon/api/v1/tetragon](https://github.com/cilium/tetragon/tree/main/api/v1/tetragon).' | cat - $TMP_FILE > $1

1 change: 0 additions & 1 deletion docs/content/en/docs/reference/helm-chart.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,3 @@ To use [the values available](#values), with `helm install` or `helm upgrade`, u
| tetragonOperator.skipCRDCreation | bool | `false` | |
| tolerations[0].operator | string | `"Exists"` | |
| updateStrategy | object | `{}` | |

17 changes: 9 additions & 8 deletions install/kubernetes/export-doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ cp README.md $TMP_FILE

# cleanup the generated documentation for the website
# remove the title
sed -i '/^# tetragon$/d' $TMP_FILE
sed -i'' -e '/^# tetragon$/d' $TMP_FILE
# remove the badges
sed -i '/^\!\[Version:/d' $TMP_FILE
sed -i'' -e '/^\!\[Version:/d' $TMP_FILE
# remove the "Helm chart for Tetragon mention"
sed -i '/^Helm chart for Tetragon$/d' $TMP_FILE
sed -i'' -e '/^Helm chart for Tetragon$/d' $TMP_FILE
# remove unnecessary line
sed -i '/^----------------------------------------------$/d' $TMP_FILE
sed -i'' -e '/^----------------------------------------------$/d' $TMP_FILE
# remove autogenerated copyright
sed -i '/^Autogenerated from chart metadata using \[helm-docs /d' $TMP_FILE
sed -i'' -e '/^Autogenerated from chart metadata using \[helm-docs /d' $TMP_FILE
# cleanup unecessary consecutive whitelines
sed -i '/^[[:space:]]*$/N;/^[[:space:]]*\n[[:space:]]*$/D' $TMP_FILE
sed -i'' -e '/^[[:space:]]*$/N;/^[[:space:]]*\n[[:space:]]*$/D' $TMP_FILE

# Cleanup backup file that might be created by macOS sed:
rm ${TMP_FILE}-e 2>/dev/null || true

# add a frontmatter and a small introduction
echo '---
Expand All @@ -39,7 +41,7 @@ This page was generated with github.io/cilium/tetragon/install/kubernetes/export
please do not edit directly.
{{< /comment >}}
The Tetragon Helm chart source is available under
The Tetragon Helm chart source is available under
[github.io/cilium/tetragon/install/kubernetes](https://github.com/cilium/tetragon/tree/main/install/kubernetes)
and is distributed from the Cilium helm charts repository [helm.cilium.io](https://helm.cilium.io).
Expand All @@ -51,4 +53,3 @@ helm install tetragon cilium/tetragon -n kube-system
```
To use [the values available](#values), with `helm install` or `helm upgrade`, use `--set key=value`.' | cat - $TMP_FILE > $1

0 comments on commit 4637d15

Please sign in to comment.