Skip to content

Commit 06a7849

Browse files
authored
Merge pull request #36 from codacy/fix-install-script
fix install script
2 parents 83e3658 + 34dd066 commit 06a7849

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

install-binary.sh

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ PROJECT_NAME="helm-ssm"
77
PROJECT_GH="codacy/$PROJECT_NAME"
88
eval $(helm env)
99

10-
# Convert the HELM_PLUGIN to unix if cygpath is
11-
# available. This is the case when using MSYS2 or Cygwin
12-
# on Windows where helm returns a Windows path but we
13-
# need a Unix path
14-
if type cygpath > /dev/null; then
15-
HELM_PLUGIN=$(cygpath -u "$HELM_PLUGIN")
16-
fi
17-
1810
if [[ $SKIP_BIN_INSTALL == "1" ]]; then
1911
echo "Skipping binary install"
2012
exit
@@ -67,9 +59,9 @@ getDownloadURL() {
6759
# Use the GitHub API to find the latest version for this project.
6860
local latest_url="https://api.github.com/repos/$PROJECT_GH/releases/latest"
6961
if type "curl" > /dev/null; then
70-
DOWNLOAD_URL=$(curl -s $latest_url | grep $OS | awk '/\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}')
62+
DOWNLOAD_URL=$(curl -s $latest_url | grep $OS | awk '/"browser_download_url":/{gsub( /[,"]/,"", $2); print $2}')
7163
elif type "wget" > /dev/null; then
72-
DOWNLOAD_URL=$(wget -q -O - $latest_url | awk '/\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}')
64+
DOWNLOAD_URL=$(wget -q -O - $latest_url | awk '/"browser_download_url":/{gsub( /[,"]/,"", $2); print $2}')
7365
fi
7466
}
7567

@@ -93,9 +85,9 @@ installFile() {
9385
tar xf "$PLUGIN_TMP_FILE" -C "$HELM_TMP"
9486
echo "$HELM_TMP"
9587
HELM_TMP_BIN="$HELM_TMP/helm-ssm"
96-
echo "Preparing to install into ${HELM_PLUGIN}"
88+
echo "Preparing to install into ${HELM_PLUGINS}"
9789
# Use * to also copy the file withe the exe suffix on Windows
98-
cp "$HELM_TMP_BIN"* "$HELM_PLUGIN"
90+
cp "$HELM_TMP_BIN" "$HELM_PLUGINS/helm-ssm"
9991
}
10092

10193
# fail_trap is executed if an error occurs.
@@ -111,10 +103,10 @@ fail_trap() {
111103
# testVersion tests the installed client to make sure it is working.
112104
testVersion() {
113105
set +e
114-
echo "$PROJECT_NAME installed into $HELM_PLUGIN/$PROJECT_NAME"
106+
echo "$PROJECT_NAME installed into $HELM_PLUGINS/$PROJECT_NAME"
115107
# To avoid to keep track of the Windows suffix,
116108
# call the plugin assuming it is in the PATH
117-
PATH=$PATH:$HELM_PLUGIN
109+
PATH=$PATH:$HELM_PLUGINS/$PROJECT_NAME
118110
helm-ssm -h
119111
set -e
120112
}

0 commit comments

Comments
 (0)