Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit 9e04dcf

Browse files
committed
Updating the native installers to use a fully qualified path to dotnet.dll and execute it with dotnet exec, so that the first run experience to populate the offline cache will trigger for the SDK being installed, instead of for the latest one in the box.
1 parent 9cf4944 commit 9e04dcf

File tree

9 files changed

+52
-13
lines changed

9 files changed

+52
-13
lines changed

build/package/Installer.DEB.proj

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@
4343
SkipUnchangedFiles="False"
4444
UseHardlinksIfPossible="False" />
4545

46-
<!-- Create layout: postinst -->
47-
<Copy
48-
DestinationFiles= "$(DebianPostinstFile)"
49-
SourceFiles="$(DebianPostinstTemplateFile)"
50-
OverwriteReadOnlyFiles="True"
51-
SkipUnchangedFiles="False"
52-
UseHardlinksIfPossible="False" />
46+
<!-- Create layout: Generate and Place postinst -->
47+
<ReplaceFileContents
48+
InputFile="$(DebianPostinstTemplateFile)"
49+
DestinationFile="$(DebianPostinstFile)"
50+
ReplacementItems="@(DebianPostInstTokenValues)" />
51+
52+
<Chmod
53+
Glob="$(DebianPostinstFile)"
54+
Mode="ugo+x" />
5355

5456
<!-- Create layout: Generate and Place debian_config.json -->
5557
<ReplaceFileContents

build/package/Installer.DEB.targets

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@
105105
<DebianConfigTokenValues Include="%CLI_SDK_BRAND_NAME%">
106106
<ReplacementString>$(SdkBrandName)</ReplacementString>
107107
</DebianConfigTokenValues>
108+
109+
<DebianPostInstTokenValues Include="%SDK_VERSION%">
110+
<ReplacementString>$(SdkVersion)</ReplacementString>
111+
</DebianPostInstTokenValues>
108112
</ItemGroup>
109113

110114
<ItemGroup>

build/package/Installer.PKG.targets

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
<SdkPkgSourcesRootDirectory>$(RepoRoot)/packaging/osx/clisdk</SdkPkgSourcesRootDirectory>
1616
<SdkPkgScriptsDirectory>$(SdkPkgSourcesRootDirectory)/scripts</SdkPkgScriptsDirectory>
17+
<SdkPkgScriptTemplateFile>$(SdkPkgScriptsDirectory)/postinstall</SdkPkgScriptTemplateFile>
18+
<SdkPkgDestinationScriptsDirectory>$(PkgIntermediateDirectory)/scripts</SdkPkgDestinationScriptsDirectory>
19+
<SdkPkgScriptFile>$(SdkPkgDestinationScriptsDirectory)/postinstall</SdkPkgScriptFile>
1720
<SdkProductArchiveResourcesDirectory>$(SdkPkgSourcesRootDirectory)/resources</SdkProductArchiveResourcesDirectory>
1821

1922
<SdkProductArchiveDistributionTemplateFile>$(SdkPkgSourcesRootDirectory)/Distribution-Template</SdkProductArchiveDistributionTemplateFile>
@@ -54,6 +57,10 @@
5457
<DistributionTemplateReplacement Include="{HostFxrBrandName}">
5558
<ReplacementString>$(HostFxrBrandName)</ReplacementString>
5659
</DistributionTemplateReplacement>
60+
61+
<PostInstallScriptReplacement Include="%SDK_VERSION%">
62+
<ReplacementString>$(SdkVersion)</ReplacementString>
63+
</PostInstallScriptReplacement>
5764
</ItemGroup>
5865

5966
<!-- Consumed By Publish -->
@@ -83,12 +90,22 @@
8390
<Copy SourceFiles="@(AspNetRuntimeFilesInput)"
8491
DestinationFiles="@(AspNetRuntimeFilesInput->'$(SdkLayoutOutputDirectory)/%(RecursiveDir)%(FileName)%(Extension)')" />
8592

