Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
29710b28
Commit
29710b28
authored
Nov 27, 2019
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10.4' into 10.5
# Conflicts: # win/packaging/extra.wxs.in
parents
ddbbf976
96c6b2b6
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
260 additions
and
271 deletions
+260
-271
cmake/symlinks.cmake
cmake/symlinks.cmake
+4
-0
win/packaging/ca/CMakeLists.txt
win/packaging/ca/CMakeLists.txt
+13
-2
win/packaging/ca/CustomAction.cpp
win/packaging/ca/CustomAction.cpp
+214
-250
win/packaging/ca/CustomAction.def
win/packaging/ca/CustomAction.def
+3
-2
win/packaging/ca/symlinks.cc.in
win/packaging/ca/symlinks.cc.in
+6
-0
win/packaging/ca/symlinks.h
win/packaging/ca/symlinks.h
+8
-0
win/packaging/create_msi.cmake
win/packaging/create_msi.cmake
+0
-4
win/packaging/extra.wxs.in
win/packaging/extra.wxs.in
+12
-13
No files found.
cmake/symlinks.cmake
View file @
29710b28
# Create lists
# Create lists
if
(
COMMAND REGISTER_SYMLINK
)
return
()
endif
()
macro
(
REGISTER_SYMLINK from to
)
macro
(
REGISTER_SYMLINK from to
)
list
(
APPEND MARIADB_SYMLINK_FROMS
${
from
}
)
list
(
APPEND MARIADB_SYMLINK_FROMS
${
from
}
)
list
(
APPEND MARIADB_SYMLINK_TOS
${
to
}
)
list
(
APPEND MARIADB_SYMLINK_TOS
${
to
}
)
...
...
win/packaging/ca/CMakeLists.txt
View file @
29710b28
...
@@ -14,9 +14,20 @@
...
@@ -14,9 +14,20 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
INCLUDE_DIRECTORIES
(
${
WIX_DIR
}
/../SDK/
${
WIX_MSVC_SUFFIX
}
/inc
)
INCLUDE_DIRECTORIES
(
${
WIX_DIR
}
/../SDK/
${
WIX_MSVC_SUFFIX
}
/inc
)
SET
(
WIXCA_SOURCES CustomAction.cpp CustomAction.def
)
SET
(
WIXCA_SOURCES CustomAction.cpp CustomAction.def
${
CMAKE_CURRENT_BINARY_DIR
}
/symlinks.cc
)
INCLUDE_DIRECTORIES
(
${
CMAKE_SOURCE_DIR
}
/sql
)
INCLUDE_DIRECTORIES
(
${
CMAKE_SOURCE_DIR
}
/sql
${
CMAKE_CURRENT_SOURCE_DIR
}
)
INCLUDE
(
symlinks
)
LIST
(
LENGTH MARIADB_SYMLINK_FROMS LEN
)
MATH
(
EXPR max_index
"
${
LEN
}
-1"
)
SET
(
ALL_SYMLINKS
""
)
FOREACH
(
i RANGE 0
${
max_index
}
)
LIST
(
GET MARIADB_SYMLINK_FROMS
${
i
}
src
)
LIST
(
GET MARIADB_SYMLINK_TOS
${
i
}
dst
)
STRING
(
APPEND ALL_SYMLINKS
"{L
\"
${
src
}
\"
,L
\"
${
dst
}
\"
},
\n
"
)
ENDFOREACH
()
CONFIGURE_FILE
(
symlinks.cc.in symlinks.cc
)
# Custom action should not depend on C runtime, since we do not know if CRT is installed.
# Custom action should not depend on C runtime, since we do not know if CRT is installed.
FORCE_STATIC_CRT
()
FORCE_STATIC_CRT
()
...
...
win/packaging/ca/CustomAction.cpp
View file @
29710b28
...
@@ -746,7 +746,7 @@ extern "C" UINT __stdcall PresetDatabaseProperties(MSIHANDLE hInstall)
...
@@ -746,7 +746,7 @@ extern "C" UINT __stdcall PresetDatabaseProperties(MSIHANDLE hInstall)
if
(
BufferPoolsizeParamLen
&&
buff
[
0
])
if
(
BufferPoolsizeParamLen
&&
buff
[
0
])
{
{
WcaLog
(
LOGMSG_STANDARD
,
"BUFFERPOOLSIZE=%
s
, len=%u"
,
buff
,
BufferPoolsizeParamLen
);
WcaLog
(
LOGMSG_STANDARD
,
"BUFFERPOOLSIZE=%
S
, len=%u"
,
buff
,
BufferPoolsizeParamLen
);
InnodbBufferPoolSize
=
_wtoi64
(
buff
);
InnodbBufferPoolSize
=
_wtoi64
(
buff
);
}
}
else
else
...
@@ -1013,304 +1013,268 @@ extern "C" BOOL WINAPI DllMain(
...
@@ -1013,304 +1013,268 @@ extern "C" BOOL WINAPI DllMain(
return
TRUE
;
return
TRUE
;
}
}
// check if file exists
inline
bool
checkIfFileExists
(
wstring
&
name
)
{
string
sLog
=
"checkIfFileExists, "
;
string
sName
(
name
.
begin
(),
name
.
end
()
);
static
wstring
MakeExePath
(
const
wchar_t
*
installDir
,
const
wchar_t
*
basename
)
{
ifstream
f
(
sName
);
wstring
path
(
installDir
);
if
(
path
.
back
()
!=
L'\\'
)
sLog
.
append
(
sName
);
path
.
append
(
L"
\\
"
);
sLog
.
append
(
", result: "
);
path
.
append
(
L"bin
\\
"
);
bool
fileExists
=
f
.
good
();
path
.
append
(
basename
);
path
.
append
(
L".exe"
);
if
(
f
.
good
())
return
path
;
sLog
.
append
(
"true"
);
else
sLog
.
append
(
"false"
);
WcaLog
(
LOGMSG_STANDARD
,
sLog
.
c_str
());
return
f
.
good
();
}
}
// string to wstring
static
wstring
MakeExePath
(
const
wchar_t
*
installDir
,
string
basename
)
std
::
wstring
s2ws
(
const
std
::
string
&
s
)
{
{
int
len
;
wstring
path
(
installDir
)
;
int
slength
=
(
int
)
s
.
length
()
+
1
;
if
(
path
.
back
()
!=
L'\\'
)
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
s
.
c_str
(),
slength
,
0
,
0
);
path
.
append
(
L"
\\
"
);
wchar_t
*
buf
=
new
wchar_t
[
len
]
;
path
.
append
(
L"bin
\\
"
)
;
MultiByteToWideChar
(
CP_ACP
,
0
,
s
.
c_str
(),
slength
,
buf
,
len
);
for
(
auto
c
:
basename
)
std
::
wstring
r
(
buf
)
;
path
+=
c
;
delete
[]
buf
;
path
.
append
(
L".exe"
)
;
return
r
;
return
path
;
}
}
static
wstring
MakeFixSymlinksLogPath
()
/* MDEV-19781 MariaDB symlinks on Windows */
extern
"C"
UINT
__stdcall
CreateSymlinks
(
MSIHANDLE
hInstall
)
{
{
HRESULT
hr
=
S_OK
;
wchar_t
buf
[
MAX_PATH
];
UINT
er
=
ERROR_SUCCESS
;
if
(
GetTempPathW
(
MAX_PATH
,
buf
))
wchar_t
customActionData
[
10000
];
return
wstring
(
buf
)
+
L"
\\
mariadb_msi_fix_symlinks.log"
;
wchar_t
installDir
[
MAX_PATH
];
return
L""
;
DWORD
len
=
10000
;
}
wchar_t
installerVersion
[
MAX_VERSION_PROPERTY_SIZE
];
DWORD
size
=
MAX_VERSION_PROPERTY_SIZE
;
wchar_t
binDir
[
MAX_PATH
];
size_t
blen
=
NULL
;
hr
=
WcaInitialize
(
hInstall
,
__FUNCTION__
);
static
string
w2s
(
wstring
w
)
WcaLog
(
LOGMSG_STANDARD
,
"Initialized."
);
{
string
s
;
for
(
auto
wc
:
w
)
s
+=
(
char
)
wc
;
return
s
;
}
if
(
MsiGetPropertyW
(
hInstall
,
L"CustomActionData"
,
customActionData
,
&
len
)
!=
ERROR_SUCCESS
)
/*
Remove symlinks if target file does not exist.
Create symlink if target exists, but symlink is not.
*/
static
void
fix_symlink
(
const
wchar_t
*
file
,
const
wchar_t
*
link
,
const
wchar_t
*
installdir
,
vector
<
string
>
&
rollback_actions
)
{
WcaLog
(
LOGMSG_STANDARD
,
"fix_symlink %S=>%S"
,
link
,
file
);
auto
tgt
=
MakeExePath
(
installdir
,
file
);
auto
lnk
=
MakeExePath
(
installdir
,
link
);
auto
target_path
=
tgt
.
c_str
();
auto
link_path
=
lnk
.
c_str
();
auto
target_attr
=
GetFileAttributesW
(
target_path
);
auto
link_attr
=
GetFileAttributesW
(
link_path
);
WcaLog
(
LOGMSG_STANDARD
,
"%S %s"
,
target_path
,
target_attr
==
INVALID_FILE_ATTRIBUTES
?
"does not exist"
:
"exists"
);
WcaLog
(
LOGMSG_STANDARD
,
"%S %s"
,
link_path
,
link_attr
==
INVALID_FILE_ATTRIBUTES
?
"does not exist"
:
"exists"
);
if
(
link_attr
!=
INVALID_FILE_ATTRIBUTES
&&
((
link_attr
&
FILE_ATTRIBUTE_REPARSE_POINT
)
==
0
))
{
{
hr
=
HRESULT_FROM_WIN32
(
GetLastError
()
);
WcaLog
(
LOGMSG_STANDARD
,
"%S is not a symlink!"
,
link_path
);
MsiProcessMessage
(
hInstall
,
INSTALLMESSAGE_INFO
,
hr
)
;
return
;
}
}
if
(
MsiGetPropertyW
(
hInstall
,
L"ProductVersion"
,
installerVersion
,
&
size
)
!=
ERROR_SUCCES
S
)
if
(
target_attr
==
INVALID_FILE_ATTRIBUTE
S
)
{
{
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
if
(
link_attr
==
INVALID_FILE_ATTRIBUTES
)
MsiProcessMessage
(
hInstall
,
INSTALLMESSAGE_INFO
,
hr
);
{
return
;
}
auto
ok
=
DeleteFileW
(
link_path
);
WcaLog
(
LOGMSG_STANDARD
,
"DeleteFileW(L
\"
%S
\"
) returned %s, last error %lu"
,
link_path
,
ok
?
"success"
:
"error"
,
GetLastError
());
if
(
ok
)
{
rollback_actions
.
push_back
(
string
(
"create_symlink "
)
+
w2s
(
link
)
+
" "
+
w2s
(
file
));
}
return
;
}
}
MsiProcessMessage
(
hInstall
,
INSTALLMESSAGE_INFO
,
hr
);
if
(
link_attr
!=
INVALID_FILE_ATTRIBUTES
)
return
;
auto
ok
=
CreateSymbolicLinkW
(
link_path
,
target_path
,
0
);
WcaLog
(
LOGMSG_STANDARD
,
"CreateSymbolicLinkW(
\"
%S
\"
,
\"
%S
\"
, 0) returned %s, last error %d"
,
link_path
,
target_path
,
ok
?
"success"
:
"error"
,
(
int
)
GetLastError
());
if
(
ok
)
rollback_actions
.
push_back
(
string
(
"delete "
)
+
w2s
(
link
));
}
wstring
wsCustomActionData
(
customActionData
);
static
string
rollback_info_path
()
string
sCustomActionData
(
wsCustomActionData
.
begin
(),
wsCustomActionData
.
end
());
{
WcaLog
(
LOGMSG_STANDARD
,
sCustomActionData
.
c_str
());
char
tmppath
[
MAX_PATH
];
if
(
!
GetTempPathA
(
MAX_PATH
,
tmppath
))
return
""
;
string
filepath
(
tmppath
);
filepath
.
append
(
"
\\
mariadb_symlink_rollback_info.tmp"
);
return
filepath
;
}
stringstream
ss
;
ss
<<
sCustomActionData
;
vector
<
string
>
vCustomActionData
;
while
(
ss
.
good
()
)
static
void
save_symlink_rollback_info
(
vector
<
string
>
rollback_info
)
{
std
::
ofstream
ofs
;
string
path
=
rollback_info_path
();
ofs
.
open
(
path
,
std
::
ofstream
::
out
|
std
::
ofstream
::
trunc
);
if
(
!
ofs
.
good
())
return
;
WcaLog
(
LOGMSG_STANDARD
,
"Storing this rollback script for custom action in %s, in case installation rolls back"
,
path
.
c_str
());
for
(
auto
line
:
rollback_info
)
{
{
string
substr
;
WcaLog
(
LOGMSG_STANDARD
,
"%s"
,
line
.
c_str
());
getline
(
ss
,
substr
,
'|'
);
ofs
<<
line
<<
"
\n
"
;
WcaLog
(
LOGMSG_STANDARD
,
substr
.
c_str
());
vCustomActionData
.
push_back
(
substr
);
}
}
WcaLog
(
LOGMSG_STANDARD
,
"End of rollback script"
);
}
int
i
=
0
;
string
sBinPath
=
""
;
string
sPathFrom
=
""
;
string
sPathTo
=
""
;
for
(
auto
const
&
value
:
vCustomActionData
)
{
if
(
i
==
0
)
{
sBinPath
=
value
;
sBinPath
.
append
(
"bin
\\
"
);
}
else
if
(
i
==
1
)
{
sPathFrom
=
value
;
}
else
if
(
i
==
2
)
{
sPathTo
=
value
;
}
WcaLog
(
LOGMSG_STANDARD
,
value
.
c_str
());
i
++
;
#include <symlinks.h>
}
/* MDEV-19781 MariaDB symlinks on Windows */
extern
"C"
UINT
__stdcall
FixSymlinksRollback
(
MSIHANDLE
hInstall
)
WcaLog
(
LOGMSG_STANDARD
,
sBinPath
.
c_str
());
{
WcaLog
(
LOGMSG_STANDARD
,
sPathFrom
.
c_str
());
HRESULT
hr
=
S_OK
;
WcaLog
(
LOGMSG_STANDARD
,
sPathTo
.
c_str
());
UINT
er
=
ERROR_SUCCESS
;
wchar_t
targetdir
[
MAX_PATH
];
stringstream
ssPathFrom
,
ssPathTo
;
DWORD
len
=
MAX_PATH
;
ssPathFrom
<<
sPathFrom
;
hr
=
WcaInitialize
(
hInstall
,
__FUNCTION__
);
ssPathTo
<<
sPathTo
;
WcaLog
(
LOGMSG_STANDARD
,
"Initialized."
);
vector
<
string
>
vPathFrom
;
std
::
ifstream
ifs
;
vector
<
string
>
vPathTo
;
std
::
string
command
;
while
(
ssPathFrom
.
good
())
{
string
substr
=
""
;
getline
(
ssPathFrom
,
substr
,
';'
);
substr
=
substr
.
insert
(
0
,
sBinPath
);
WcaLog
(
LOGMSG_STANDARD
,
substr
.
c_str
());
vPathFrom
.
push_back
(
substr
);
}
while
(
ssPathTo
.
good
())
{
if
(
MsiGetPropertyW
(
hInstall
,
L"CustomActionData"
,
targetdir
,
&
len
)
!=
string
substr
=
""
;
ERROR_SUCCESS
)
getline
(
ssPathTo
,
substr
,
';'
);
{
substr
=
substr
.
insert
(
0
,
sBinPath
);
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
WcaLog
(
LOGMSG_STANDARD
,
substr
.
c_str
());
ExitOnFailure
(
hr
,
"MsiGetPropertyW failed"
);
vPathTo
.
push_back
(
substr
);
}
}
i
=
0
;
ifs
.
open
(
rollback_info_path
(),
std
::
ofstream
::
in
);
if
(
!
ifs
.
good
())
for
(
auto
const
&
value
:
vPathTo
)
{
goto
LExit
;
string
&
sTmpPathFrom
=
vPathFrom
[
i
];
string
&
sTmpPathTo
=
vPathTo
[
i
];
sTmpPathFrom
.
append
(
".exe"
);
sTmpPathTo
.
append
(
".exe"
);
wstring
wsPathFrom
=
s2ws
(
sTmpPathFrom
);
LPCWSTR
lPathFrom
=
wsPathFrom
.
c_str
();
wstring
wsPathTo
=
s2ws
(
sTmpPathTo
);
LPCWSTR
lPathTo
=
wsPathTo
.
c_str
();
int
createdSymlink
=
-
1
;
if
(
checkIfFileExists
(
wsPathFrom
))
createdSymlink
=
CreateSymbolicLinkW
(
wsPathTo
.
c_str
(),
wsPathFrom
.
c_str
(),
0
);
string
created
=
"Created symlink: "
;
created
.
append
(
sTmpPathTo
);
created
.
append
(
" --> "
);
created
.
append
(
sTmpPathFrom
);
created
.
append
(
", result= "
);
created
.
append
(
to_string
(
createdSymlink
));
WcaLog
(
LOGMSG_STANDARD
,
created
.
c_str
());
i
++
;
while
(
ifs
>>
command
)
{
if
(
command
==
"create_symlink"
)
{
string
link
;
ifs
>>
link
;
auto
link_path
=
MakeExePath
(
targetdir
,
link
);
string
file
;
ifs
>>
file
;
auto
target_path
=
MakeExePath
(
targetdir
,
file
);
bool
ok
=
CreateSymbolicLinkW
(
link_path
.
c_str
(),
target_path
.
c_str
(),
0
);
WcaLog
(
LOGMSG_STANDARD
,
"CreateSymbolicLinkW(%S,%S) %s, last error %lu"
,
link_path
.
c_str
(),
target_path
.
c_str
(),
ok
?
"success"
:
"error"
,
GetLastError
());
}
else
if
(
command
==
"delete"
)
{
string
link
;
ifs
>>
link
;
auto
link_path
=
MakeExePath
(
targetdir
,
link
);
auto
link_attr
=
GetFileAttributesW
(
link_path
.
c_str
());
if
(
link_attr
!=
INVALID_FILE_ATTRIBUTES
&&
(
link_attr
&
FILE_ATTRIBUTE_REPARSE_POINT
))
{
auto
ok
=
DeleteFileW
(
link_path
.
c_str
());
WcaLog
(
LOGMSG_STANDARD
,
"DeleteFile(%S) %s, last error %lu"
,
link_path
.
c_str
(),
ok
?
"success"
:
"error"
,
GetLastError
());
}
}
else
{
WcaLog
(
LOGMSG_STANDARD
,
"Unknown command '%s' in rollback script "
,
command
.
c_str
());
goto
LExit
;
}
}
}
ReleaseStr
(
installDir
);
LExit:
ReleaseStr
(
installerVersion
);
ReleaseStr
(
binDir
);
return
WcaFinalize
(
er
);
return
WcaFinalize
(
er
);
}
}
/* MDEV-19781 MariaDB symlinks on Windows */
extern
"C"
UINT
__stdcall
DeleteSymlinks
(
MSIHANDLE
hInstall
)
extern
"C"
UINT
__stdcall
SymlinksUninstall
(
MSIHANDLE
hInstall
)
{
{
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
UINT
er
=
ERROR_SUCCESS
;
UINT
er
=
ERROR_SUCCESS
;
wchar_t
customActionData
[
10000
];
wchar_t
targetdir
[
MAX_PATH
];
wchar_t
installDir
[
MAX_PATH
];
DWORD
len
=
MAX_PATH
;
DWORD
len
=
10000
;
int
i
;
DWORD
size
=
MAX_VERSION_PROPERTY_SIZE
;
wchar_t
binDir
[
MAX_PATH
];
size_t
blen
=
NULL
;
hr
=
WcaInitialize
(
hInstall
,
__FUNCTION__
);
hr
=
WcaInitialize
(
hInstall
,
__FUNCTION__
);
WcaLog
(
LOGMSG_STANDARD
,
"
DeleteSymlinks i
nitialized."
);
WcaLog
(
LOGMSG_STANDARD
,
"
I
nitialized."
);
if
(
MsiGetPropertyW
(
hInstall
,
L"CustomActionData"
,
customActionData
,
&
len
)
!=
ERROR_SUCCESS
)
if
(
MsiGetPropertyW
(
hInstall
,
L"CustomActionData"
,
targetdir
,
&
len
)
!=
ERROR_SUCCESS
)
{
{
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
MsiProcessMessage
(
hInstall
,
INSTALLMESSAGE_INFO
,
hr
);
ExitOnFailure
(
hr
,
"MsiGetPropertyW failed"
);
}
}
wstring
wsCustomActionData
(
customActionData
);
for
(
i
=
0
;
all_symlinks
[
i
].
file
;
i
++
)
string
sCustomActionData
(
wsCustomActionData
.
begin
(),
wsCustomActionData
.
end
());
WcaLog
(
LOGMSG_STANDARD
,
sCustomActionData
.
c_str
());
stringstream
ss
;
ss
<<
sCustomActionData
;
vector
<
string
>
vCustomActionData
;
while
(
ss
.
good
()
)
{
{
string
substr
;
auto
link_path
=
MakeExePath
(
targetdir
,
all_symlinks
[
i
].
link
);
getline
(
ss
,
substr
,
'|'
);
auto
link_attr
=
GetFileAttributesW
(
link_path
.
c_str
());
WcaLog
(
LOGMSG_STANDARD
,
substr
.
c_str
());
auto
filepath
=
link_path
.
c_str
();
vCustomActionData
.
push_back
(
substr
);
}
int
i
=
0
;
if
(
link_attr
==
INVALID_FILE_ATTRIBUTES
)
string
sBinPath
=
""
;
{
string
sPathFrom
=
""
;
WcaLog
(
LOGMSG_STANDARD
,
" %S does not exist"
,
filepath
);
string
sPathTo
=
""
;
continue
;
for
(
auto
const
&
value
:
vCustomActionData
)
{
if
(
i
==
0
)
{
sBinPath
=
value
;
sBinPath
.
append
(
"bin
\\
"
);
}
else
if
(
i
==
1
)
{
sPathFrom
=
value
;
}
else
if
(
i
==
2
)
{
sPathTo
=
value
;
}
}
WcaLog
(
LOGMSG_STANDARD
,
value
.
c_str
());
if
(
!
(
link_attr
&
FILE_ATTRIBUTE_REPARSE_POINT
))
{
i
++
;
WcaLog
(
LOGMSG_STANDARD
,
" %S is not a symbolic link!"
,
filepath
);
}
continue
;
}
WcaLog
(
LOGMSG_STANDARD
,
sBinPath
.
c_str
());
BOOL
ok
=
DeleteFileW
(
filepath
);
WcaLog
(
LOGMSG_STANDARD
,
sPathFrom
.
c_str
());
WcaLog
(
LOGMSG_STANDARD
,
"DeleteFile(%S) %s, last error %lu"
,
WcaLog
(
LOGMSG_STANDARD
,
sPathTo
.
c_str
());
filepath
,
ok
?
"succeeded"
:
"failed"
,
GetLastError
());
stringstream
ssPathFrom
,
ssPathTo
;
ssPathFrom
<<
sPathFrom
;
ssPathTo
<<
sPathTo
;
vector
<
string
>
vPathFrom
;
vector
<
string
>
vPathTo
;
while
(
ssPathFrom
.
good
())
{
string
substr
=
""
;
getline
(
ssPathFrom
,
substr
,
';'
);
substr
=
substr
.
insert
(
0
,
sBinPath
);
WcaLog
(
LOGMSG_STANDARD
,
substr
.
c_str
());
vPathFrom
.
push_back
(
substr
);
}
while
(
ssPathTo
.
good
())
{
string
substr
=
""
;
getline
(
ssPathTo
,
substr
,
';'
);
substr
=
substr
.
insert
(
0
,
sBinPath
);
WcaLog
(
LOGMSG_STANDARD
,
substr
.
c_str
());
vPathTo
.
push_back
(
substr
);
}
}
i
=
0
;
LExit:
return
WcaFinalize
(
er
);
for
(
auto
const
&
value
:
vPathTo
)
{
}
string
&
sTmpPathFrom
=
vPathFrom
[
i
];
string
&
sTmpPathTo
=
vPathTo
[
i
];
sTmpPathFrom
.
append
(
".exe"
);
sTmpPathTo
.
append
(
".exe"
);
wstring
wsPathFrom
=
s2ws
(
sTmpPathFrom
);
LPCWSTR
lPathFrom
=
wsPathFrom
.
c_str
();
wstring
wsPathTo
=
s2ws
(
sTmpPathTo
);
LPCWSTR
lPathTo
=
wsPathTo
.
c_str
();
int
deletedSymlink
=
-
1
;
if
(
checkIfFileExists
(
wsPathTo
))
deletedSymlink
=
DeleteFileW
(
wsPathTo
.
c_str
());
string
deleted
=
"Deleted symlink: "
;
deleted
.
append
(
sTmpPathTo
);
deleted
.
append
(
" --> "
);
deleted
.
append
(
sTmpPathFrom
);
deleted
.
append
(
", result= "
);
deleted
.
append
(
to_string
(
deletedSymlink
));
WcaLog
(
LOGMSG_STANDARD
,
deleted
.
c_str
());
/* MDEV-19781 MariaDB symlinks on Windows */
extern
"C"
UINT
__stdcall
FixSymlinks
(
MSIHANDLE
hInstall
)
{
HRESULT
hr
=
S_OK
;
UINT
er
=
ERROR_SUCCESS
;
wchar_t
targetdir
[
MAX_PATH
];
vector
<
string
>
rollback_actions
;
DWORD
len
=
MAX_PATH
;
int
i
;
hr
=
WcaInitialize
(
hInstall
,
__FUNCTION__
);
WcaLog
(
LOGMSG_STANDARD
,
"Initialized."
);
i
++
;
if
(
MsiGetPropertyW
(
hInstall
,
L"CustomActionData"
,
targetdir
,
&
len
)
!=
ERROR_SUCCESS
)
{
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
ExitOnFailure
(
hr
,
"MsiGetPropertyW failed"
);
}
}
/*
for(size_t i = 0; i < std::size(symlink_to); i++) {
wchar_t pathTo[MAX_PATH];
wcscpy(pathTo, binDir);
for
(
i
=
0
;
all_symlinks
[
i
].
file
;
i
++
)
wcscat(pathTo, symlink_to[i].data());
fix_symlink
(
all_symlinks
[
i
].
file
,
all_symlinks
[
i
].
link
,
targetdir
,
rollback_actions
);
wstring wsPathTo(pathTo
);
save_symlink_rollback_info
(
rollback_actions
);
if ( checkIfFileExists(wsPathTo) ) {
LExit:
DeleteFileW(pathTo);
} else {
hr = HRESULT_FROM_WIN32(GetLastError());
ExitOnFailure(hr, "Could not delete symlink");
}
}
*/
ReleaseStr
(
installDir
);
ReleaseStr
(
binDir
);
return
WcaFinalize
(
er
);
return
WcaFinalize
(
er
);
}
}
\ No newline at end of file
win/packaging/ca/CustomAction.def
View file @
29710b28
...
@@ -8,5 +8,6 @@ CheckDatabaseProperties
...
@@ -8,5 +8,6 @@ CheckDatabaseProperties
CheckDataDirectoryEmpty
CheckDataDirectoryEmpty
CheckDBInUse
CheckDBInUse
CheckServiceUpgrades
CheckServiceUpgrades
CreateSymlinks
FixSymlinks
DeleteSymlinks
FixSymlinksRollback
SymlinksUninstall
win/packaging/ca/symlinks.cc.in
0 → 100644
View file @
29710b28
#include "symlinks.h"
symlink all_symlinks[]=
{
@ALL_SYMLINKS@
{nullptr, nullptr}
};
win/packaging/ca/symlinks.h
0 → 100644
View file @
29710b28
#pragma once
struct
symlink
{
const
wchar_t
*
file
;
const
wchar_t
*
link
;
};
extern
symlink
all_symlinks
[];
win/packaging/create_msi.cmake
View file @
29710b28
# get the symlink lists
#INCLUDE(${CMAKE_SOURCE_DIR}/../../cmake/symlinks.cmake)
#INCLUDE(symlinks)
INCLUDE
(
${
CMAKE_CURRENT_LIST_DIR
}
/../../cmake/symlinks.cmake
)
MACRO
(
MAKE_WIX_IDENTIFIER str varname
)
MACRO
(
MAKE_WIX_IDENTIFIER str varname
)
STRING
(
REPLACE
"/"
"."
${
varname
}
"
${
str
}
"
)
STRING
(
REPLACE
"/"
"."
${
varname
}
"
${
str
}
"
)
...
...
win/packaging/extra.wxs.in
View file @
29710b28
...
@@ -59,9 +59,6 @@
...
@@ -59,9 +59,6 @@
<Property
Id=
"BUFFERPOOLSIZE"
Secure=
"yes"
/>
<Property
Id=
"BUFFERPOOLSIZE"
Secure=
"yes"
/>
<!-- Innodb page size -->
<!-- Innodb page size -->
<Property
Id=
"PAGESIZE"
Secure=
"yes"
Value=
"16K"
/>
<Property
Id=
"PAGESIZE"
Secure=
"yes"
Value=
"16K"
/>
<!-- Symlinks -->
<Property
Id=
"SYMLINK_TOS"
Value=
"@MARIADB_SYMLINK_TOS@"
/>
<Property
Id=
"SYMLINK_FROMS"
Value=
"@MARIADB_SYMLINK_FROMS@"
/>
<CustomAction
Id=
"LaunchUrl"
BinaryKey=
"WixCA"
DllEntry=
"WixShellExec"
Execute=
"immediate"
Return=
"check"
Impersonate=
"yes"
/>
<CustomAction
Id=
"LaunchUrl"
BinaryKey=
"WixCA"
DllEntry=
"WixShellExec"
Execute=
"immediate"
Return=
"check"
Impersonate=
"yes"
/>
...
@@ -601,16 +598,19 @@
...
@@ -601,16 +598,19 @@
<?endif ?>
<?endif ?>
<!-- Custom action, create symlinks -->
<!-- Custom action, create symlinks -->
<CustomAction
Id=
"CreateSymlinks.SetProperty"
Return=
"check"
Property=
"CreateSymlinks"
Value=
"[INSTALLDIR]|[SYMLINK_FROMS]|[SYMLINK_TOS]"
/>
<CustomAction
Id=
"Symlinks.SetProperty"
Return=
"check"
Property=
"Symlinks"
Value=
"[INSTALLDIR]"
/>
<CustomAction
Id=
"CreateSymlinks"
BinaryKey=
"wixca.dll"
DllEntry=
"CreateSymlinks"
Execute=
"deferred"
Impersonate=
"no"
Return=
"ignore"
/>
<CustomAction
Id=
"Symlinks"
BinaryKey=
"wixca.dll"
DllEntry=
"FixSymlinks"
Execute=
"deferred"
Impersonate=
"no"
Return=
"ignore"
/>
<CustomAction
Id=
"DeleteSymlinks.SetProperty"
Return=
"check"
Property=
"DeleteSymlinks"
Value=
"[INSTALLDIR]|[SYMLINK_FROMS]|[SYMLINK_TOS]"
/>
<CustomAction
Id=
"SymlinksRollback.SetProperty"
Return=
"check"
Property=
"SymlinksRollback"
Value=
"[INSTALLDIR]"
/>
<CustomAction
Id=
'DeleteSymlinks'
BinaryKey=
"wixca.dll"
DllEntry=
"DeleteSymlinks"
Execute=
"deferred"
Impersonate=
"no"
Return=
"ignore"
/>
<CustomAction
Id=
"SymlinksRollback"
BinaryKey=
"wixca.dll"
DllEntry=
"FixSymlinksRollback"
Execute=
"rollback"
Impersonate=
"no"
Return=
"ignore"
/>
<CustomAction
Id=
"SymlinksUninstall.SetProperty"
Return=
"check"
Property=
"SymlinksUninstall"
Value=
"[INSTALLDIR]"
/>
<CustomAction
Id=
"SymlinksUninstall"
BinaryKey=
"wixca.dll"
DllEntry=
"SymlinksUninstall"
Execute=
"deferred"
Impersonate=
"no"
Return=
"ignore"
/>
<InstallExecuteSequence>
<InstallExecuteSequence>
<Custom
Action=
"CreateSymlinks.SetProperty"
Before=
"CreateSymlinks"
>
NOT Installed
</Custom>
<Custom
Action=
"Symlinks.SetProperty"
Before=
"Symlinks"
>
NOT Installed OR UPGRADINGPRODUCTCODE
</Custom>
<Custom
Action=
"CreateSymlinks"
Before=
"InstallFinalize"
>
NOT Installed
</Custom>
<Custom
Action=
"Symlinks"
After=
"SymlinksRollback"
>
NOT Installed OR UPGRADINGPRODUCTCODE
</Custom>
<Custom
Action=
"DeleteSymlinks.SetProperty"
Before=
"DeleteSymlinks"
>
Installed AND NOT REINSTALL
</Custom>
<Custom
Action=
"SymlinksRollback.SetProperty"
Before=
"SymlinksRollback"
>
NOT Installed OR UPGRADINGPRODUCTCODE
</Custom>
<Custom
Action=
"DeleteSymlinks"
Before=
"RemoveFiles"
>
Installed AND NOT REINSTALL
</Custom>
<Custom
Action=
"SymlinksRollback"
After=
"InstallFiles"
>
NOT Installed OR UPGRADINGPRODUCTCODE
</Custom>
<Custom
Action=
"SymlinksUninstall.SetProperty"
Before=
"SymlinksUninstall"
>
Installed AND NOT UPGRADINGPRODUCTCODE
</Custom>
<Custom
Action=
"SymlinksUninstall"
Before=
"RemoveFiles"
>
Installed AND NOT UPGRADINGPRODUCTCODE
</Custom>
</InstallExecuteSequence>
</InstallExecuteSequence>
<!-- Custom action, call mysql_install_db -->
<!-- Custom action, call mysql_install_db -->
...
@@ -821,7 +821,6 @@
...
@@ -821,7 +821,6 @@
Name=
'MinorVersion'
Value=
'@MINOR_VERSION@'
Type=
'string'
/>
Name=
'MinorVersion'
Value=
'@MINOR_VERSION@'
Type=
'string'
/>
</Component>
</Component>
</Feature>
</Feature>
<Condition
Message=
<Condition
Message=
'Setting the ALLUSERS property is not allowed because [ProductName] is a per-machine application. Setup will now exit.'
>
'Setting the ALLUSERS property is not allowed because [ProductName] is a per-machine application. Setup will now exit.'
>
<![CDATA[ALLUSERS = "1"]]>
<![CDATA[ALLUSERS = "1"]]>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment