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
This commit is contained in:
William Li 2017-04-26 12:12:25 -07:00 committed by William Lee
parent 9f8ab82a6c
commit c9295d1df7
3 changed files with 36 additions and 11 deletions

View file

@ -10,7 +10,7 @@
TestDebuild;
BuildSdkDeb;
TestSdkDeb;"
Condition=" '$(OSName)' == 'ubuntu' "
Condition=" '$(OSName)' == 'ubuntu' "
Outputs="@(GeneratedInstallers)"/>
<Target Name="BuildSdkDeb"
@ -28,11 +28,11 @@
<!-- Create layout: Binaries -->
<Copy
DestinationFiles="@(CLISdkFiles->'$(LayoutPackageRootDir)/sdk/%(RecursiveDir)%(Filename)%(Extension)')"
SourceFiles="@(CLISdkFiles)"
SourceFiles="@(CLISdkFiles)"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<!-- Create layout: Man Pages -->
<Copy
DestinationFiles="@(SdkDebManPageFiles->'$(LayoutDocsDir)/%(RecursiveDir)%(Filename)-$(SdkVersion)%(Extension)')"
@ -41,13 +41,21 @@
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<!-- Create layout: postinst -->
<Copy
DestinationFiles= "$(DebianPostinstFile)"
SourceFiles="$(DebianPostinstTemplateFile)"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<!-- Create layout: Generate and Place debian_config.json -->
<ReplaceFileContents
InputFile="$(DebianConfigTemplateFile)"
DestinationFile="$(DebianConfigJsonFile)"
ReplacementItems="@(DebianConfigTokenValues)" />
<Chmod
<Chmod
Glob="$(PackageTool)"
Mode="u+x" />
@ -58,12 +66,12 @@
PackageName="$(SdkDebianPackageName)"
PackageVersion="$(SdkVersion)"
WorkingDirectory="$(DotnetDebToolDir)" />
<!-- Copy SDK package to output -->
<ItemGroup>
<GeneratedDebFiles Include="$(DotNetDebToolOutputDirectory)/*.deb" />
</ItemGroup>
<Error Text="@(GeneratedDebFiles->Count()) .deb files generated." Condition="'@(GeneratedDebFiles->Count())' != 1" />
<Copy
@ -97,9 +105,9 @@
<Exec Command="sudo dpkg -i $(SdkInstallerFile)" />
<!-- Run E2E -->
<DotNetRestore ProjectPath="$(EndToEndTestProject)"
ToolPath="$(DebianInstalledDirectory)" />
<DotNetRestore ProjectPath="$(EndToEndTestProject)"
ToolPath="$(DebianInstalledDirectory)" />
<DotNetTest ProjectPath="$(EndToEndTestProject)"
EnvironmentVariables="@(TestSdkDebTaskEnvironmentVariables)"
ToolPath="$(DebianInstalledDirectory)" />
@ -158,11 +166,11 @@
<Target Name="TestDebuild">
<Message Text="Don't remove this" />
<!-- run Debuild -->
<Exec Command="/usr/bin/env debuild -h" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="DebuildExitCode" />
</Exec>
</Exec>
<!-- Check if it returned 0 -->
<PropertyGroup>

View file

@ -75,6 +75,11 @@
<DebianConfigJsonFile>$(LayoutDirectory)/debian_config.json</DebianConfigJsonFile>
</PropertyGroup>
<PropertyGroup>
<DebianPostinstTemplateFile>$(RepoRoot)/packaging/deb/postinst</DebianPostinstTemplateFile>
<DebianPostinstFile>$(LayoutDirectory)/debian/postinst</DebianPostinstFile>
</PropertyGroup>
<ItemGroup>
<DebianConfigTokenValues Include="%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%">
<ReplacementString>$(SharedFxDebianPackageName)</ReplacementString>

12
packaging/deb/postinst Normal file → Executable file
View file

@ -1,3 +1,15 @@
#!/usr/bin/env sh
echo "This software may collect information about you and your use of the software, and send that to Microsoft."
echo "Please visit http://aka.ms/dotnet-cli-eula for more information."
# Run 'dotnet new' to trigger the first time experience to initialize the cache
echo "Welcome to .NET Core!
---------------------
Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.
Telemetry
--------------
The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community.
You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.
You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry."
dotnet new > /dev/null 2>&1 || true