From e1deeb96cd89f764ab6ef71aa78aba4a40184dfa Mon Sep 17 00:00:00 2001 From: Joakim Roubert Date: Mon, 22 Aug 2022 09:28:13 +0200 Subject: [PATCH] Script housekeeping - Add missing quites to handle eventual whitespaces - Remove reundant echo for call to function that echoes Signed-off-by: Joakim Roubert --- scripts/installation/all-in-one.sh | 6 +++--- scripts/installation/install.sh | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/installation/all-in-one.sh b/scripts/installation/all-in-one.sh index adef9c358..c3041e040 100755 --- a/scripts/installation/all-in-one.sh +++ b/scripts/installation/all-in-one.sh @@ -635,8 +635,8 @@ function arch() { function _download_tool() { local name=$1 url=$2 local file=/usr/local/bin/$name - curl -Lo $file $url - chmod +x $file + curl -Lo "$file" "$url" + chmod +x "$file" } function check_command_exists() { @@ -645,7 +645,7 @@ function check_command_exists() { function ensure_tool() { local command=$1 download_url=$2 - if check_command_exists $command; then + if check_command_exists "$command"; then return fi diff --git a/scripts/installation/install.sh b/scripts/installation/install.sh index 2f4f770da..266898636 100644 --- a/scripts/installation/install.sh +++ b/scripts/installation/install.sh @@ -53,9 +53,9 @@ SEDNA_VERSION=v${SEDNA_VERSION#v} _download_yamls() { yaml_dir=$1 - mkdir -p ${SEDNA_ROOT}/$yaml_dir - cd ${SEDNA_ROOT}/$yaml_dir - for yaml in ${yaml_files[@]}; do + mkdir -p "${SEDNA_ROOT}/$yaml_dir" + cd "${SEDNA_ROOT}/$yaml_dir" + for yaml in "${yaml_files[@]}"; do # the yaml file already exists, no need to download [ -e "$yaml" ] && continue @@ -93,7 +93,7 @@ prepare_install(){ } prepare() { - mkdir -p ${SEDNA_ROOT} + mkdir -p "${SEDNA_ROOT}" # we only need build directory # here don't use git clone because of large vendor directory @@ -105,12 +105,12 @@ cleanup(){ } create_crds() { - cd ${SEDNA_ROOT} + cd "${SEDNA_ROOT}" kubectl create -f build/crds } delete_crds() { - cd ${SEDNA_ROOT} + cd "${SEDNA_ROOT}" kubectl delete -f build/crds --timeout=90s } @@ -123,7 +123,7 @@ get_service_address() { } create_kb(){ - cd ${SEDNA_ROOT} + cd "${SEDNA_ROOT}" kubectl $action -f - < $config_file << EOF + cat > "$config_file" << EOF kubeConfig: "" master: "" namespace: "" @@ -214,12 +214,12 @@ knowledgeBaseServer: EOF fi - kubectl $action -n sedna configmap $cm_name --from-file=$config_file + kubectl $action -n sedna configmap $cm_name --from-file="$config_file" } create_gm() { - cd ${SEDNA_ROOT} + cd "${SEDNA_ROOT}" kubectl create -f build/gm/rbac/ @@ -290,7 +290,7 @@ EOF } delete_gm() { - cd ${SEDNA_ROOT} + cd "${SEDNA_ROOT}" kubectl delete -f build/gm/rbac/ @@ -433,6 +433,6 @@ case "$action" in delete_lc delete_crds cleanup - echo "$(green_text Sedna is uninstalled successfully)" + green_text Sedna is uninstalled successfully ;; esac