93+
<ReplaceFileContents
94+
InputFile="$(SdkPkgScriptTemplateFile)"
95+
DestinationFile="$(SdkPkgScriptFile)"
96+
ReplacementPatterns="@(PostInstallScriptReplacement -> '%(Identity)')"
97+
ReplacementStrings="@(PostInstallScriptReplacement -> '%(ReplacementString)')" />
98+
99+
<Chmod
100+
Glob="$(SdkPkgScriptFile)"
101+
Mode="ugo+x" />
102+
86103
<Exec Command="pkgbuild
87104
--root '$(SdkLayoutOutputDirectory)'
88105
--identifier '$(SdkComponentId)'
89106
--version '$(SdkVersion)'
90107
--install-location '$(PkgInstallDirectory)'
91-
--scripts '$(SdkPkgScriptsDirectory)'
108+
--scripts '$(SdkPkgDestinationScriptsDirectory)'
92109
'$(SdkInstallerFile)'" />
93110
</Target>
94111

build/package/Installer.RPM.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
<RpmConfigJsonName>rpm_config.json</RpmConfigJsonName>
55
<TemplatesDir>$(RepoRoot)/packaging/rpm/templates</TemplatesDir>
66
<ScriptsDir>$(RepoRoot)/packaging/rpm/scripts</ScriptsDir>
7+
<AfterInstallHostScriptName>after_install_host.sh</AfterInstallHostScriptName>
78
</PropertyGroup>
89
</Project>

build/package/Installer.RPM.targets

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
<AspNetCoreRuntimePackageName>$(AspNetCoreRuntimePackageBrandName)-$(AspNetCoreVersionAndRelease)-$(AspNetCoreRuntimePackageTimestamp)</AspNetCoreRuntimePackageName>
5656
<AspNetCoreRuntimePackageVersion>$(AspNetCoreVersion)-$(AspNetCoreRelease)-$(AspNetCoreRuntimePackageTimestamp)</AspNetCoreRuntimePackageVersion>
5757
<AspNetCoreRuntimeRpmInstallerFileName>$(AspNetCoreRuntimePackageBrandName)-$(AspNetCoreVersionAndRelease)-$(AspNetCoreRuntimePackageTimestamp)-$(HostRidInAspNetCoreRuntimeRpmInstallerFileName).rpm</AspNetCoreRuntimeRpmInstallerFileName>
58+
<AfterInstallHostScriptTemplateFile>$(ScriptsDir)/$(AfterInstallHostScriptName)</AfterInstallHostScriptTemplateFile>
59+
<AfterInstallHostScriptDestinationFile>$(RpmLayoutScripts)$(AfterInstallHostScriptName)</AfterInstallHostScriptDestinationFile>
5860
</PropertyGroup>
5961

6062
<PropertyGroup>
@@ -78,7 +80,7 @@
7880
<SDKFiles Include="$(InputRoot)/**/*"/>
7981
<SDKManpages Include="$(ManPagesDir)/**/*"/>
8082
<SDKTemplatesFiles Include="$(TemplatesDir)/**/*"/>
81-
<SDKScriptsFiles Include="$(ScriptsDir)/**/*"/>
83+
<SDKScriptsFiles Include="$(ScriptsDir)/after_remove_host.sh"/>
8284
</ItemGroup>
8385

8486
<Copy SourceFiles="@(SDKFiles)"
@@ -128,13 +130,25 @@
128130
<SDKTokenValue Include="%SDK_RPM_PACKAGE_NAME%">
129131
<ReplacementString>$(SdkRpmPackageName)</ReplacementString>
130132
</SDKTokenValue>
133+
134+
<AfterInstallHostTokenValue Include="%SDK_VERSION%">
135+
<ReplacementString>$(SdkVersion)</ReplacementString>
136+
</AfterInstallHostTokenValue>
131137
</ItemGroup>
132138

