From a45aa86b7dafde422fc975f161a1ba54a40296b4 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Sat, 19 Oct 2024 00:42:29 +0800 Subject: [PATCH] =?UTF-8?q?core:=20windows=20=E4=B8=8B=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=20curl=20=E4=B8=8B=E8=BD=BD=20reinstall.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reinstall.bat | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/reinstall.bat b/reinstall.bat index 86dd21f..b4e6ea5 100644 --- a/reinstall.bat +++ b/reinstall.bat @@ -117,10 +117,15 @@ if not exist "%tags%" ( && type nul >"%tags%" ) +rem 在c盘根目录下执行 cygpath -ua . 会得到 /cygdrive/c,因此末尾要有 / +for /f %%a in ('%SystemDrive%\cygwin\bin\cygpath -ua ./') do set thisdir=%%a + rem 下载 reinstall.sh if not exist reinstall.sh ( - call :download %confhome%/reinstall.sh %~dp0reinstall.sh + rem call :download %confhome%/reinstall.sh %~dp0reinstall.sh + call :download_with_curl %confhome%/reinstall.sh %thisdir%reinstall.sh if errorlevel 1 goto :download_failed + call :chmod a+x %thisdir%reinstall.sh ) rem 为每个参数添加引号,使参数正确传递到 bash @@ -128,9 +133,6 @@ for %%a in (%*) do ( set "param=!param! "%%~a"" ) -rem 在c盘根目录下执行 cygpath -ua . 会得到 /cygdrive/c,因此末尾要有 / -for /f %%a in ('%SystemDrive%\cygwin\bin\cygpath -ua ./') do set thisdir=%%a - rem 方法1 %SystemDrive%\cygwin\bin\dos2unix -q '%thisdir%reinstall.sh' %SystemDrive%\cygwin\bin\bash -l -c '%thisdir%reinstall.sh !param!' @@ -157,6 +159,15 @@ if not exist "%~2" certutil -urlcache -split "%~1" "%~2" >nul if not exist "%~2" exit /b 1 exit /b +:download_with_curl +echo Download: %~1 %~2 +%SystemDrive%\cygwin\bin\curl -L "%~1" -o "%~2" +exit /b + +:chmod +%SystemDrive%\cygwin\bin\chmod "%~1" "%~2" +exit /b + :download_failed echo Download failed. exit /b 1