Skip to content

Commit

Permalink
core: windows 下使用 curl 下载 reinstall.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
bin456789 committed Oct 18, 2024
1 parent 7070e7f commit 29b524e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions reinstall.bat
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@ 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
)

Expand All @@ -128,9 +132,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!'
Expand All @@ -157,6 +158,12 @@ 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


:download_failed
echo Download failed.
exit /b 1

0 comments on commit 29b524e

Please sign in to comment.