133139
<ItemGroup>
134140
<TestSdkRpmTaskEnvironmentVariables Include="PATH=$(RpmInstalledDirectory)$(PathListSeparator)$(PATH)" />
135141
<GeneratedInstallers Include="$(SdkInstallerFile)" />
136142
</ItemGroup>
137143

144+
<ReplaceFileContents InputFile="$(AfterInstallHostScriptTemplateFile)"
145+
DestinationFile="$(AfterInstallHostScriptDestinationFile)"
146+
ReplacementItems="@(AfterInstallHostTokenValue)"/>
147+
148+
<Chmod
149+
Glob="$(AfterInstallHostScriptDestinationFile)"
150+
Mode="ugo+x" />
151+
138152
<ReplaceFileContents InputFile="$(ConfigJsonFile)"
139153
DestinationFile="$(RpmLayoutDirectory)$(RpmConfigJsonName)"
140154
ReplacementItems="@(SDKTokenValue)"/>

packaging/deb/postinst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ Installation Note
1919
--------------
2020
A command will be run during the install process that will improve project restore speed and enable offline access. It will take up to a minute to complete."
2121

22-
dotnet internal-reportinstallsuccess "debianpackage" > /dev/null 2>&1 || true
22+
/usr/share/dotnet/dotnet exec /usr/share/dotnet/sdk/%SDK_VERSION%/dotnet.dll internal-reportinstallsuccess "debianpackage" > /dev/null 2>&1 || true

packaging/osx/clisdk/scripts/postinstall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ INSTALL_DESTINATION=$2
1111
# A temporary fix for the permissions issue(s)
1212
chmod -R 755 $INSTALL_DESTINATION
1313

14-
$INSTALL_DESTINATION/dotnet internal-reportinstallsuccess "$1" > /dev/null 2>&1 || true
14+
$INSTALL_DESTINATION/dotnet exec $INSTALL_DESTINATION/sdk/%SDK_VERSION%/dotnet.dll internal-reportinstallsuccess "$1" > /dev/null 2>&1 || true
1515

1616
exit 0

packaging/rpm/scripts/after_install_host.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ Installation Note
2323
--------------
2424
A command will be run during the install process that will improve project restore speed and enable offline access. It will take up to a minute to complete."
2525

26-
dotnet internal-reportinstallsuccess "rpmpackage" > /dev/null 2>&1 || true
26+
/usr/share/dotnet/dotnet exec /usr/share/dotnet/sdk/%SDK_VERSION%/dotnet.dll internal-reportinstallsuccess "rpmpackage" > /dev/null 2>&1 || true

packaging/windows/clisdk/dotnet.wxs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<Property Id="ProductCPU" Value="$(var.Platform)" />
2121
<Property Id="RTM_ProductVersion" Value="$(var.Dotnet_ProductVersion)" />
2222
<Property Id="MSIFASTINSTALL" Value="7" />
23+
<Property Id="NUGETVERSION" Value="$(var.NugetVersion)" />
2324
<WixVariable Id="WixUILicenseRtf" Value="$(var.MicrosoftEula)" />
2425

2526
<Property Id="DOTNETEXE">
@@ -32,7 +33,7 @@
3233

3334
<CustomAction Id="PropertyAssignPrimeCacheAndTelemetry"
3435
Property="QtExecPrimeCacheAndTelemetryTarget"
35-
Value="&quot;[DOTNETHOME]\dotnet.exe&quot; internal-reportinstallsuccess &quot;[EXEFULLPATH]&quot;"
36+
Value="&quot;[DOTNETHOME]\dotnet.exe&quot; exec &quot;[DOTNETHOME]\sdk\[NUGETVERSION]\dotnet.dll&quot; internal-reportinstallsuccess &quot;[EXEFULLPATH]&quot;"
3637
Execute="immediate" />
3738
<CustomAction Id="QtExecPrimeCacheAndTelemetryTarget"
3839
BinaryKey="WixCA"

0 commit comments

Comments
 (0)