VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/Library/VeraCryptLib/mklinks_src.bat
blob: a62298ee307c37f4d5b020fb01ac9b6a09880988 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
@echo off
pushd %~dp0

if "%veracrypt_src%"=="" if exist %CD:~0,-28%\VeraCrypt\src set veracrypt_src=%CD:~0,-28%\VeraCrypt\src

call :select_path "%veracrypt_src%" "Select VeraCrypt directory:"
set veracrypt_src=%select_path_result%

set /P YesNo=Create links[Y/N]?
if /I ["%YesNo%"]==["Y"] goto :check_links
goto :end

:check_links
if NOT EXIST common goto :create_links
set /P create_links_del_ren=Old links detected [D]elete or [R]ename?

:create_links
if NOT EXIST common mkdir common
call :create_link common\Crc.c
call :create_link common\Crc.h
call :create_link common\Crypto.c
call :create_link common\Crypto.h
call :create_link common\Endian.c
call :create_link common\Endian.h
call :create_link common\GfMul.h
call :create_link common\Password.h
call :create_link common\Pkcs5.c
call :create_link common\Pkcs5.h
call :create_link common\Tcdefs.h
call :create_link common\Volumes.c
call :create_link common\Volumes.h
call :create_link common\Xml.c
call :create_link common\Xml.h
call :create_link common\Xts.c
call :create_link common\Xts.h

if NOT EXIST crypto mkdir crypto
call :create_link crypto\GostCipher.c
call :create_link crypto\GostCipher.h
call :create_link crypto\Gost89_x64.asm Gost89_x64.nasm
call :create_link crypto\Streebog.c
call :create_link crypto\Streebog.h
call :create_link crypto\kuznyechik.c
call :create_link crypto\kuznyechik.h
call :create_link crypto\Aes.h
call :create_link crypto\Aeskey.c
call :create_link crypto\Aesopt.h
call :create_link crypto\Aestab.c
call :create_link crypto\Aestab.h
call :create_link crypto\Aes_hw_cpu.h
call :create_link crypto\Aes_hw_cpu.asm Aes_hw_cpu.nasm
call :create_link crypto\Aes_x64.asm Aes_x64.nasm
call :create_link crypto\Aes_x86.asm Aes_x86.nasm
call :create_link crypto\cpu.h
call :create_link crypto\cpu.c
call :create_link crypto\config.h
call :create_link crypto\misc.h
call :create_link crypto\Rmd160.c
call :create_link crypto\Rmd160.h
call :create_link crypto\Serpent.c
call :create_link crypto\Serpent.h
call :create_link crypto\Sha2.c
call :create_link crypto\Sha2.h
call :create_link crypto\Twofish.c
call :create_link crypto\Twofish.h
call :create_link crypto\Whirlpool.c
call :create_link crypto\Whirlpool.h
call :create_link crypto\Camellia.c
call :create_link crypto\Camellia.h

set create_link_skip_pushd=Y
call :create_link Boot\Windows\BootCommon.h
call :create_link Boot\Windows\BootDefs.h
set create_link_skip_pushd=N

@echo on
copy /Y Twofish_x64.S.precompiled Twofish_x64.obj
@echo off

goto :end

:create_link
if /I NOT ["%create_link_skip_pushd%"]==["Y"] pushd %~dp1
set fn=%~n1%~x1
if NOT ["%2"]==[""] set fn=%2
call :get_bak_name %fn%
if /I ["%create_links_del_ren%"]==["R"] ren %fn% %name_bak%
if EXIST "%fn%" del %fn%
@echo on
mklink /H %fn% %veracrypt_src%\%1
@echo off
if /I NOT ["%create_link_skip_pushd%"]==["Y"] popd
goto :eof

:get_bak_name
set name_bak=%1
:get_bak_name_retry
if NOT EXIST %name_bak% goto :eof
set name_bak=%name_bak%.sv
goto :get_bak_name_retry

rem call select path
:select_path
set select_path_default=%1
if not exist "%select_path_default%" echo not found %select_path_default%
set select_path_msg=%2
set select_path_msg=%select_path_msg:~1,-1%

:select_path_retry
set select_path_result=
set /p select_path_result=[%select_path_default:~1,-1%] %select_path_msg%
if ["%select_path_result%"]==[""] set select_path_result=%select_path_default:~1,-1%
if exist %select_path_result% goto :eof
echo can not find %select_path_result%
goto :select_path_retry

:end
popd