Skip to content

Commit bf345e1

Browse files
committed
Update cli install.
1 parent c896695 commit bf345e1

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

test/e2e/script/prepare/install-swctl.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,18 @@
2222
BASE_DIR=$1
2323
BIN_DIR=$2
2424

25-
set -ex
26-
27-
if ! command -v swctl &> /dev/null; then
25+
install_swctl() {
2826
mkdir -p $BASE_DIR/swctl && cd $BASE_DIR/swctl
2927
curl -kLo skywalking-cli.tar.gz https://github.com/apache/skywalking-cli/archive/${SW_CTL_COMMIT}.tar.gz
3028
tar -zxf skywalking-cli.tar.gz --strip=1
31-
utype=$(uname | awk '{print tolower($0)}')
32-
make $utype && mv bin/swctl-*-$utype-amd64 $BIN_DIR/swctl
33-
fi
29+
VERSION=${SW_CTL_COMMIT} make install DESTDIR=$BIN_DIR
30+
}
31+
32+
if ! command -v swctl &> /dev/null; then
33+
echo "swctl is not installed"
34+
install_swctl
35+
elif ! swctl --version | grep -q "${SW_CTL_COMMIT::7}"; then
36+
# Check if the installed version is correct
37+
echo "swctl is already installed, but version is not ${SW_CTL_COMMIT}, will re-install it"
38+
install_swctl
39+
fi

0 commit comments

Comments
 (0)