Skip to content

Commit a874d71

Browse files
author
BSKY
committed
Fix all shellcheck errors
1 parent af3e833 commit a874d71

File tree

1 file changed

+33
-27
lines changed

1 file changed

+33
-27
lines changed

bin/install

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,62 @@
33
set -eo pipefail
44

55
install_operator_sdk() {
6-
local install_type=$1
7-
local version=$2
8-
local install_path=$3
6+
install_type=$1
7+
version=$2
8+
install_path=$3
9+
10+
if [ "$install_type" != "version" ]; then
11+
echo "asdf-operator-sdk supports release installs only"
12+
exit 1
13+
fi
14+
15+
os="$(uname | tr '[:upper:]' '[:lower:]')"
916

10-
local os="$(uname | tr '[:upper:]' '[:lower:]')"
1117
if [ "$os" = "darwin" ]; then
12-
local os="apple-$os"
18+
os="apple-$os"
1319
elif [ "$os" = "linux" ]; then
14-
local os="$os-gnu"
20+
os="$os-gnu"
1521
fi
16-
local platform="$(uname -m)-$os"
1722

18-
local bin_install_path="$install_path/bin"
19-
local binary_path="$bin_install_path/operator-sdk"
20-
local download_url=$(get_download_url $version $platform)
23+
platform="$(uname -m)-$os"
24+
bin_install_path="$install_path/bin"
25+
binary_path="$bin_install_path/operator-sdk"
26+
download_url="$(get_download_url "$version" "$platform")"
2127

2228
if [ "$TMPDIR" = "" ]; then
23-
local tmp_download_dir=$(mktemp -d -t operator-sdk_XXXXXX)
29+
tmp_download_dir="$(mktemp -d -t operator-sdk_XXXXXX)"
2430
else
25-
local tmp_download_dir=$TMPDIR
31+
tmp_download_dir=$TMPDIR
2632
fi
2733

28-
local download_path="$tmp_download_dir/$(get_filename $version $platform)"
34+
download_path="$tmp_download_dir/$(get_filename "$version" "$platform")"
2935

30-
echo "Downloading operator-sdk from ${download_url} to ${download_path}"
31-
curl -Lo $download_path $download_url
36+
echo "Downloading operator-sdk from $download_url to $download_path"
37+
curl -Lo "$download_path" "$download_url"
3238

3339
echo "Creating bin directory"
34-
mkdir -p "${bin_install_path}"
40+
mkdir -p "$bin_install_path"
3541

3642
echo "Cleaning previous binaries"
37-
rm -f $binary_path 2>/dev/null || true
43+
rm -f "$binary_path" 2>/dev/null || true
3844

3945
echo "Copying binary"
40-
cp ${download_path} ${binary_path}
41-
chmod +x ${binary_path}
46+
cp "$download_path" "$binary_path"
47+
chmod +x "$binary_path"
4248
}
4349

4450
get_filename() {
45-
local version="$1"
46-
local platform="$2"
51+
version="$1"
52+
platform="$2"
4753

48-
echo "operator-sdk-v${version}-${platform}"
54+
echo "operator-sdk-v$version-$platform"
4955
}
5056

5157
get_download_url() {
52-
local version="$1"
53-
local platform="$2"
54-
local filename="$(get_filename $version $platform)"
55-
echo "https://github.com/operator-framework/operator-sdk/releases/download/v${version}/${filename}"
58+
version="$1"
59+
platform="$2"
60+
filename="$(get_filename "$version" "$platform")"
61+
echo "https://github.com/operator-framework/operator-sdk/releases/download/v$version/$filename"
5662
}
5763

58-
install_operator_sdk $ASDF_INSTALL_TYPE $ASDF_INSTALL_VERSION $ASDF_INSTALL_PATH
64+
install_operator_sdk "$ASDF_INSTALL_TYPE" "$ASDF_INSTALL_VERSION" "$ASDF_INSTALL_PATH"

0 commit comments

Comments
 (0)