Skip to content

Commit 247213f

Browse files
SajferAnton Bretting
andauthored
Fix lint errors in install-binary.sh (#346)
* Fix for build image * fix_lint_errors Lint fixes in install-binary.sh Co-authored-by: Anton Bretting <[email protected]>
1 parent b04e040 commit 247213f

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

install-binary.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,18 @@ export GREP_COLOR="never"
1111
# on Windows where helm returns a Windows path but we
1212
# need a Unix path
1313

14-
if type cygpath >/dev/null 2>&1; then
14+
if command -v cygpath >/dev/null 2>&1; then
1515
HELM_BIN="$(cygpath -u "${HELM_BIN}")"
1616
HELM_PLUGIN_DIR="$(cygpath -u "${HELM_PLUGIN_DIR}")"
1717
fi
1818

1919
[ -z "$HELM_BIN" ] && HELM_BIN=$(command -v helm)
20-
HELM_MAJOR_VERSION=$("${HELM_BIN}" version --client --short | awk -F '.' '{print $1}')
2120

2221
[ -z "$HELM_HOME" ] && HELM_HOME=$(helm env | grep 'HELM_DATA_HOME' | cut -d '=' -f2 | tr -d '"')
2322

2423
mkdir -p "$HELM_HOME"
2524

26-
: ${HELM_PLUGIN_DIR:="$HELM_HOME/plugins/helm-diff"}
25+
: "${HELM_PLUGIN_DIR:="$HELM_HOME/plugins/helm-diff"}"
2726

2827
if [ "$SKIP_BIN_INSTALL" = "1" ]; then
2928
echo "Skipping binary install"
@@ -73,7 +72,9 @@ verifySupported() {
7372
exit 1
7473
fi
7574

76-
if ! type "curl" >/dev/null && ! type "wget" >/dev/null; then
75+
if
76+
! command -v curl >/dev/null 2>&1 && ! command -v wget >/dev/null 2>&1
77+
then
7778
echo "Either curl or wget is required"
7879
exit 1
7980
fi
@@ -82,7 +83,7 @@ verifySupported() {
8283
# getDownloadURL checks the latest available version.
8384
getDownloadURL() {
8485
version=$(git -C "$HELM_PLUGIN_DIR" describe --tags --exact-match 2>/dev/null || :)
85-
if [ "$SCRIPT_MODE" = "install" -a -n "$version" ]; then
86+
if [ "$SCRIPT_MODE" = "install" ] && [ -n "$version" ]; then
8687
DOWNLOAD_URL="https://github.com/$PROJECT_GH/releases/download/$version/helm-diff-$OS-$ARCH.tgz"
8788
else
8889
DOWNLOAD_URL="https://github.com/$PROJECT_GH/releases/latest/download/helm-diff-$OS-$ARCH.tgz"
@@ -104,9 +105,13 @@ rmTempDir() {
104105
downloadFile() {
105106
PLUGIN_TMP_FILE="${HELM_TMP}/${PROJECT_NAME}.tgz"
106107
echo "Downloading $DOWNLOAD_URL"
107-
if type "curl" >/dev/null; then
108+
if
109+
command -v curl >/dev/null 2>&1
110+
then
108111
curl -L "$DOWNLOAD_URL" -o "$PLUGIN_TMP_FILE"
109-
elif type "wget" >/dev/null; then
112+
elif
113+
command -v wget >/dev/null 2>&1
114+
then
110115
wget -q -O "$PLUGIN_TMP_FILE" "$DOWNLOAD_URL"
111116
fi
112117
}

0 commit comments

Comments
 (0)