win: Merge SHA256 verification function

This commit is contained in:
doyle 2022-05-16 21:48:28 +10:00
parent 824c14fbf1
commit 5ffc053f28

View File

@ -56,11 +56,11 @@ set zip7_bootstrap_exe=!zip7_bootstrap_dir!\7za.exe
if not exist "!zip7_bootstrap_exe!" ( if not exist "!zip7_bootstrap_exe!" (
call :DownloadFile "https://www.7-zip.org/a/7za!zip7_bootstrap_version!.zip" "!zip7_bootstrap_zip!" || exit /B call :DownloadFile "https://www.7-zip.org/a/7za!zip7_bootstrap_version!.zip" "!zip7_bootstrap_zip!" || exit /B
call :VerifyZipSHA256 "!zip7_bootstrap_zip!" "!zip7_bootstrap_sha256!" || exit /B call :VerifyFileSHA256 "!zip7_bootstrap_zip!" "!zip7_bootstrap_sha256!" || exit /B
) )
if not exist "!zip7_bootstrap_dir!" powershell "Expand-Archive !zip7_bootstrap_zip! -DestinationPath !zip7_bootstrap_dir!" || exit /B if not exist "!zip7_bootstrap_dir!" powershell "Expand-Archive !zip7_bootstrap_zip! -DestinationPath !zip7_bootstrap_dir!" || exit /B
call :VerifyFileSHA256 "!zip7_bootstrap_exe!" "!zip7_bootstrap_version!" "!zip7_bootstrap_exe_sha256!" || exit /B call :VerifyFileSHA256 "!zip7_bootstrap_exe!" "!zip7_bootstrap_exe_sha256!" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
REM 7zip REM 7zip
@ -78,11 +78,11 @@ set zip7_exe=!zip7_dir!\7z.exe
if not exist "!zip7_exe!" ( if not exist "!zip7_exe!" (
call :DownloadFile "https://www.7-zip.org/a/7z!zip7_version!-x64.exe" "!zip7_zip!" || exit /B call :DownloadFile "https://www.7-zip.org/a/7z!zip7_version!-x64.exe" "!zip7_zip!" || exit /B
call :VerifyZipSHA256 "!zip7_zip!" "!zip7_sha256!" || exit /B call :VerifyFileSHA256 "!zip7_zip!" "!zip7_sha256!" || exit /B
"!zip7_bootstrap_exe!" x -y -o"!zip7_dir!" !zip7_zip! || exit /B "!zip7_bootstrap_exe!" x -y -o"!zip7_dir!" !zip7_zip! || exit /B
) )
call :VerifyFileSHA256 "!zip7_exe!" "!zip7_version!" "!zip7_exe_sha256!" || exit /B call :VerifyFileSHA256 "!zip7_exe!" "!zip7_exe_sha256!" || exit /B
REM Terminal REM Terminal
echo set PATH=!zip7_dir!;%%PATH%%>> "!tmp_terminal_script!" echo set PATH=!zip7_dir!;%%PATH%%>> "!tmp_terminal_script!"
@ -102,11 +102,11 @@ set gpg_w32_exe=!gpg_w32_bin_dir!\gpg.exe
if not exist "!gpg_w32_exe!" ( if not exist "!gpg_w32_exe!" (
call :DownloadFile "https://gnupg.org/ftp/gcrypt/binary/gnupg-w32-!gpg_w32_version!_!gpg_w32_date!.exe" "!gpg_w32_zip!" || exit /B call :DownloadFile "https://gnupg.org/ftp/gcrypt/binary/gnupg-w32-!gpg_w32_version!_!gpg_w32_date!.exe" "!gpg_w32_zip!" || exit /B
call :VerifyZipSHA256 "!gpg_w32_zip!" "!gpg_w32_sha256!" || exit /B call :VerifyFileSHA256 "!gpg_w32_zip!" "!gpg_w32_sha256!" || exit /B
call :Unzip "!gpg_w32_zip!" "!gpg_w32_dir!" || exit /B call :Unzip "!gpg_w32_zip!" "!gpg_w32_dir!" || exit /B
) )
call :VerifyFileSHA256 "!gpg_w32_exe!" "!gpg_w32_version!" "!gpg_w32_exe_sha256!" || exit /B call :VerifyFileSHA256 "!gpg_w32_exe!" "!gpg_w32_exe_sha256!" || exit /B
set PATH="!gpg_w32_bin_dir!";!PATH! set PATH="!gpg_w32_bin_dir!";!PATH!
REM Terminal REM Terminal
@ -130,12 +130,12 @@ set wezterm_exe=!wezterm_dir!\wezterm-gui.exe
if not exist "!wezterm_exe!" ( if not exist "!wezterm_exe!" (
call :DownloadFile https://github.com/wez/wezterm/releases/download/!wezterm_version!/WezTerm-windows-!wezterm_version!.zip "!wezterm_zip!" || exit /B call :DownloadFile https://github.com/wez/wezterm/releases/download/!wezterm_version!/WezTerm-windows-!wezterm_version!.zip "!wezterm_zip!" || exit /B
call :VerifyZipSHA256 "!wezterm_zip!" "!wezterm_sha256!" || exit /B call :VerifyFileSHA256 "!wezterm_zip!" "!wezterm_sha256!" || exit /B
call :Unzip "!wezterm_zip!" "!wezterm_dir!" || exit /B call :Unzip "!wezterm_zip!" "!wezterm_dir!" || exit /B
call :Move "!wezterm_dir!\wezterm-windows-!wezterm_version!" "!wezterm_dir!" || exit /B call :Move "!wezterm_dir!\wezterm-windows-!wezterm_version!" "!wezterm_dir!" || exit /B
) )
call :VerifyFileSHA256 "!wezterm_exe!" "!wezterm_version!" "!wezterm_exe_sha256!" || exit /B call :VerifyFileSHA256 "!wezterm_exe!" "!wezterm_exe_sha256!" || exit /B
call :CopyAndAlwaysOverwriteFile "!install_dir!\wezterm.lua" "!wezterm_dir!\wezterm.lua" || exit /B call :CopyAndAlwaysOverwriteFile "!install_dir!\wezterm.lua" "!wezterm_dir!\wezterm.lua" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
@ -151,11 +151,11 @@ set jetbrains_mono_file=!jetbrains_mono_dir!\fonts\ttf\JetBrainsMono-Regular.ttf
if not exist "!jetbrains_mono_file!" ( if not exist "!jetbrains_mono_file!" (
call :DownloadFile https://download.jetbrains.com/fonts/JetBrainsMono-!jetbrains_mono_version!.zip "!jetbrains_mono_zip!" || exit /B call :DownloadFile https://download.jetbrains.com/fonts/JetBrainsMono-!jetbrains_mono_version!.zip "!jetbrains_mono_zip!" || exit /B
call :VerifyZipSHA256 "!jetbrains_mono_zip!" "!jetbrains_mono_sha256!" || exit /B call :VerifyFileSHA256 "!jetbrains_mono_zip!" "!jetbrains_mono_sha256!" || exit /B
call :Unzip "!jetbrains_mono_zip!" "!jetbrains_mono_dir!" || exit /B call :Unzip "!jetbrains_mono_zip!" "!jetbrains_mono_dir!" || exit /B
) )
call :VerifyFileSHA256 "!jetbrains_mono_file!" "!jetbrains_mono_version!" "!jetbrains_mono_file_sha256!" || exit /B call :VerifyFileSHA256 "!jetbrains_mono_file!" "!jetbrains_mono_file_sha256!" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
REM Programming REM Programming
@ -173,12 +173,12 @@ set cmake_exe=!cmake_dir!\bin\cmake.exe
if not exist "!cmake_exe!" ( if not exist "!cmake_exe!" (
call :DownloadFile "https://github.com/Kitware/CMake/releases/download/v!cmake_version!/cmake-!cmake_version!-windows-x86_64.zip" "!cmake_zip!" || exit /B call :DownloadFile "https://github.com/Kitware/CMake/releases/download/v!cmake_version!/cmake-!cmake_version!-windows-x86_64.zip" "!cmake_zip!" || exit /B
call :VerifyZipSHA256 "!cmake_zip!" "!cmake_sha256!" || exit /B call :VerifyFileSHA256 "!cmake_zip!" "!cmake_sha256!" || exit /B
call :Unzip "!cmake_zip!" "!cmake_dir!" || exit /B call :Unzip "!cmake_zip!" "!cmake_dir!" || exit /B
call :Move "!cmake_dir!/cmake-!cmake_version!-windows-x86_64" "!cmake_dir!" || exit /B call :Move "!cmake_dir!/cmake-!cmake_version!-windows-x86_64" "!cmake_dir!" || exit /B
) )
call :VerifyFileSHA256 "!cmake_exe!" "!cmake_version!" "!cmake_exe_sha256!" || exit /B call :VerifyFileSHA256 "!cmake_exe!" "!cmake_exe_sha256!" || exit /B
call :MakeBatchShortcutInBinDir "cmake" "!cmake_exe!" call :MakeBatchShortcutInBinDir "cmake" "!cmake_exe!"
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
@ -196,11 +196,11 @@ set git_exe=!git_install_dir!\cmd\git.exe
if not exist "!git_exe!" ( if not exist "!git_exe!" (
call :DownloadFile "https://github.com/git-for-windows/git/releases/download/v!git_version!.windows.2/PortableGit-!git_version!.2-64-bit.7z.exe" "!git_zip!" || exit /B call :DownloadFile "https://github.com/git-for-windows/git/releases/download/v!git_version!.windows.2/PortableGit-!git_version!.2-64-bit.7z.exe" "!git_zip!" || exit /B
call :VerifyZipSHA256 "!git_zip!" "!git_sha256!" || exit /B call :VerifyFileSHA256 "!git_zip!" "!git_sha256!" || exit /B
call :Unzip "!git_zip!" "!git_install_dir!" || exit /B call :Unzip "!git_zip!" "!git_install_dir!" || exit /B
) )
call :VerifyFileSHA256 "!git_exe!" "!git_version!" "!git_exe_sha256!" || exit /B call :VerifyFileSHA256 "!git_exe!" "!git_exe_sha256!" || exit /B
REM Terminal REM Terminal
echo set PATH=!git_install_dir!\cmd;%%PATH%%>> "!tmp_terminal_script!" echo set PATH=!git_install_dir!\cmd;%%PATH%%>> "!tmp_terminal_script!"
@ -231,13 +231,13 @@ if not exist "!llvm_exe!" (
call :Unzip "!llvm_zip!" "!llvm_dir!" || exit /B call :Unzip "!llvm_zip!" "!llvm_dir!" || exit /B
) )
call :VerifyFileSHA256 "!llvm_exe!" "!llvm_version!" "!llvm_exe_sha256!" || exit /B call :VerifyFileSHA256 "!llvm_exe!" "!llvm_exe_sha256!" || exit /B
REM Clang Format REM Clang Format
set clang_format_py_sha256=36ba7aa047f8a8ac8fdc278aaa733de801cc84dea60a4210973fd3e4f0d2a330 set clang_format_py_sha256=36ba7aa047f8a8ac8fdc278aaa733de801cc84dea60a4210973fd3e4f0d2a330
set vim_clang_format=!vim_dir!\clang-format.py set vim_clang_format=!vim_dir!\clang-format.py
call :CopyAndAlwaysOverwriteFile "!llvm_dir!\share\clang\clang-format.py" "!vim_clang_format!" || exit /B call :CopyAndAlwaysOverwriteFile "!llvm_dir!\share\clang\clang-format.py" "!vim_clang_format!" || exit /B
call :VerifyFileSHA256 "!vim_clang_format!" "!llvm_version!" "!clang_format_py_sha256!" || exit /B call :VerifyFileSHA256 "!vim_clang_format!" "!clang_format_py_sha256!" || exit /B
REM Terminal REM Terminal
echo set PATH=!llvm_bin_dir!;%%PATH%%>> "!tmp_terminal_script!" echo set PATH=!llvm_bin_dir!;%%PATH%%>> "!tmp_terminal_script!"
@ -256,12 +256,12 @@ set mingw_exe=!mingw_bin_dir!\gcc.exe
if not exist "!mingw_exe!" ( if not exist "!mingw_exe!" (
call :DownloadFile \"https://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win64/Personal Builds/mingw-builds/!mingw_version!/threads-posix/seh/x86_64-!mingw_version!-release-posix-seh-rt_v6-rev0.7z\" !mingw_zip! || exit /B call :DownloadFile \"https://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win64/Personal Builds/mingw-builds/!mingw_version!/threads-posix/seh/x86_64-!mingw_version!-release-posix-seh-rt_v6-rev0.7z\" !mingw_zip! || exit /B
call :VerifyZipSHA256 !mingw_zip! !mingw_sha256! || exit /B call :VerifyFileSHA256 !mingw_zip! !mingw_sha256! || exit /B
call :Unzip !mingw_zip! !mingw_dir! || exit /B call :Unzip !mingw_zip! !mingw_dir! || exit /B
call :Move !mingw_dir!\mingw64 !mingw_dir! || exit /B call :Move !mingw_dir!\mingw64 !mingw_dir! || exit /B
) )
call :VerifyFileSHA256 "!mingw_exe!" "!mingw_version!" "!mingw_exe_sha256!" || exit /B call :VerifyFileSHA256 "!mingw_exe!" "!mingw_exe_sha256!" || exit /B
REM Terminal REM Terminal
echo set PATH=!mingw_bin_dir!;%%PATH%%>> "!tmp_terminal_script!" echo set PATH=!mingw_bin_dir!;%%PATH%%>> "!tmp_terminal_script!"
@ -279,11 +279,11 @@ set ninja_exe=!ninja_dir!\ninja.exe
if not exist "!ninja_exe!" ( if not exist "!ninja_exe!" (
call :DownloadFile "https://github.com/ninja-build/ninja/releases/download/v!ninja_version!/ninja-win.zip" "!ninja_zip!" || exit /B call :DownloadFile "https://github.com/ninja-build/ninja/releases/download/v!ninja_version!/ninja-win.zip" "!ninja_zip!" || exit /B
call :VerifyZipSHA256 "!ninja_zip!" "!ninja_sha256!" || exit /B call :VerifyFileSHA256 "!ninja_zip!" "!ninja_sha256!" || exit /B
call :Unzip "!ninja_zip!" "!ninja_dir!" || exit /B call :Unzip "!ninja_zip!" "!ninja_dir!" || exit /B
) )
call :VerifyFileSHA256 "!ninja_exe!" "!ninja_version!" "!ninja_exe_sha256!" || exit /B call :VerifyFileSHA256 "!ninja_exe!" "!ninja_exe_sha256!" || exit /B
call :MakeBatchShortcutInBinDir "ninja" "!ninja_exe!" call :MakeBatchShortcutInBinDir "ninja" "!ninja_exe!"
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
@ -299,12 +299,12 @@ set nodejs_exe=!nodejs_dir!\node.exe
if not exist "!nodejs_exe!" ( if not exist "!nodejs_exe!" (
call :DownloadFile "https://nodejs.org/dist/v!nodejs_version!/node-v!nodejs_version!-win-x64.7z" "!nodejs_zip!" || exit /B call :DownloadFile "https://nodejs.org/dist/v!nodejs_version!/node-v!nodejs_version!-win-x64.7z" "!nodejs_zip!" || exit /B
call :VerifyZipSHA256 "!nodejs_zip!" "!nodejs_sha256!" || exit /B call :VerifyFileSHA256 "!nodejs_zip!" "!nodejs_sha256!" || exit /B
call :Unzip "!nodejs_zip!" "!nodejs_dir!" || exit /B call :Unzip "!nodejs_zip!" "!nodejs_dir!" || exit /B
call :Move "!nodejs_dir!\node-v!nodejs_version!-win-x64" "!nodejs_dir!" || exit /B call :Move "!nodejs_dir!\node-v!nodejs_version!-win-x64" "!nodejs_dir!" || exit /B
) )
call :VerifyFileSHA256 "!nodejs_exe!" "!nodejs_version!" "!nodejs_exe_sha256!" || exit /B call :VerifyFileSHA256 "!nodejs_exe!" "!nodejs_exe_sha256!" || exit /B
REM Terminal REM Terminal
echo set PATH=!nodejs_dir!;%%PATH%%>> "!tmp_terminal_script!" echo set PATH=!nodejs_dir!;%%PATH%%>> "!tmp_terminal_script!"
@ -324,12 +324,12 @@ set python_exe=!python_dir!\python-3.9.0.amd64\python.exe
if not exist "!python_exe!" ( if not exist "!python_exe!" (
call :DownloadFile "https://github.com/winpython/winpython/releases/download/3.0.20201028/Winpython64-!python_version!.exe" "!python_zip!" || exit /B call :DownloadFile "https://github.com/winpython/winpython/releases/download/3.0.20201028/Winpython64-!python_version!.exe" "!python_zip!" || exit /B
call :VerifyZipSHA256 "!python_zip!" "!python_sha256!" || exit /B call :VerifyFileSHA256 "!python_zip!" "!python_sha256!" || exit /B
call :Unzip "!python_zip!" "!python_dir!" || exit /B call :Unzip "!python_zip!" "!python_dir!" || exit /B
call :Move "!python_dir!\WPy64-!python_version_nodot!" "!python_dir!" || exit /B call :Move "!python_dir!\WPy64-!python_version_nodot!" "!python_dir!" || exit /B
) )
call :VerifyFileSHA256 "!python_exe!" "!python_version!" "!python_exe_sha256!" || exit /B call :VerifyFileSHA256 "!python_exe!" "!python_exe_sha256!" || exit /B
set python_bin_dir=!python_dir!\python-!python_version_dot!.amd64 set python_bin_dir=!python_dir!\python-!python_version_dot!.amd64
set python_scripts_bin_dir=!python_bin_dir!\Scripts set python_scripts_bin_dir=!python_bin_dir!\Scripts
@ -352,12 +352,12 @@ set renderdoc_exe=!renderdoc_dir!\qrenderdoc.exe
if not exist "!renderdoc_exe!" ( if not exist "!renderdoc_exe!" (
call :DownloadFile "https://renderdoc.org/stable/!renderdoc_version!/RenderDoc_!renderdoc_version!_64.zip" "!renderdoc_zip!" || exit /B call :DownloadFile "https://renderdoc.org/stable/!renderdoc_version!/RenderDoc_!renderdoc_version!_64.zip" "!renderdoc_zip!" || exit /B
call :VerifyZipSHA256 "!renderdoc_zip!" "!renderdoc_sha256!" || exit /B call :VerifyFileSHA256 "!renderdoc_zip!" "!renderdoc_sha256!" || exit /B
call :Unzip "!renderdoc_zip!" "!renderdoc_dir!" || exit /B call :Unzip "!renderdoc_zip!" "!renderdoc_dir!" || exit /B
call :Move "!renderdoc_dir!\RenderDoc_!renderdoc_version!_64" "!renderdoc_dir!" || exit /B call :Move "!renderdoc_dir!\RenderDoc_!renderdoc_version!_64" "!renderdoc_dir!" || exit /B
) )
call :VerifyFileSHA256 "!renderdoc_exe!" "!renderdoc_version!" "!renderdoc_exe_sha256!" || exit /B call :VerifyFileSHA256 "!renderdoc_exe!" "!renderdoc_exe_sha256!" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
REM Zeal REM Zeal
@ -372,12 +372,12 @@ set zeal_exe=!zeal_dir!\zeal.exe
if not exist "!zeal_exe!" ( if not exist "!zeal_exe!" (
call :DownloadFile "https://github.com/zealdocs/zeal/releases/download/v!zeal_version!/zeal-portable-!zeal_version!-windows-x64.7z" "!zeal_zip!" || exit /B call :DownloadFile "https://github.com/zealdocs/zeal/releases/download/v!zeal_version!/zeal-portable-!zeal_version!-windows-x64.7z" "!zeal_zip!" || exit /B
call :VerifyZipSHA256 "!zeal_zip!" "!zeal_sha256!" || exit /B call :VerifyFileSHA256 "!zeal_zip!" "!zeal_sha256!" || exit /B
call :Unzip "!zeal_zip!" "!zeal_dir!" || exit /B call :Unzip "!zeal_zip!" "!zeal_dir!" || exit /B
call :Move "!zeal_dir!\zeal-portable-!zeal_version!-windows-x64" "!zeal_dir!" || exit /B call :Move "!zeal_dir!\zeal-portable-!zeal_version!-windows-x64" "!zeal_dir!" || exit /B
) )
call :VerifyFileSHA256 "!zeal_exe!" "!zeal_version!" "!zeal_exe_sha256!" || exit /B call :VerifyFileSHA256 "!zeal_exe!" "!zeal_exe_sha256!" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
REM Zig REM Zig
@ -393,11 +393,11 @@ set zig_exe=!zig_dir!\zig.exe
if not exist "!zig_exe!" ( if not exist "!zig_exe!" (
call :DownloadFile "https://ziglang.org/download/!zig_version!/!zig_file!" "!zig_zip!" || exit /B call :DownloadFile "https://ziglang.org/download/!zig_version!/!zig_file!" "!zig_zip!" || exit /B
call :VerifyZipSHA256 "!zig_zip!" "!zig_sha256!" || exit /B call :VerifyFileSHA256 "!zig_zip!" "!zig_sha256!" || exit /B
call :Unzip "!zig_zip!" "!zig_dir!" || exit /B call :Unzip "!zig_zip!" "!zig_dir!" || exit /B
) )
call :VerifyFileSHA256 "!zig_exe!" "!zig_version!" "!zig_exe_sha256!" || exit /B call :VerifyFileSHA256 "!zig_exe!" "!zig_exe_sha256!" || exit /B
call :MakeBatchShortcutInBinDir "zig" "!zig_exe!" call :MakeBatchShortcutInBinDir "zig" "!zig_exe!"
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
@ -437,7 +437,6 @@ set odin_dir=!tools_dir!\odin
set odin_git_hash=a4cb6f9 set odin_git_hash=a4cb6f9
set odin_exe_dir=!odin_dir!\build\!odin_git_hash! set odin_exe_dir=!odin_dir!\build\!odin_git_hash!
set odin_exe=!odin_exe_dir!\odin.exe set odin_exe=!odin_exe_dir!\odin.exe
set odin_exe_sha256=3dce3048cfbb4db9928ff4c8a54184a3e0ab3c6b16dc298578ed5aba9d3faa35
if not exist "!odin_dir!" ( if not exist "!odin_dir!" (
call !git_exe! clone https://github.com/odin-lang/odin.git !odin_dir! || exit /B call !git_exe! clone https://github.com/odin-lang/odin.git !odin_dir! || exit /B
@ -456,7 +455,6 @@ if not exist "!odin_exe!" (
) )
call :MakeBatchShortcutInBinDir "odin" "!odin_exe!" call :MakeBatchShortcutInBinDir "odin" "!odin_exe!"
call :VerifyFileSHA256 "!odin_exe!" "!odin_git_hash!" "!odin_exe_sha256!" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
REM QoL/Tools REM QoL/Tools
@ -476,14 +474,14 @@ set clink_bat=!clink_dir!\clink.bat
if not exist "!clink_exe!" ( if not exist "!clink_exe!" (
call :DownloadFile "https://github.com/chrisant996/clink/releases/download/v!clink_version!/clink.!clink_version!.!clink_git_hash!.zip" "!clink_zip!" || exit /B call :DownloadFile "https://github.com/chrisant996/clink/releases/download/v!clink_version!/clink.!clink_version!.!clink_git_hash!.zip" "!clink_zip!" || exit /B
call :VerifyZipSHA256 "!clink_zip!" "!clink_sha256!" || exit /B call :VerifyFileSHA256 "!clink_zip!" "!clink_sha256!" || exit /B
call :Unzip "!clink_zip!" "!clink_dir!" || exit /B call :Unzip "!clink_zip!" "!clink_dir!" || exit /B
call :Move "!clink_dir!\clink_!clink_version!" "!clink_dir!" || exit /B call :Move "!clink_dir!\clink_!clink_version!" "!clink_dir!" || exit /B
call :CopyAndAlwaysOverwriteFile "!clink_dir!\_default_inputrc" "!clink_dir!\default_inputrc" || exit /B call :CopyAndAlwaysOverwriteFile "!clink_dir!\_default_inputrc" "!clink_dir!\default_inputrc" || exit /B
call :CopyAndAlwaysOverwriteFile "!clink_dir!\_default_settings" "!clink_dir!\default_settings" || exit /B call :CopyAndAlwaysOverwriteFile "!clink_dir!\_default_settings" "!clink_dir!\default_settings" || exit /B
) )
call :VerifyFileSHA256 "!clink_exe!" "!clink_version!" "!clink_exe_sha256!" || exit /B call :VerifyFileSHA256 "!clink_exe!" "!clink_exe_sha256!" || exit /B
call :MakeBatchShortcutInBinDir "clink" "!clink_bat!" call :MakeBatchShortcutInBinDir "clink" "!clink_bat!"
REM Clink Completion Addon REM Clink Completion Addon
@ -510,11 +508,11 @@ set dependencies_exe=!dependencies_dir!\DependenciesGui.exe
if not exist "!dependencies_exe!" ( if not exist "!dependencies_exe!" (
call :DownloadFile "https://github.com/lucasg/Dependencies/releases/download/!dependencies_version!/Dependencies_x64_Release.zip" "!dependencies_zip!" || exit /B call :DownloadFile "https://github.com/lucasg/Dependencies/releases/download/!dependencies_version!/Dependencies_x64_Release.zip" "!dependencies_zip!" || exit /B
call :VerifyZipSHA256 "!dependencies_zip!" "!dependencies_sha256!" || exit /B call :VerifyFileSHA256 "!dependencies_zip!" "!dependencies_sha256!" || exit /B
call :Unzip "!dependencies_zip!" "!dependencies_dir!" || exit /B call :Unzip "!dependencies_zip!" "!dependencies_dir!" || exit /B
) )
call :VerifyFileSHA256 "!dependencies_exe!" "!dependencies_version!" "!dependencies_exe_sha256!" || exit /B call :VerifyFileSHA256 "!dependencies_exe!" "!dependencies_exe_sha256!" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
REM everything (void tools search program) REM everything (void tools search program)
@ -529,11 +527,11 @@ set everything_exe=!everything_dir!\everything.exe
if not exist "!everything_exe!" ( if not exist "!everything_exe!" (
call :DownloadFile "https://www.voidtools.com/Everything-!everything_version!.x64.zip" "!everything_zip!" || exit /B call :DownloadFile "https://www.voidtools.com/Everything-!everything_version!.x64.zip" "!everything_zip!" || exit /B
call :VerifyZipSHA256 "!everything_zip!" "!everything_sha256!" || exit /B call :VerifyFileSHA256 "!everything_zip!" "!everything_sha256!" || exit /B
call :Unzip "!everything_zip!" "!everything_dir!" || exit /B call :Unzip "!everything_zip!" "!everything_dir!" || exit /B
) )
call :VerifyFileSHA256 "!everything_exe!" "!everything_version!" "!everything_exe_sha256!" || exit /B call :VerifyFileSHA256 "!everything_exe!" "!everything_exe_sha256!" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
REM fzf REM fzf
@ -548,11 +546,11 @@ set fzf_exe=!fzf_dir!\fzf.exe
if not exist "!fzf_exe!-!fzf_version!.sha256.txt" ( if not exist "!fzf_exe!-!fzf_version!.sha256.txt" (
call :DownloadFile "https://github.com/junegunn/fzf/releases/download/!fzf_version!/fzf-!fzf_version!-windows_amd64.zip" "!fzf_zip!" || exit /B call :DownloadFile "https://github.com/junegunn/fzf/releases/download/!fzf_version!/fzf-!fzf_version!-windows_amd64.zip" "!fzf_zip!" || exit /B
call :VerifyZipSHA256 "!fzf_zip!" "!fzf_sha256!" || exit /B call :VerifyFileSHA256 "!fzf_zip!" "!fzf_sha256!" || exit /B
call :UnzipAndAlwaysOverwrite "!fzf_zip!" "!fzf_dir!" || exit /B call :UnzipAndAlwaysOverwrite "!fzf_zip!" "!fzf_dir!" || exit /B
) )
call :VerifyFileSHA256 "!fzf_exe!" "!fzf_version!" "!fzf_exe_sha256!" || exit /B call :VerifyFileSHA256 "!fzf_exe!" "!fzf_exe_sha256!" || exit /B
REM Terminal REM Terminal
REM Use RG for FZF to make it ultra fast REM Use RG for FZF to make it ultra fast
@ -575,7 +573,7 @@ REM DLL that hooks into GVIM and provides fullscreen with F11
set gvim_fullscreen_dll_sha256=1c83747b67ed73c05d44c1af8222a860bc5a48b56bf54cd6e21465a2deb78456 set gvim_fullscreen_dll_sha256=1c83747b67ed73c05d44c1af8222a860bc5a48b56bf54cd6e21465a2deb78456
set gvim_fullscreen_dll=!gvim_dir!\gvim_fullscreen.dll set gvim_fullscreen_dll=!gvim_dir!\gvim_fullscreen.dll
call :CopyAndAlwaysOverwriteFile "!install_dir!\win32_gvim_fullscreen.dll" "!gvim_fullscreen_dll!" || exit /B call :CopyAndAlwaysOverwriteFile "!install_dir!\win32_gvim_fullscreen.dll" "!gvim_fullscreen_dll!" || exit /B
call :VerifyFileSHA256 "!gvim_fullscreen_dll!" "none" "!gvim_fullscreen_dll_sha256!" || exit /B call :VerifyFileSHA256 "!gvim_fullscreen_dll!" "!gvim_fullscreen_dll_sha256!" || exit /B
set vim_plug_dir=!vim_dir!\autoload set vim_plug_dir=!vim_dir!\autoload
set vim_plug=!vim_plug_dir!\plug.vim set vim_plug=!vim_plug_dir!\plug.vim
@ -598,11 +596,11 @@ set imhex_exe=!imhex_dir!\imhex.exe
if not exist "!imhex_exe!-!imhex_version!.sha256.txt" ( if not exist "!imhex_exe!-!imhex_version!.sha256.txt" (
call :DownloadFile "https://github.com/WerWolv/ImHex/releases/download/v!imhex_version!/Windows.Portable.ZIP.zip" "!imhex_zip!" || exit /B call :DownloadFile "https://github.com/WerWolv/ImHex/releases/download/v!imhex_version!/Windows.Portable.ZIP.zip" "!imhex_zip!" || exit /B
call :VerifyZipSHA256 "!imhex_zip!" "!imhex_sha256!" || exit /B call :VerifyFileSHA256 "!imhex_zip!" "!imhex_sha256!" || exit /B
call :UnzipAndAlwaysOverwrite "!imhex_zip!" "!imhex_dir!" || exit /B call :UnzipAndAlwaysOverwrite "!imhex_zip!" "!imhex_dir!" || exit /B
) )
call :VerifyFileSHA256 "!imhex_exe!" "!imhex_version!" "!imhex_exe_sha256!" || exit /B call :VerifyFileSHA256 "!imhex_exe!" "!imhex_exe_sha256!" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
REM Joplin REM Joplin
@ -618,7 +616,7 @@ if not exist "!joplin_exe!" (
call :DownloadFile "https://github.com/laurent22/joplin/releases/download/v!joplin_version!/JoplinPortable.exe" "!joplin_exe!" || exit /B call :DownloadFile "https://github.com/laurent22/joplin/releases/download/v!joplin_version!/JoplinPortable.exe" "!joplin_exe!" || exit /B
) )
call :VerifyFileSHA256 "!joplin_exe!" "!joplin_version!" "!joplin_sha256!" || exit /B call :VerifyFileSHA256 "!joplin_exe!" "!joplin_sha256!" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
REM Keypirinha REM Keypirinha
@ -633,12 +631,12 @@ set keypirinha_exe=!keypirinha_dir!\keypirinha.exe
if not exist "!keypirinha_exe!" ( if not exist "!keypirinha_exe!" (
call :DownloadFile "https://github.com/Keypirinha/Keypirinha/releases/download/v!keypirinha_version!/keypirinha-!keypirinha_version!-x64-portable.7z" "!keypirinha_zip!" || exit /B call :DownloadFile "https://github.com/Keypirinha/Keypirinha/releases/download/v!keypirinha_version!/keypirinha-!keypirinha_version!-x64-portable.7z" "!keypirinha_zip!" || exit /B
call :VerifyZipSHA256 "!keypirinha_zip!" "!keypirinha_sha256!" || exit /B call :VerifyFileSHA256 "!keypirinha_zip!" "!keypirinha_sha256!" || exit /B
call :Unzip "!keypirinha_zip!" "!keypirinha_dir!" || exit /B call :Unzip "!keypirinha_zip!" "!keypirinha_dir!" || exit /B
call :Move "!keypirinha_dir!\keypirinha" "!keypirinha_dir!" || exit /B call :Move "!keypirinha_dir!\keypirinha" "!keypirinha_dir!" || exit /B
) )
call :VerifyFileSHA256 "!keypirinha_exe!" "!keypirinha_version!" "!keypirinha_exe_sha256!" || exit /B call :VerifyFileSHA256 "!keypirinha_exe!" "!keypirinha_exe_sha256!" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
REM Misc Tools REM Misc Tools
@ -664,11 +662,11 @@ set mobaxterm_exe=!mobaxterm_dir!\MobaXterm_Personal_21.2.exe
if not exist "!mobaxterm_exe!" ( if not exist "!mobaxterm_exe!" (
call :DownloadFile "https://download.mobatek.net/2122021051924233/MobaXterm_Portable_v!mobaxterm_version!.zip" !mobaxterm_zip! || exit /B call :DownloadFile "https://download.mobatek.net/2122021051924233/MobaXterm_Portable_v!mobaxterm_version!.zip" !mobaxterm_zip! || exit /B
call :VerifyZipSHA256 !mobaxterm_zip! !mobaxterm_sha256! || exit /B call :VerifyFileSHA256 !mobaxterm_zip! !mobaxterm_sha256! || exit /B
call :Unzip !mobaxterm_zip! !mobaxterm_dir! || exit /B call :Unzip !mobaxterm_zip! !mobaxterm_dir! || exit /B
) )
call :VerifyFileSHA256 "!mobaxterm_exe!" "!mobaxterm_version!" "!mobaxterm_exe_sha256!" || exit /B call :VerifyFileSHA256 "!mobaxterm_exe!" "!mobaxterm_exe_sha256!" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
REM O&O ShutUp10 (Privacy Tool for Windows) REM O&O ShutUp10 (Privacy Tool for Windows)
@ -698,11 +696,11 @@ set process_hacker_exe=!process_hacker_dir!\64bit\ProcessHacker.exe
if not exist "!process_hacker_exe!" ( if not exist "!process_hacker_exe!" (
call :DownloadFile "https://github.com/ProcessHackerRepoTool/nightly-builds-mirror/releases/download/v!process_hacker_version!/processhacker-!process_hacker_version!-bin.zip" "!process_hacker_zip!" || exit /B call :DownloadFile "https://github.com/ProcessHackerRepoTool/nightly-builds-mirror/releases/download/v!process_hacker_version!/processhacker-!process_hacker_version!-bin.zip" "!process_hacker_zip!" || exit /B
call :VerifyZipSHA256 "!process_hacker_zip!" "!process_hacker_sha256!" || exit /B call :VerifyFileSHA256 "!process_hacker_zip!" "!process_hacker_sha256!" || exit /B
call :Unzip "!process_hacker_zip!" "!process_hacker_dir!" || exit /B call :Unzip "!process_hacker_zip!" "!process_hacker_dir!" || exit /B
) )
call :VerifyFileSHA256 "!process_hacker_exe!" "!process_hacker_version!" "!process_hacker_exe_sha256!" || exit /B call :VerifyFileSHA256 "!process_hacker_exe!" "!process_hacker_exe_sha256!" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
REM ripgrep REM ripgrep
@ -717,12 +715,12 @@ set rg_exe=!rg_dir!\rg.exe
if not exist "!rg_exe!" ( if not exist "!rg_exe!" (
call :DownloadFile "https://github.com/BurntSushi/ripgrep/releases/download/!rg_version!/ripgrep-!rg_version!-x86_64-pc-windows-msvc.zip" "!rg_zip!" || exit /B call :DownloadFile "https://github.com/BurntSushi/ripgrep/releases/download/!rg_version!/ripgrep-!rg_version!-x86_64-pc-windows-msvc.zip" "!rg_zip!" || exit /B
call :VerifyZipSHA256 "!rg_zip!" "!rg_sha256!" || exit /B call :VerifyFileSHA256 "!rg_zip!" "!rg_sha256!" || exit /B
call :Unzip "!rg_zip!" "!rg_dir!" || exit /B call :Unzip "!rg_zip!" "!rg_dir!" || exit /B
call :Move "!rg_dir!\ripgrep-!rg_version!-x86_64-pc-windows-msvc" "!rg_dir!" || exit /B call :Move "!rg_dir!\ripgrep-!rg_version!-x86_64-pc-windows-msvc" "!rg_dir!" || exit /B
) )
call :VerifyFileSHA256 "!rg_exe!" "!rg_version!" "!rg_exe_sha256!" || exit /B call :VerifyFileSHA256 "!rg_exe!" "!rg_exe_sha256!" || exit /B
call :MakeBatchShortcutInBinDir "rg" "!rg_exe!" call :MakeBatchShortcutInBinDir "rg" "!rg_exe!"
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
@ -752,7 +750,7 @@ if not exist "!geth_exe!" (
call :Unzip "!geth_zip!" "!geth_dir!" || exit /B call :Unzip "!geth_zip!" "!geth_dir!" || exit /B
) )
call :VerifyFileSHA256 "!geth_exe!" "!geth_version!" "!geth_exe_sha256!" || exit /B call :VerifyFileSHA256 "!geth_exe!" "!geth_exe_sha256!" || exit /B
call :MakeBatchShortcutInBinDir "geth" "!geth_exe!" call :MakeBatchShortcutInBinDir "geth" "!geth_exe!"
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
@ -768,11 +766,11 @@ set remix_ide_exe=!remix_ide_dir!\Remix IDE.exe
if not exist "!remix_ide_exe!" ( if not exist "!remix_ide_exe!" (
call :DownloadFile "https://github.com/ethereum/remix-desktop/releases/download/v!remix_ide_version!/Remix-IDE-!remix_ide_version!-win.zip" "!remix_ide_zip!" || exit /B call :DownloadFile "https://github.com/ethereum/remix-desktop/releases/download/v!remix_ide_version!/Remix-IDE-!remix_ide_version!-win.zip" "!remix_ide_zip!" || exit /B
call :VerifyZipSHA256 "!remix_ide_zip!" "!remix_ide_sha256!" || exit /B call :VerifyFileSHA256 "!remix_ide_zip!" "!remix_ide_sha256!" || exit /B
call :Unzip "!remix_ide_zip!" "!remix_ide_dir!" || exit /B call :Unzip "!remix_ide_zip!" "!remix_ide_dir!" || exit /B
) )
call :VerifyFileSHA256 "!remix_ide_exe!" "!remix_ide_version!" "!remix_ide_exe_sha256!" || exit /B call :VerifyFileSHA256 "!remix_ide_exe!" "!remix_ide_exe_sha256!" || exit /B
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
REM solidity REM solidity
@ -788,7 +786,7 @@ if not exist "!solidity_exe!" (
call :DownloadFile "https://binaries.soliditylang.org/windows-amd64/solc-windows-amd64-v!solidity_version!.exe" "!solidity_exe!" || exit /B call :DownloadFile "https://binaries.soliditylang.org/windows-amd64/solc-windows-amd64-v!solidity_version!.exe" "!solidity_exe!" || exit /B
) )
call :VerifyFileSHA256 "!solidity_exe!" "!solidity_version!" "!solidity_exe_sha256!" || exit /B call :VerifyFileSHA256 "!solidity_exe!" "!solidity_exe_sha256!" || exit /B
call :MakeBatchShortcutInBinDir "solc" "!solidity_exe!" call :MakeBatchShortcutInBinDir "solc" "!solidity_exe!"
REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------
@ -895,7 +893,7 @@ call !zip7_dir!\7z.exe x -y -spe -o!dest! !zip_file!
exit /B !ERRORLEVEL! exit /B !ERRORLEVEL!
REM ------------------------------------------------------------------------------------------------ REM ------------------------------------------------------------------------------------------------
:VerifyZipSHA256 :VerifyFileSHA256
set file=%~1 set file=%~1
set expected_sha256=%~2 set expected_sha256=%~2
@ -916,29 +914,6 @@ if /I "!expected_sha256!" neq "!actual_sha256!" (
exit /B 0 exit /B 0
) )
REM ------------------------------------------------------------------------------------------------
:VerifyFileSHA256
set file=%~1
set version=%~2
set expected_sha256=%~3
REM Calculate hash
set calculated_sha256_file=!file!-!version!.sha256.txt
call powershell "$FileHash = Get-FileHash -algorithm sha256 \"!file!\"; $FileHash.Hash.ToLower()" > !calculated_sha256_file!
REM Verify Hash
set /p actual_sha256=< !calculated_sha256_file!
if /I "!expected_sha256!" neq "!actual_sha256!" (
echo - [Verify] !file!
echo sha256 hash does not match, failing.
echo Expected: !expected_sha256!
echo Calculated: !actual_sha256!
exit /B -1
) else (
echo - [Verify] !file! Hash OK: !expected_sha256!
exit /B 0
)
REM ------------------------------------------------------------------------------------------------ REM ------------------------------------------------------------------------------------------------
:VerifyFileMD5 :VerifyFileMD5
set file=%~1 set file=%~1