You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2021/02/08 12:51:43 UTC

[camel-k] 06/08: chore(CRD): Bash is required to run CRD gen script

This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit b9d39c20ea05021d2cba81aacbb3cd03b3436df6
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Mon Feb 8 11:07:00 2021 +0100

    chore(CRD): Bash is required to run CRD gen script
---
 script/gen_crd.sh | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/script/gen_crd.sh b/script/gen_crd.sh
index f212292..139a4f6 100755
--- a/script/gen_crd.sh
+++ b/script/gen_crd.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -17,10 +17,10 @@
 
 set -e
 
-location=$(dirname $0)
+location=$(dirname "$0")
 apidir=$location/../pkg/apis/camel
 
-cd $apidir
+cd "$apidir"
 $CONTROLLER_GEN crd paths=./... output:crd:artifacts:config=../../../config/crd/bases output:crd:dir=../../../config/crd/bases crd:crdVersions=v1
 
 # cleanup working directory in $apidir
@@ -35,24 +35,24 @@ deploy_crd_file() {
   source=$1
 
   # Make a copy to serve as the base for post-processing
-  cp $source "${source}.orig"
+  cp "$source" "${source}.orig"
 
   # Post-process source
-  cat ./script/headers/yaml.txt > $source
-  echo "" >> $source
+  cat ./script/headers/yaml.txt > "$source"
+  echo "" >> "$source"
   if [[ "$OSTYPE" == "linux-gnu"* ]]; then
     cat "${source}.orig" | sed -n '/^---/,/^status/p;/^status/q' \
       | sed '1d;$d' \
-      | sed '/creationTimestamp:/a\  labels:\n    app: camel-k' >> $source
+      | sed '/creationTimestamp:/a\  labels:\n    app: camel-k' >> "$source"
   elif [[ "$OSTYPE" == "darwin"* ]]; then
     # Mac OSX
     cat "${source}.orig" | sed -n '/^---/,/^status/p;/^status/q' \
       | sed '1d;$d' \
-      | sed $'s/^  creationTimestamp:/  creationTimestamp:\\\n  labels:\\\n    app: camel-k/' >> $source
+      | sed $'s/^  creationTimestamp:/  creationTimestamp:\\\n  labels:\\\n    app: camel-k/' >> "$source"
   fi
 
-  for dest in ${@:2}; do
-    cp $source $dest
+  for dest in "${@:2}"; do
+    cp "$source" "$dest"
   done
 
   # Remove the copy as no longer required
@@ -63,9 +63,9 @@ deploy_crd() {
   name=$1
   plural=$2
 
-  deploy_crd_file ./config/crd/bases/camel.apache.org_$plural.yaml \
-    ./helm/camel-k/crds/crd-$name.yaml \
-    ./deploy/olm-catalog/camel-k-dev/$version/camel.apache.org_$plural.yaml
+  deploy_crd_file ./config/crd/bases/camel.apache.org_"$plural".yaml \
+    ./helm/camel-k/crds/crd-"$name".yaml \
+    ./deploy/olm-catalog/camel-k-dev/"$version"/camel.apache.org_"$plural".yaml
 }
 
 deploy_crd build builds