1- # Copyright Contributors to the Open Cluster Management project
21#! /usr/bin/env bash
2+ # Copyright Contributors to the Open Cluster Management project
33
44# Clusteradm CLI location
5- : ${INSTALL_DIR:= " /usr/local/bin" }
5+ : " ${INSTALL_DIR:=/ usr/ local/ bin} "
66
77# sudo is required to copy binary to INSTALL_DIR for linux
8- : ${USE_SUDO:= " false" }
8+ : " ${USE_SUDO:= false} "
99
1010# Http request CLI
1111HTTP_REQUEST_CLI=curl
@@ -27,7 +27,7 @@ getSystemInfo() {
2727 x86_64) ARCH=" amd64" ;;
2828 esac
2929
30- OS=$( echo ` uname` | tr ' [:upper:]' ' [:lower:]' )
30+ OS=$( uname | tr ' [:upper:]' ' [:lower:]' )
3131
3232 # Most linux distro needs root permission to copy the file to /usr/local/bin
3333 if [[ " $OS " == " linux" || " $OS " == " darwin" ]] && [ " $INSTALL_DIR " == " /usr/local/bin" ]; then
@@ -73,7 +73,7 @@ checkExisting() {
7373runAsRoot () {
7474 local CMD=" $* "
7575
76- if [ $EUID -ne 0 -a $USE_SUDO = " true" ]; then
76+ if [ " $EUID " -ne 0 ] && [ " $USE_SUDO " = " true" ]; then
7777 CMD=" sudo $CMD "
7878 fi
7979
@@ -139,7 +139,7 @@ installFile() {
139139 exit 1
140140 fi
141141
142- chmod o+x $tmp_root_cli
142+ chmod o+x " $tmp_root_cli "
143143 runAsRoot cp " $tmp_root_cli " " $INSTALL_DIR "
144144
145145 if [ -f " $CLI_FILE " ]; then
@@ -189,7 +189,7 @@ checkExisting
189189
190190echo " Installing $TARGET_VERSION OCM clusteradm CLI..."
191191
192- downloadFile $TARGET_VERSION
192+ downloadFile " $TARGET_VERSION "
193193installFile
194194cleanup
195195
0 commit comments