Kaydet (Commit) b8424437 authored tarafından Mike Kaganski's avatar Mike Kaganski

Install UCRT from MSUs, not using nested VC Redist install

Using nested install is bad because (1) MS advises against it (though it
most possibly doesn't relate to our specific case, when we install the
vc redist exe package in UI part, so actually only a single MSI session
is active at any time); (2) because it adds some extra interactions
(user sees something "unrelated" being installed, which raises concerns;
additional admin authentication required); and (3) because it runs in
InstallUISequence, thus only installing the UCRT when doing interactive
installation (unattended installs, including GPO, need to install UCRT
separately).

This patch aims to incorporate the original UCRT MSU (Windows Update)
packages (https://support.microsoft.com/en-us/help/2999226) available as
a zip archive from
https://www.microsoft.com/en-us/download/details.aspx?id=48234
- the same as used in VC redists for VS 2015 and 2017. This obsoletes
the separate installation of the redist; since we also have the redist
as merge module in our MSI, that is enough (and removes redundancy).
The MSUs are installed using wusa.exe in a custom action (deferred,
non-impersonating).

As a small bonus, embedding MSUs instead of redist EXE allows us to
shrink the size of installer a little (~10 MB).

As deferred custom actions cannot access current installer database,
we workaround this by using initial immediate impersonating action to
extract the binaries into a temporary location. To ensure that the file
gets removed upon completion (both successful and failed), we use an
additional cleanup action.

Commit 61b1d631 is effectively reverted.

Change-Id: I1529356fdcc67ff24b232c01ddf8bb3a31bb00bd
Reviewed-on: https://gerrit.libreoffice.org/52923Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst aa45e274
......@@ -672,6 +672,7 @@ endif
$(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooobinarytable, \
$(if $(WINDOWS_SDK_HOME),\
instooofiltmsi \
inst_msu_msi \
qslnkmsi \
reg4allmsdoc \
sdqsmsi \
......
......@@ -4165,8 +4165,8 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo,\
))
endif
$(eval $(call gb_Helper_register_packages_for_install,vcredist_exe_binarytable,\
$(if $(VCREDIST_DIR),vcredist_exe) \
$(eval $(call gb_Helper_register_packages_for_install,ucrt_binarytable,\
$(if $(UCRT_REDISTDIR),ucrt) \
))
# vim: set noet sw=4 ts=4:
......@@ -591,8 +591,7 @@ export TMPDIR=@TEMP_DIRECTORY@
export TOUCH=@TOUCH@
export UCRTSDKDIR=@UCRTSDKDIR@
export UCRTVERSION=@UCRTVERSION@
export VCREDIST_DIR=@VCREDIST_DIR@
export VCREDIST_EXE=@VCREDIST_EXE@
export UCRT_REDISTDIR=@UCRT_REDISTDIR@
export UNOWINREG_DLL=@UNOWINREG_DLL@
export USE_LIBRARY_BIN_TAR=@USE_LIBRARY_BIN_TAR@
export USE_XINERAMA=@USE_XINERAMA@
......
......@@ -6640,13 +6640,21 @@ fi
AC_SUBST([JITC_PROCESSOR_TYPE])
# Misc Windows Stuff
AC_ARG_WITH(vcredist-dir,
AS_HELP_STRING([--with-vcredist-dir],
[path to the directory with the arch-specific executables (vc_redist.x64.exe, vc_redist.x86.exe)
for packaging into the installsets (without those the target system needs to install
the Visual C++ Runtimes manually)]),
AC_ARG_WITH(ucrt-dir,
AS_HELP_STRING([--with-ucrt-dir],
[path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
(MS KB 2999226) for packaging into the installsets (without those the target system needs to install
the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
Windows6.1-KB2999226-x64.msu
Windows6.1-KB2999226-x86.msu
Windows8.1-KB2999226-x64.msu
Windows8.1-KB2999226-x86.msu
Windows8-RT-KB2999226-x64.msu
Windows8-RT-KB2999226-x86.msu
A zip archive including those files is available from Microsoft site:
https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
,)
VCREDIST_DIR="$with_vcredist_dir"
UCRT_REDISTDIR="$with_ucrt_dir"
if test $_os = "WINNT"; then
find_msvc_x64_dlls
find_msms
......@@ -6659,20 +6667,23 @@ if test $_os = "WINNT"; then
else
SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
fi
if test "$VCREDIST_DIR" = "no"; then
if test "$UCRT_REDISTDIR" = "no"; then
dnl explicitly disabled
VCREDIST_DIR=""
else
if test -f "$VCREDIST_DIR/vc_redist.$WINDOWS_SDK_ARCH.exe"; then
VCREDIST_EXE="vc_redist.$WINDOWS_SDK_ARCH.exe"
else
VCREDIST_DIR=""
UCRT_REDISTDIR=""
else
if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
-f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
-f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
-f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
-f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
-f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
UCRT_REDISTDIR=""
if test -n "$PKGFORMAT"; then
for i in $PKGFORMAT; do
case "$i" in
msi)
AC_MSG_WARN([--without-vcredist-dir not specified or exe not found - installer will have runtime dependency])
add_warning "--without-vcredist-dir not specified or exe not found - installer will have runtime dependency"
AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
;;
esac
done
......@@ -6681,8 +6692,7 @@ if test $_os = "WINNT"; then
fi
fi
AC_SUBST(VCREDIST_DIR)
AC_SUBST(VCREDIST_EXE)
AC_SUBST(UCRT_REDISTDIR)
AC_SUBST(MSVC_DLL_PATH)
AC_SUBST(MSVC_DLLS)
AC_SUBST(MSM_PATH)
......
......@@ -17,11 +17,11 @@ $(eval $(call gb_Module_add_targets,msc-externals,\
endif
# Install the universal crts and VC runtimes (tdf#108580)
ifneq ($(VCREDIST_DIR),)
# Install the universal crts (tdf#108580)
ifneq ($(UCRT_REDISTDIR),)
$(eval $(call gb_Module_add_targets,msc-externals,\
Package_vcredist_exe \
Package_ucrt \
))
endif
......
......@@ -7,10 +7,15 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Package_Package,vcredist_exe,$(VCREDIST_DIR)))
$(eval $(call gb_Package_Package,ucrt,$(UCRT_REDISTDIR)))
$(eval $(call gb_Package_add_files,vcredist_exe,$(LIBO_ETC_FOLDER),\
$(VCREDIST_EXE) \
$(eval $(call gb_Package_add_files,ucrt,$(LIBO_ETC_FOLDER),\
Windows6.1-KB2999226-x64.msu \
Windows6.1-KB2999226-x86.msu \
Windows8.1-KB2999226-x64.msu \
Windows8.1-KB2999226-x86.msu \
Windows8-RT-KB2999226-x64.msu \
Windows8-RT-KB2999226-x86.msu \
))
# vim:set shiftwidth=4 tabstop=4 noexpandtab:
......@@ -43,7 +43,7 @@ ProgressType3 installs
Quickstarterlinkname QUICKSTARTERLINKNAMETEMPLATE
RebootYesNo Yes
ReinstallModeText omus
SecureCustomProperties NEWPRODUCTS;OLDPRODUCTS;VCRUNTIME_DETECTED
SecureCustomProperties NEWPRODUCTS;OLDPRODUCTS
SetupType Typical
SELECT_WORD 0
SELECT_EXCEL 0
......
......@@ -8,5 +8,9 @@ policy.1.0.cli_oootypes.dll
policy.1.0.cli_ure.dll
policy.1.0.cli_cppuhelper.dll
policy.1.0.cli_basetypes.dll
vc_redist.x64.exe
vc_redist.x86.exe
Windows6.1-KB2999226-x64.msu
Windows6.1-KB2999226-x86.msu
Windows8.1-KB2999226-x64.msu
Windows8.1-KB2999226-x86.msu
Windows8-RT-KB2999226-x64.msu
Windows8-RT-KB2999226-x86.msu
......@@ -17,17 +17,12 @@ $(eval $(call gb_InstallModule_add_defs,scp2/windows,\
$(if $(WINDOWS_SDK_HOME),\
-DHAVE_WINDOWS_SDK \
) \
$(if $(MSM_PATH),\
-DMSM_PATH \
) \
$(if $(VCREDIST_DIR),\
-DVCREDIST_EXE_NAME="$(VCREDIST_EXE)" \
) \
))
$(eval $(call gb_InstallModule_add_scpfiles,scp2/windows,\
scp2/source/ooo/folder_ooo \
scp2/source/ooo/vc_redist \
$(if $(MSM_PATH),scp2/source/ooo/vc_redist) \
$(if $(UCRT_REDISTDIR),scp2/source/ooo/ucrt) \
scp2/source/ooo/windowscustomaction_ooo \
))
......
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "macros.inc"
File gid_File_Windows6_1_KB2999226_x64_msu
Name = "Windows6.1-KB2999226-x64.msu";
Dir = gid_Brand_Dir_Program;
Styles = (PACKED, BINARYTABLE, BINARYTABLE_ONLY);
End
File gid_File_Windows8_RT_KB2999226_x64_msu
Name = "Windows8-RT-KB2999226-x64.msu";
Dir = gid_Brand_Dir_Program;
Styles = (PACKED, BINARYTABLE, BINARYTABLE_ONLY);
End
File gid_File_Windows8_1_KB2999226_x64_msu
Name = "Windows8.1-KB2999226-x64.msu";
Dir = gid_Brand_Dir_Program;
Styles = (PACKED, BINARYTABLE, BINARYTABLE_ONLY);
End
#ifndef WINDOWS_X64
File gid_File_Windows6_1_KB2999226_x86_msu
Name = "Windows6.1-KB2999226-x86.msu";
Dir = gid_Brand_Dir_Program;
Styles = (PACKED, BINARYTABLE, BINARYTABLE_ONLY);
End
File gid_File_Windows8_RT_KB2999226_x86_msu
Name = "Windows8-RT-KB2999226-x86.msu";
Dir = gid_Brand_Dir_Program;
Styles = (PACKED, BINARYTABLE, BINARYTABLE_ONLY);
End
File gid_File_Windows8_1_KB2999226_x86_msu
Name = "Windows8.1-KB2999226-x86.msu";
Dir = gid_Brand_Dir_Program;
Styles = (PACKED, BINARYTABLE, BINARYTABLE_ONLY);
End
#endif /* WINDOWS_X64 */
/* A deferred not-impersonated action that will call wusa.exe to actually install
msu. Since deferred actions don't have access to current DB, the action depends
on immediate-executed action inst_ucrt (see below) that precedes it, unpacks
the binary to a temp file, and sets this action's CustomActionData property.
*/
WindowsCustomAction gid_Customaction_inst_msu
Name = "inst_msu";
Typ = "3073";
Source = "inst_msu_msi.dll";
Target = "InstallMSU";
Inbinarytable = 1;
Assignment1 = ("InstallExecuteSequence", "Not Installed And inst_msu", "InstallFiles");
End
/* An immediately-executed action that will unpack a binary, which name in binary table is set
in "InstMSUBinary" property, to a temporary file, and sets "inst_msu" and "cleanup_msu" props.
*/
WindowsCustomAction gid_Customaction_unpack_msu
Name = "unpack_msu";
Typ = "1";
Source = "inst_msu_msi.dll";
Target = "UnpackMSUForInstall";
Inbinarytable = 1;
Assignment1 = ("InstallExecuteSequence", "Not Installed And InstMSUBinary", "cleanup_msu");
End
/* A rollback action that removes temp file. It must precede inst_msu.
*/
WindowsCustomAction gid_Customaction_cleanup_msu
Name = "cleanup_msu";
Typ = "1345";
Source = "inst_msu_msi.dll";
Target = "CleanupMSU";
Inbinarytable = 1;
Assignment1 = ("InstallExecuteSequence", "Not Installed And cleanup_msu", "inst_msu");
End
WindowsCustomAction gid_Customaction_check_win7x64_ucrt
Name = "check_win7x64_ucrt";
Typ = "51";
Source = "InstMSUBinary";
Target = "Windows61-KB2999226-x64msu";
Inbinarytable = 0;
Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 601 And VersionNT64 And Not UCRT_DETECTED", "FileCost");
Styles = "NO_FILE";
End
WindowsCustomAction gid_Customaction_check_win8x64_ucrt
Name = "check_win8x64_ucrt";
Typ = "51";
Source = "InstMSUBinary";
Target = "Windows8-RT-KB2999226-x64msu";
Inbinarytable = 0;
Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 602 And VersionNT64 And Not UCRT_DETECTED", "check_win7x64_ucrt");
Styles = "NO_FILE";
End
WindowsCustomAction gid_Customaction_check_win81x64_ucrt
Name = "check_win81x64_ucrt";
Typ = "51";
Source = "InstMSUBinary";
Target = "Windows81-KB2999226-x64msu";
Inbinarytable = 0;
Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 603 And VersionNT64 And Not UCRT_DETECTED", "check_win8x64_ucrt");
Styles = "NO_FILE";
End
#ifndef WINDOWS_X64
/* 32-bit installer must be prepared to run on both 32- and 64-bit Windows. So, it might need to
install either 32-bit or 64-bit UCRT package, depending on OS bitness.
*/
WindowsCustomAction gid_Customaction_check_win7x32_ucrt
Name = "check_win7x32_ucrt";
Typ = "51";
Source = "InstMSUBinary";
Target = "Windows61-KB2999226-x86msu";
Inbinarytable = 0;
Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 601 And Not VersionNT64 And Not UCRT_DETECTED", "check_win81x64_ucrt");
Styles = "NO_FILE";
End
WindowsCustomAction gid_Customaction_check_win8x32_ucrt
Name = "check_win8x32_ucrt";
Typ = "51";
Source = "InstMSUBinary";
Target = "Windows8-RT-KB2999226-x86msu";
Inbinarytable = 0;
Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 602 And Not VersionNT64 And Not UCRT_DETECTED", "check_win7x32_ucrt");
Styles = "NO_FILE";
End
WindowsCustomAction gid_Customaction_check_win81x32_ucrt
Name = "check_win81x32_ucrt";
Typ = "51";
Source = "InstMSUBinary";
Target = "Windows81-KB2999226-x86msu";
Inbinarytable = 0;
Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 603 And Not VersionNT64 And Not UCRT_DETECTED", "check_win8x32_ucrt");
Styles = "NO_FILE";
End
#endif /* WINDOWS_X64 */
......@@ -18,8 +18,6 @@
#include "macros.inc"
#if defined(MSM_PATH)
#if defined(WITH_VC140_REDIST)
#if defined WINDOWS_X64
......@@ -76,24 +74,3 @@ MergeModule gid_MergeModule_Microsoft_VC141_CRT_x86
End
#endif
#endif // MSM_PATH
#if defined(VCREDIST_EXE_NAME)
File gid_File_Vcredist_Exe
Name = VCREDIST_EXE_NAME;
Dir = gid_Brand_Dir_Program;
Styles = (PACKED, BINARYTABLE, BINARYTABLE_ONLY);
End
WindowsCustomAction gid_Customaction_InstallVCRedist
Name = "InstallVCRedist";
Typ = "66"; /* 0x02 = exe in a binary table stream; 0x40 = ignore exit code and continue */
Source = VCREDIST_EXE_NAME;
Target = "/repair /norestart /passive";
Inbinarytable = 1;
Assignment1 = ("InstallUISequence", "Not Installed And Not ( VCRUNTIME_DETECTED And UCRT_DETECTED ) And VC_REDIST = 1", "behind_ExecuteAction");
End
#endif
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Library_Library,inst_msu_msi))
$(eval $(call gb_Library_add_defs,inst_msu_msi,\
-U_DLL \
))
$(eval $(call gb_Library_add_cxxflags,inst_msu_msi,\
$(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \
))
$(eval $(call gb_Library_add_ldflags,inst_msu_msi,\
/DEF:$(SRCDIR)/setup_native/source/win32/customactions/inst_msu/inst_msu_msi.def \
/NODEFAULTLIB \
))
$(eval $(call gb_Library_add_exception_objects,inst_msu_msi,\
setup_native/source/win32/customactions/inst_msu/inst_msu \
))
$(eval $(call gb_Library_use_system_win32_libs,inst_msu_msi,\
libcmt \
libcpmt \
libucrt \
libvcruntime \
kernel32 \
Ole32 \
Shell32 \
Msi \
))
# vim: set noet sw=4 ts=4:
......@@ -23,6 +23,7 @@ $(eval $(call gb_Module_add_targets,setup_native,\
ifeq ($(OS),WNT)
$(eval $(call gb_Module_add_targets,setup_native,\
Library_instooofiltmsi \
Library_inst_msu_msi \
Library_qslnkmsi \
Library_reg4allmsdoc \
Library_regactivex \
......
LIBRARY "inst_msu_msi.dll"
EXPORTS
UnpackMSUForInstall
InstallMSU
CleanupMSU
\ No newline at end of file
......@@ -1084,9 +1084,8 @@ sub add_custom_action_to_install_table
my $actionposition = 0;
if ( $position eq "end" ) { $actionposition = get_last_position_in_sequencetable($installtable) + 25; }
elsif ( $position =~ /^\s*behind_/ ) { $actionposition = get_position_in_sequencetable($position, $installtable) + 2; }
else { $actionposition = get_position_in_sequencetable($position, $installtable) - 2; }
if ( $position =~ /^\s*\d+\s*$/ ) { $actionposition = $position; } # setting the position directly, number defined in scp2
else { $actionposition = "POSITIONTEMPLATE_" . $position; }
my $line = $actionname . "\t" . $actioncondition . "\t" . $actionposition . "\n";
push(@{$installtable}, $line);
......@@ -1129,12 +1128,6 @@ sub add_custom_action_to_install_table
$actioncondition =~ s/FEATURETEMPLATE/$feature/g; # only execute Custom Action, if feature of the file is installed
# my $actionposition = 0;
# if ( $position eq "end" ) { $actionposition = get_last_position_in_sequencetable($installtable) + 25; }
# elsif ( $position =~ /^\s*behind_/ ) { $actionposition = get_position_in_sequencetable($position, $installtable) + 2; }
# else { $actionposition = get_position_in_sequencetable($position, $installtable) - 2; }
# my $line = $actionname . "\t" . $actioncondition . "\t" . $actionposition . "\n";
my $positiontemplate = "";
if ( $position =~ /^\s*\d+\s*$/ ) { $positiontemplate = $position; } # setting the position directly, number defined in scp2
else { $positiontemplate = "POSITIONTEMPLATE_" . $position; }
......
......@@ -45,18 +45,6 @@ sub create_upgrade_table
$newline = $installer::globals::upgradecode . "\t" . $installer::globals::msiproductversion . "\t" . "\t" . "\t" . "2" . "\t" . "\t" . "NEWPRODUCTS" . "\n";
push(@upgradetable, $newline);
# Detecting if VC Runtime is installed on system
$newline = "VCRUNTIME_UPGRADE_CODE" . "\t" . "14.0.24215" . "\t" . "15.0.0" . "\t" . "" . "\t" . "258" . "\t" . "" . "\t" . "VCRUNTIME_DETECTED" . "\n";
if ( $installer::globals::cpuname eq 'X86_64' )
{
$newline =~ s/VCRUNTIME_UPGRADE_CODE/{36F68A90-239C-34DF-B58C-64B30153CE35}/;
}
else
{
$newline =~ s/VCRUNTIME_UPGRADE_CODE/{65E5BD06-6392-3027-8C26-853107D3CF1A}/;
}
push(@upgradetable, $newline);
# Saving the file
my $upgradetablename = $basedir . $installer::globals::separator . "Upgrade.idt";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment