From ecb3f430cd954a11cf8f1f3625c1a45812cc496e Mon Sep 17 00:00:00 2001 From: lixiaofan Date: Wed, 19 Aug 2026 22:44:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(install):=20verify=5Finstall=20=E4=BC=98?= =?UTF-8?q?=E5=85=88=E6=A0=A1=E9=AA=8C=E5=AE=9E=E9=99=85=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 自定义 WPS365_INSTALL_DIR 安装时,若 PATH 已存在旧版本二进制, command -v 会返回旧路径,导致最终提示与实际安装目录不符(#8)。 先校验 ${INSTALL_DIR}/${BINARY_NAME},再 fallback 到 command -v。 --- install.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 3dc725c..d549cf7 100755 --- a/install.sh +++ b/install.sh @@ -135,13 +135,18 @@ download_and_install() { } verify_install() { - if command -v "$BINARY_NAME" > /dev/null 2>&1; then - local installed_path + local installed_path="" + if [ -x "${INSTALL_DIR}/${BINARY_NAME}" ]; then + installed_path="${INSTALL_DIR}/${BINARY_NAME}" + elif command -v "$BINARY_NAME" > /dev/null 2>&1; then installed_path="$(command -v "$BINARY_NAME")" + fi + + if [ -n "$installed_path" ]; then ok "${BINARY_NAME} 已安装到 ${installed_path}" local ver_output - ver_output="$("$BINARY_NAME" --version 2>/dev/null || echo '(无法获取版本)')" + ver_output="$("$installed_path" --version 2>/dev/null || echo '(无法获取版本)')" info "版本: ${ver_output}" else warn "${BINARY_NAME} 已安装到 ${INSTALL_DIR}/${BINARY_NAME}"