File tree Expand file tree Collapse file tree
reference-crs-kube-compare
reference-crs/required/gitops
telco-ran/configuration/hack Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ sedi () { sed --version 2> /dev/null | grep -q GNU && sed -i " $@ " || sed -i ' ' " $@ " ; }
4+
35trap cleanup EXIT
46
57function cleanup() {
@@ -41,8 +43,8 @@ function compare_cr {
4143 while IFS= read -r file; do
4244 [[ ${file:: 1} != " #" ]] || continue # Skip any comment lines in the exclusionfile
4345 [[ -n ${file} ]] || continue # Skip empty lines
44- sed -i " /${file##*/ } /d" source_file
45- sed -i " /${file##*/ } /d" rendered_file
46+ sedi " /${file##*/ } /d" source_file
47+ sedi " /${file##*/ } /d" rendered_file
4648 done < <( cat same_file " $exclusionfile " )
4749
4850 if [[ -s source_file || -s rendered_file ]]; then
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ sedi () { sed --version 2> /dev/null | grep -q GNU && sed -i " $@ " || sed -i ' ' " $@ " ; }
4+
35trap cleanup EXIT
46
57function cleanup() {
@@ -38,8 +40,8 @@ function compare_cr {
3840 while IFS= read -r file; do
3941 [[ ${file:: 1} != " #" ]] || continue # Skip any comment lines in the exclusionfile
4042 [[ -n ${file} ]] || continue # Skip empty lines
41- sed -i " /${file##*/ } /d" source_file
42- sed -i " /${file##*/ } /d" rendered_file
43+ sedi " /${file##*/ } /d" source_file
44+ sedi " /${file##*/ } /d" rendered_file
4345 done < " $exclusionfile "
4446
4547 local source_cr rendered
@@ -65,8 +67,8 @@ function compare_cr {
6567 while IFS= read -r file; do
6668 [[ ${file:: 1} != " #" ]] || continue # Skip any comment lines in the exclusionfile
6769 [[ -n ${file} ]] || continue # Skip empty lines
68- sed -i " /${file##*/ } /d" source_file
69- sed -i " /${file##*/ } /d" rendered_file
70+ sedi " /${file##*/ } /d" source_file
71+ sedi " /${file##*/ } /d" rendered_file
7072 done < <( cat same_file " $exclusionfile " )
7173
7274 if [[ -s source_file || -s rendered_file ]]; then
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ sedi () { sed --version 2> /dev/null | grep -q GNU && sed -i " $@ " || sed -i ' ' " $@ " ; }
4+
35# This script is only needed to create the ztp-installation manifest
46# once per each Minor version.
57
@@ -21,7 +23,7 @@ find ./ztp-installation/ -name "*.yaml" -exec yq -i eval '.metadata.annotations.
2123
2224# patch the ztp-site-generate version
2325echo " - Patch ztp-site-generate version"
24- sed -i ' s|quay.io/openshift-kni/ztp-site-generator:latest|registry.redhat.io/openshift4/ztp-site-generate-rhel8:v4.21|g' ztp-installation/argocd-openshift-gitops-patch.json
26+ sedi ' s|quay.io/openshift-kni/ztp-site-generator:latest|registry.redhat.io/openshift4/ztp-site-generate-rhel8:v4.21|g' ztp-installation/argocd-openshift-gitops-patch.json
2527
2628echo " - Adding elements to the whitelist"
2729yq ' .spec.namespaceResourceWhitelist += {"group": "' metal3.io' ", "kind": "DataImage"}' ztp-installation/app-project.yaml
Original file line number Diff line number Diff line change 1212
1313set -euo pipefail
1414
15+ sedi () { sed --version 2> /dev/null | grep -q GNU && sed -i " $@ " || sed -i ' ' " $@ " ; }
16+
1517if [[ ! -d " source-crs" ]]; then
1618 echo " Error: This script must be run from a directory containing 'source-crs' (e.g., the 'configuration' directory)." >&2
1719 exit 1
@@ -67,12 +69,12 @@ for source_file in "${source_files[@]}"; do
6769 # Choose the replacement strategy based on the file's content.
6870 if grep -q " source-crs/.*$file_name " " $target_file " ; then
6971 # This file contains an incorrect 'source-crs' path. Fix it.
70- sed -i -e " s|source-crs/[^[:space:]\` []*${escaped_file_name} |source-crs/$replacement_path |g" " $target_file "
72+ sedi -e " s|source-crs/[^[:space:]\` []*${escaped_file_name} |source-crs/$replacement_path |g" " $target_file "
7173 else
7274 # This file contains a different incorrect full path. Fix it.
7375 # This regex finds a path-like string ending in the filename.
7476 replacement_path=${replacement_path#% source-crs/ }
75- sed -i -e " s|[^[:space:]\` [,]*${escaped_file_name} |${replacement_path} |g" " $target_file "
77+ sedi -e " s|[^[:space:]\` [,]*${escaped_file_name} |${replacement_path} |g" " $target_file "
7678 fi
7779 done
7880done
You can’t perform that action at this time.
0 commit comments