@@ -29,7 +29,7 @@ getSystemInfo() {
2929 OS=$( echo ` uname` | tr ' [:upper:]' ' [:lower:]' )
3030
3131 # Most linux distro needs root permission to copy the file to /usr/local/bin
32- if [[ " $OS " == " linux" || " $OS " == " darwin" ]] && [ " FLOWCTL_INSTALL_DIR" == " /usr/local/bin" ]; then
32+ if [[ " $OS " == " linux" || " $OS " == " darwin" ]] && [[ " FLOWCTL_INSTALL_DIR" == " /usr/local/bin" ] ]; then
3333 USE_SUDO=" true"
3434 fi
3535}
@@ -40,13 +40,13 @@ verifySupported() {
4040 local current_osarch=" ${OS} -${ARCH} "
4141
4242 for osarch in " ${supported[@]} " ; do
43- if [ " $osarch " == " $current_osarch " ]; then
43+ if [[ " $osarch " == " $current_osarch " ] ]; then
4444 echo " Your system is ${OS} _${ARCH} "
4545 return
4646 fi
4747 done
4848
49- if [ " $current_osarch " == " darwin-arm64" ]; then
49+ if [[ " $current_osarch " == " darwin-arm64" ] ]; then
5050 if isReleaseAvailable $releaseTag ; then
5151 return
5252 else
@@ -64,7 +64,7 @@ verifySupported() {
6464runAsRoot () {
6565 local CMD=" $* "
6666
67- if [ $EUID -ne 0 -a $USE_SUDO = " true" ]; then
67+ if [[ $EUID -ne 0 -a $USE_SUDO = " true" ] ]; then
6868 CMD=" sudo $CMD "
6969 fi
7070
@@ -86,7 +86,7 @@ checkHttpRequestFlowCtl() {
8686}
8787
8888checkExistingFlowCtl () {
89- if [ -f " $FLOWCTL_FILE " ]; then
89+ if [[ -f " $FLOWCTL_FILE " ] ]; then
9090 echo -e " \nFlowCtl is detected:"
9191 $FLOWCTL_FILE version
9292 echo -e " Reinstalling FlowCtl - ${FLOWCTL_FILE} ...\n"
@@ -99,7 +99,7 @@ getLatestRelease() {
9999 local flowctlReleaseUrl=" https://api.github.com/repos/${GITHUB_ORG} /${GITHUB_REPO} /releases"
100100 local latest_release=" "
101101
102- if [ " $HTTP_REQUEST_FLOWCTL " == " curl" ]; then
102+ if [[ " $HTTP_REQUEST_FLOWCTL " == " curl" ] ]; then
103103 latest_release=$( curl -s $flowctlReleaseUrl | grep \" tag_name\" | grep -v rc | awk ' NR==1{print $2}' | sed -n ' s/\"\(.*\)\",/\1/p' )
104104 else
105105 latest_release=$( wget -q --header=" Accept: application/json" -O - $flowctlReleaseUrl | grep \" tag_name\" | grep -v rc | awk ' NR==1{print $2}' | sed -n ' s/\"\(.*\)\",/\1/p' )
@@ -120,13 +120,13 @@ downloadFile() {
120120 ARTIFACT_TMP_FILE=" $FLOWCTL_TMP_ROOT /$FLOWCTL_ARTIFACT "
121121
122122 echo " Downloading $DOWNLOAD_URL ..."
123- if [ " $HTTP_REQUEST_FLOWCTL " == " curl" ]; then
123+ if [[ " $HTTP_REQUEST_FLOWCTL " == " curl" ] ]; then
124124 curl -SsL " $DOWNLOAD_URL " -o " $ARTIFACT_TMP_FILE "
125125 else
126126 wget -q -O " $ARTIFACT_TMP_FILE " " $DOWNLOAD_URL "
127127 fi
128128
129- if [ ! -f " $ARTIFACT_TMP_FILE " ]; then
129+ if [[ ! -f " $ARTIFACT_TMP_FILE " ] ]; then
130130 echo " failed to download $DOWNLOAD_URL ..."
131131 exit 1
132132 fi
@@ -139,15 +139,15 @@ isReleaseAvailable() {
139139 DOWNLOAD_BASE=" https://github.com/${GITHUB_ORG} /${GITHUB_REPO} /releases/download"
140140 DOWNLOAD_URL=" ${DOWNLOAD_BASE} /${LATEST_RELEASE_TAG} /${FLOWCTL_ARTIFACT} "
141141
142- if [ " $HTTP_REQUEST_FLOWCTL " == " curl" ]; then
142+ if [[ " $HTTP_REQUEST_FLOWCTL " == " curl" ] ]; then
143143 httpstatus=$( curl -sSLI -o /dev/null -w " %{http_code}" " $DOWNLOAD_URL " )
144- if [ " $httpstatus " == " 200" ]; then
144+ if [[ " $httpstatus " == " 200" ] ]; then
145145 return 0
146146 fi
147147 else
148148 wget -q --spider " $DOWNLOAD_URL "
149149 exitstatus=$?
150- if [ $exitstatus -eq 0 ]; then
150+ if [[ $exitstatus -eq 0 ] ]; then
151151 return 0
152152 fi
153153 fi
@@ -158,19 +158,19 @@ installFile() {
158158 tar xf " $ARTIFACT_TMP_FILE " -C " $FLOWCTL_TMP_ROOT "
159159 local tmp_root_flowctl=" $FLOWCTL_TMP_ROOT /$FLOWCTL_FILENAME "
160160
161- if [ ! -f " $tmp_root_flowctl " ]; then
161+ if [[ ! -f " $tmp_root_flowctl " ] ]; then
162162 echo " Failed to unpack FlowCtl executable."
163163 exit 1
164164 fi
165165
166- if [ -f " $FLOWCTL_FILE " ]; then
166+ if [[ -f " $FLOWCTL_FILE " ] ]; then
167167 runAsRoot rm " $FLOWCTL_FILE "
168168 fi
169169 chmod o+x $tmp_root_flowctl
170170 mkdir -p $FLOWCTL_INSTALL_DIR
171171 runAsRoot cp " $tmp_root_flowctl " " $FLOWCTL_INSTALL_DIR "
172172
173- if [ -f " $FLOWCTL_FILE " ]; then
173+ if [[ -f " $FLOWCTL_FILE " ] ]; then
174174 echo " $FLOWCTL_FILENAME installed into $FLOWCTL_INSTALL_DIR successfully."
175175
176176 $FLOWCTL_FILE version
@@ -182,7 +182,7 @@ installFile() {
182182
183183fail_trap () {
184184 result=$?
185- if [ " $result " != " 0" ]; then
185+ if [[ " $result " != " 0" ] ]; then
186186 echo " Failed to install FlowCtl"
187187 echo " For support, go to https://flowsynx.io"
188188 fi
@@ -208,7 +208,7 @@ trap "fail_trap" EXIT
208208getSystemInfo
209209checkHttpRequestFlowCtl
210210
211- if [ -z " $1 " ]; then
211+ if [[ -z " $1 " ] ]; then
212212 echo " Getting the latest FlowCtl..."
213213 getLatestRelease
214214else
0 commit comments