20 小时以前 4ba8f509c44a58d1ea1324b817518fe90ae2c1b4
更新部署脚本
已修改1个文件
34 ■■■■ 文件已修改
deploy.bat 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
deploy.bat
@@ -17,9 +17,25 @@
echo ==========================================
echo.
:: Check if sshpass is available, download if not
:: Get script directory
set "SSHPASS_DIR=%~dp0bin"
set "SSHPASS_EXE=%SSHPASS_DIR%\sshpass.exe"
:: Check if local sshpass.exe already exists
if exist "%SSHPASS_EXE%" (
    set "PATH=%SSHPASS_DIR%;%PATH%"
    echo [OK] Found local sshpass: %SSHPASS_EXE%
    goto :check_jar
)
:: Check if sshpass is available in system PATH
where sshpass >nul 2>&1
if %errorlevel% neq 0 (
if %errorlevel% equ 0 (
    echo [OK] Found sshpass in system PATH
    goto :check_jar
)
:: sshpass not found, try to install
    echo [WARN] sshpass not found, trying to install...
    echo.
@@ -37,12 +53,10 @@
    :: Download standalone sshpass
    echo [INFO] Downloading sshpass...
    :: Get script directory
    set "SSHPASS_DIR=%~dp0bin"
    if not exist "!SSHPASS_DIR!" mkdir "!SSHPASS_DIR!"
if not exist "%SSHPASS_DIR%" mkdir "%SSHPASS_DIR%"
    :: Download using PowerShell with escaped variables
    powershell -NoProfile -Command "$url='https://github.com/xhcoding/sshpass-win32/releases/download/v1.0.3/sshpass.exe'; $out='!SSHPASS_DIR!\sshpass.exe'; Write-Host \"Downloading to: $out\"; try { Invoke-WebRequest -Uri $url -OutFile $out -UseBasicParsing; exit 0 } catch { Write-Host $_.Exception.Message; exit 1 }"
:: Download using PowerShell
powershell -NoProfile -Command "$url='https://github.com/xhcoding/sshpass-win32/releases/download/v1.0.3/sshpass.exe'; $out='%SSHPASS_EXE%'; Write-Host \"Downloading to: $out\"; try { Invoke-WebRequest -Uri $url -OutFile $out -UseBasicParsing; exit 0 } catch { Write-Host $_.Exception.Message; exit 1 }"
    if !errorlevel! neq 0 (
        echo [ERROR] Failed to download sshpass!
        echo [HINT] Please install sshpass manually or use Git Bash: pacman -S sshpass
@@ -50,10 +64,10 @@
    )
    :: Add bin dir to PATH temporarily
    set "PATH=!SSHPASS_DIR!;%PATH%"
    echo [OK] sshpass downloaded to: !SSHPASS_DIR!
set "PATH=%SSHPASS_DIR%;%PATH%"
echo [OK] sshpass downloaded to: %SSHPASS_DIR%
echo [HINT] Consider adding %SSHPASS_DIR% to system PATH for permanent use
    echo.
)
:check_jar
:: Check if JAR file exists