Skip to content

Commit fd048d9

Browse files
haochengxiaCopilot
andauthored
Skip if dep is installed (#247)
* Skip if dep is installed * Format scripts * Apply copilot suggestion Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9c6b428 commit fd048d9

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

scripts/install_dependency.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,20 @@ install_lightgbm() {
194194
# Install Zstd
195195
install_zstd() {
196196
log_info "Installing Zstd..."
197-
pushd /tmp/ >/dev/null
198197
local zstd_version="1.5.0"
198+
# Check if Zstd exists
199+
if command -v zstd &>/dev/null; then
200+
local installed_version
201+
installed_version=$(zstd --version | grep -oE 'v[0-9.]+' | sed 's/^v//')
202+
if [[ $installed_version == "$zstd_version" ]]; then
203+
log_info "Zstd version $zstd_version already installed."
204+
return 0
205+
else
206+
log_info "Zstd is installed but version is $installed_version (expecting $zstd_version). Proceeding to install..."
207+
fi
208+
fi
209+
# Install
210+
pushd /tmp/ >/dev/null
199211
if [[ ! -f "zstd-${zstd_version}.tar.gz" ]]; then
200212
wget "https://github.com/facebook/zstd/releases/download/v${zstd_version}/zstd-${zstd_version}.tar.gz"
201213
tar xf "zstd-${zstd_version}.tar.gz"

0 commit comments

Comments
 (0)