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

Commit 81d5bb2

Browse files
author
William Li
committed
Run dotnet new after install to prime cache for deb
Copy postinst to correct directory Can only rely on env for get dotnet command Print telemetry notice anyway
1 parent 320613d commit 81d5bb2

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed

build/package/Installer.DEB.proj

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
TestDebuild;
1111
BuildSdkDeb;
1212
TestSdkDeb;"
13-
Condition=" '$(OSName)' == 'ubuntu' "
13+
Condition=" '$(OSName)' == 'ubuntu' "
1414
Outputs="@(GeneratedInstallers)"/>
1515

1616
<Target Name="BuildSdkDeb"
@@ -28,11 +28,11 @@
2828
<!-- Create layout: Binaries -->
2929
<Copy
3030
DestinationFiles="@(CLISdkFiles->'$(LayoutPackageRootDir)/sdk/%(RecursiveDir)%(Filename)%(Extension)')"
31-
SourceFiles="@(CLISdkFiles)"
31+
SourceFiles="@(CLISdkFiles)"
3232
OverwriteReadOnlyFiles="True"
3333
SkipUnchangedFiles="False"
3434
UseHardlinksIfPossible="False" />
35-
35+
3636
<!-- Create layout: Man Pages -->
3737
<Copy
3838
DestinationFiles="@(SdkDebManPageFiles->'$(LayoutDocsDir)/%(RecursiveDir)%(Filename)-$(SdkVersion)%(Extension)')"
@@ -41,13 +41,21 @@
4141
SkipUnchangedFiles="False"
4242
UseHardlinksIfPossible="False" />
4343

44+
<!-- Create layout: postinst<-->
45+
<Copy
46+
DestinationFiles= "$(DebianPostinstFile"
47+
SourceFiles="$(DebianPostinstTemplateFile)"
48+
OverwriteReadOnlyFiles="True"
49+
SkipUnchangedFiles="False"
50+
UseHardlinksIfPossible="False" />
51+
4452
<!-- Create layout: Generate and Place debian_config.json -->
4553
<ReplaceFileContents
4654
InputFile="$(DebianConfigTemplateFile)"
4755
DestinationFile="$(DebianConfigJsonFile)"
4856
ReplacementItems="@(DebianConfigTokenValues)" />
4957

50-
<Chmod
58+
<Chmod
5159
Glob="$(PackageTool)"
5260
Mode="u+x" />
5361

@@ -58,12 +66,12 @@
5866
PackageName="$(SdkDebianPackageName)"
5967
PackageVersion="$(SdkVersion)"
6068
WorkingDirectory="$(DotnetDebToolDir)" />
61-
69+
6270
<!-- Copy SDK package to output -->
6371
<ItemGroup>
6472
<GeneratedDebFiles Include="$(DotNetDebToolOutputDirectory)/*.deb" />
6573
</ItemGroup>
66-
74+
6775
<Error Text="@(GeneratedDebFiles->Count()) .deb files generated." Condition="'@(GeneratedDebFiles->Count())' != 1" />
6876

6977
<Copy
@@ -97,9 +105,9 @@
97105
<Exec Command="sudo dpkg -i $(SdkInstallerFile)" />
98106

99107
<!-- Run E2E -->
100-
<DotNetRestore ProjectPath="$(EndToEndTestProject)"
101-
ToolPath="$(DebianInstalledDirectory)" />
102-
108+
<DotNetRestore ProjectPath="$(EndToEndTestProject)"
109+
ToolPath="$(DebianInstalledDirectory)" />
110+
103111
<DotNetTest ProjectPath="$(EndToEndTestProject)"
104112
EnvironmentVariables="@(TestSdkDebTaskEnvironmentVariables)"
105113
ToolPath="$(DebianInstalledDirectory)" />
@@ -158,11 +166,11 @@
158166

159167
<Target Name="TestDebuild">
160168
<Message Text="Don't remove this" />
161-
169+
162170
<!-- run Debuild -->
163171
<Exec Command="/usr/bin/env debuild -h" ContinueOnError="true">
164172
<Output TaskParameter="ExitCode" PropertyName="DebuildExitCode" />
165-
</Exec>
173+
</Exec>
166174

167175
<!-- Check if it returned 0 -->
168176
<PropertyGroup>

build/package/Installer.DEB.targets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
<DebianConfigJsonFile>$(LayoutDirectory)/debian_config.json</DebianConfigJsonFile>
7676
</PropertyGroup>
7777

78+
<PropertyGroup>
79+
<DebianPostinstTemplateFile>$(RepoRoot)/packaging/deb/postinst</DebianPostinstTemplateFile>
80+
<DebianPostinstFile>$(LayoutDirectory)/debian/postinst</DebianPostinstFile>
81+
</PropertyGroup>
82+
7883
<ItemGroup>
7984
<DebianConfigTokenValues Include="%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%">
8085
<ReplacementString>$(SharedFxDebianPackageName)</ReplacementString>

packaging/deb/postinst

100644100755
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
#!/usr/bin/env sh
22
echo "This software may collect information about you and your use of the software, and send that to Microsoft."
33
echo "Please visit http://aka.ms/dotnet-cli-eula for more information."
4+
5+
# Run 'dotnet new' to trigger the first time experience to initialize the cache
6+
echo ."NET Core Tools Telemetry
7+
8+
The .NET Core Tools include a telemetry feature that collects usage information. It’s important that the .NET Team understands how the tools are being used so that we can improve them.
9+
10+
The data collected is anonymous and will be published in an aggregated form for use by both Microsoft and community engineers under the Creative Commons Attribution License.
11+
12+
The .NET Core Tools telemetry feature is enabled by default. You can opt-out of the telemetry feature by setting an environment variable DOTNET_CLI_TELEMETRY_OPTOUT (for example, 'export' on macOS/Linux, 'set' on Windows) to true (for example, 'true', 1). You can read more about .NET Core tools telemetry at https://aka.ms/dotnet-cli-telemetry."
13+
dotnet new > /dev/null 2>&1 || true

0 commit comments

Comments
 (0)