clean up install script

This commit is contained in:
doyle 2020-11-05 01:27:24 +11:00
parent ab27b76f65
commit 008d09f89d
6 changed files with 103 additions and 2819 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +0,0 @@
python36.zip
.
# Uncomment to run site.main() automatically
import site

View File

@ -1,6 +0,0 @@
rmdir /Q /S Cmder
rmdir /Q /S Tools/winpython39_x64
rmdir /Q /S Tools/GVim
rmdir /Q /S Tools/Compiler/zig-x86_64
del Tools/Compiler/generate_msvc17_toolchain.bat
rmdir /Q /S GVim

View File

@ -18,136 +18,130 @@ REM
REM Cmder
REM
set cmder_version=v1.3.16
set cmder_url=https://github.com/cmderdev/cmder/releases/download/%cmder_version%/cmder.7z
set cmder_zip=%installer_root%\win32_cmder_%cmder_version%.7z
echo - Downloading from %cmder_url% to %cmder_zip%
if not exist "%cmder_zip%" powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest %cmder_url% -OutFile %cmder_zip%"
if not exist "%cmder_zip%" echo Failed to download cmder, exiting.
if not exist "%cmder_zip%" goto :eof
echo - Extracting %cmder_zip% to %cmder_root%
if not exist "%cmder_root%" %installer_root%\win32_7za.exe x -y -o%cmder_root% %cmder_zip% > NUL
if exist "%cmder_root%" (
echo - [Cache] Cmder already installed at %cmder_root%
) else (
call :DownloadFile https://github.com/cmderdev/cmder/releases/download/%cmder_version%/cmder.7z "%cmder_zip%" || exit /b
call :Unzip "%cmder_zip%" "%cmder_root%" || exit /b
)
REM
REM GVim
REM Misc Tools
REM clang-format: C/C++ formatting tool
REM ctags: C/C++ code annotation generator
REM scanmapset: Bind capslock to escape via registry
REM uncap: Bind capslock to escape via run-time program
call :CopyFile "%installer_root%\win32_clang_format.exe" "%cmder_root%\bin\clang-format.exe" || exit /b
call :CopyFile "%installer_root%\win32_ctags.exe" "%cmder_root%\bin\ctags.exe" || exit /b
call :CopyFile "%installer_root%\win32_scanmapset.exe" "%cmder_root%\bin\scanmapset.exe" || exit /b
call :CopyFile "%installer_root%\win32_uncap.exe" "%cmder_root%\bin\uncap.exe" || exit /b
REM
REM GVim, Vim Plug, Vim Config
REM
set gvim_url=https://tuxproject.de/projects/vim/complete-x64.7z
set gvim_zip=%installer_root%\win32_gvim_x64.7z
set gvim_dir=%tools_root%\GVim
set gvim_path=%tools_root%\GVim
if exist "%gvim_path%" (
echo - [Cache] GVim already installed at %gvim_path%
) else (
call :DownloadFile https://tuxproject.de/projects/vim/complete-x64.7z %gvim_zip% || exit /b
call :Unzip "%gvim_zip%" "%gvim_path%" || exit /b
)
echo - Downloading from %gvim_url% to %gvim_zip%
if not exist "%gvim_zip%" powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest %gvim_url% -OutFile %gvim_zip%"
if not exist "%gvim_zip%" echo Failed to download GVim, exiting.
if not exist "%gvim_zip%" goto :eof
call :CopyFile "%installer_root%\_vimrc" "%home%" || exit /b
call :CopyFile "%installer_root%\win32_gvim_fullscreen.dll" "%gvim_path%\gvim_fullscreen.dll" || exit /b
if not exist %gvim_dir% %installer_root%\win32_7za.exe x -y -o%gvim_dir% %gvim_zip% > NUL
REM
REM Vim Plug
REM
set vim_plug_url=https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
set vim_plug_install_dir=%vim_root%\autoload
set vim_plug_file=%vim_plug_install_dir%\plug.vim
if not exist "%vim_plug_install_dir%" mkdir "%vim_plug_install_dir%"
echo - Downloading from %vim_plug_url% to %vim_plug_install_dir%
if not exist "%vim_plug_file%" powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest %vim_plug_url% -OutFile %vim_plug_file%"
if not exist "%vim_plug_file%" echo Failed to download Vim Plug, exiting.
if not exist "%vim_plug_file%" goto :eof
REM
REM GVim Fullscreen DLL
REM
set gvim_fullscreen_dll=%installer_root%\win32_gvim_fullscreen.dll
set gvim_fullscreen_dll_install=%gvim_dir%\gvim_fullscreen.dll
echo - Copy %gvim_fullscreen_dll% to %gvim_fullscreen_dll_install%
copy /Y %gvim_fullscreen_dll% %gvim_fullscreen_dll_install%
REM
REM vimrc
REM
echo - Copy %installer_root%\_vimrc to %home%
copy /Y %installer_root%\_vimrc %home% > NUL
REM
REM Clang Format
REM
set clang_format_url=https://raw.githubusercontent.com/llvm/llvm-project/master/clang/tools/clang-format/clang-format.py
set clang_format_file=%vim_root%\clang-format.py
echo - Downloading from %clang_format_url% to %vim_root%
if not exist "%clang_format_file%" powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest %clang_format_url% -OutFile %clang_format_file%"
if not exist "%clang_format_file%" echo Failed to download Clang-Format, exiting.
if not exist "%clang_format_file%" goto :eof
echo - Copy Installer\win32_clang_format.exe to %cmder_root%\bin\clang-format.exe
copy /Y %installer_root%\win32_clang_format.exe %cmder_root%\bin\clang-format.exe
REM
REM ctags, scanmapset (bind capslock to escape via registry), uncap (bind capslock to escape whilst program running shim)
REM
set ctags_dir=%cmder_root%\bin\ctags.exe
set scanmapset_dir=%cmder_root%\bin\scanmapset.exe
set uncap_dir=%cmder_root%\bin\uncap.exe
set ctags_file=%installer_root%\win32_ctags.exe
set scanmapset_file=%installer_root%\win32_scanmapset.exe
set uncap_file=%installer_root%\win32_uncap.exe
echo - Copy %ctags_file% to %ctags_dir%
echo - Copy %scanmapset_file% to %scanmapset_dir%
echo - Copy %uncap_file% to %uncap_dir%
copy /Y %ctags_file% %ctags_dir%
copy /Y %scanmapset_file% %scanmapset_dir%
copy /Y %uncap_file% %uncap_dir%
set vim_plug_path=%vim_root%\autoload
set vim_plug=%vim_plug_path%\plug.vim
if exist "%vim_plug%" (
echo - [Cache] Vim Plug already installed at %vim_plug%
) else (
if not exist "%vim_plug_path%" mkdir "%vim_plug_path%"
call :DownloadFile https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim "%vim_plug%" || exit /b
)
REM
REM ripgrep
REM
set rg_dir=%cmder_root%\bin
set rg_zip=%installer_root%\win32_rg_v12.1.1.7z
echo - Extracting %rg_zip% to %rg_dir%
if not exist "%rg_dir%\rg.exe" %installer_root%\win32_7za.exe x -y -o%rg_dir% %rg_zip% > NUL
if not exist %cmder_root%\..\Home mkdir %cmder_root%\..\Home
set rg_exe=%cmder_root%\bin\rg.exe
if exist "%rg_exe%" (
echo - [Cache] rg already installed at %rg_exe%
) else (
call :Unzip "%rg_zip%" "%cmder_root%\bin" || exit /b
)
REM
REM Zig
REM
set zig_version=0.6.0
set zig_zip=zig-windows-x86_64-%zig_version%.zip
set zig_url=https://ziglang.org/download/%zig_version%/%zig_zip%
set zig_zip_installer=%installer_root%\win32_%zig_zip%
set zig_zip_install_path=%compiler_root%\zig-windows-x86_64-%zig_version%
echo - Downloading from %zig_url% to %zig_zip_installer%
if not exist "%zig_zip_installer%" powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest %zig_url% -OutFile %zig_zip_installer%"
if not exist "%zig_zip_installer%" echo Failed to download Zig, exiting.
if not exist "%zig_zip_installer%" goto :eof
echo - Unzip %zig_zip_installer% to %zig_zip_install_path%
if not exist %zig_zip_install_path% %installer_root%\win32_7za.exe x -y -o%compiler_root% %zig_zip_installer% > NUL
set zig_file=zig-windows-x86_64-%zig_version%.zip
set zig_zip=%installer_root%\win32_%zig_file%
set zig_path=%compiler_root%\zig-windows-x86_64-%zig_version%
if exist "%zig_path%" (
echo - [Cache] Zig already installed at %zig_path%
) else (
call :DownloadFile https://ziglang.org/download/%zig_version%/%zig_file% %zig_zip% || exit /b
call :Unzip "%zig_zip%" "%compiler_root%" || exit /b
)
REM
REM Python
REM
set python_url=https://github.com/winpython/winpython/releases/download/3.0.20201028/Winpython64-3.9.0.2dot.exe
set python_zip_installer=%installer_root%\win32_Winpython64dot.exe
set python_zip_install_path=%tools_root%\WPy64-3902
echo - Downloading from %python_url% to %python_zip_installer%
if not exist "%python_zip_installer%" powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest %python_url% -OutFile %python_zip_installer%"
if not exist "%python_zip_installer%" echo Failed to download Python, exiting.
if not exist "%python_zip_installer%" goto :eof
echo - Unzip %python_zip_installer% to %python_zip_install_path%
if not exist %python_zip_install_path% %installer_root%\win32_7za.exe x -y -o%tools_root% %python_zip_installer% > NUL
set python_version=3.9.0.2dot
set python_version_nodot=3902
set python_url=https://github.com/winpython/winpython/releases/download/3.0.20201028/Winpython64-%python_version%.exe
set python_zip=%installer_root%\win32_Winpython64-%python_version%.exe
set python_path=%tools_root%\WPy64-%python_version_nodot%
if exist "%python_path%" (
echo - [Cache] Python already installed at %python_path%
) else (
call :DownloadFile %python_url% "%python_zip%" || exit /b
call :Unzip "%python_zip%" "%tools_root%" || exit /b
)
REM
REM Generate Cmder Startup Config File
REM
set cmder_config_file=%cmder_root%\config\user_profile.cmd
echo - Generate cmder config at %cmder_config_file%
echo @echo off> %cmder_config_file%
echo set PATH=%zig_zip_install_path%;%python_zip_install_path%\python-3.9.0.amd64;%%PATH%%>> %cmder_config_file%
echo set HOME=%cmder_root%\..\Home>> %cmder_config_file%
echo set HOMEPATH=%cmder_root%\..\Home>> %cmder_config_file%
echo set USERPROFILE=%cmder_root%\..\Home>> %cmder_config_file%
echo alias gvim=%cmder_root%\..\Tools\GVim\gvim_noOLE.exe $*>> %cmder_config_file%
echo set PATH=%zig_path%;%python_path%;%%PATH%%>> "%cmder_config_file%"
echo set HOME=%cmder_root%\..\Home>> "%cmder_config_file%"
echo set HOMEPATH=%cmder_root%\..\Home>> "%cmder_config_file%"
echo set USERPROFILE=%cmder_root%\..\Home>> "%cmder_config_file%"
echo alias gvim=%cmder_root%\..\Tools\GVim\gvim.exe $*>> "%cmder_config_file%"
echo - Setup complete! Launch %cmder_root%\cmder.exe [or restart Cmder instance if you're updating an existing installation]
exit /b
REM
REM Functions
REM
:DownloadFile
set url=%~1
set dest_file=%~2
echo - [Download File] %url% to %dest_file%
if not exist %dest_file% powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest %url% -OutFile %dest_file%"
if not exist %dest_file% echo Failed to download file from %url%
exit /b %ERRORLEVEL%
:CopyFile
set src_file=%~1
set dest_file=%~2
copy /Y %src_file% %dest_file% > nul
if exist "%dest_file%" echo - [Copy File] %src_file% to %dest_file%
if not exist "%dest_file%" echo - [Copy File] Failed to copy file from %src_file% to %dest_file%
exit /b %ERRORLEVEL%
:Unzip
set zip_file=%~1
set dest=%~2
echo - [Unzip] %zip_file% to %dest%
%installer_root%\win32_7za.exe x -y -o%dest% %zip_file%
if not exist %dest% echo - [Unzip] Failed to unzip %zip_file% to %dest%
exit /b %ERRORLEVEL%