Просмотр исходного кода

Build runtime store installers

- hosting tar.gz archives
- rpm installers for generic and red hat
- deb installers for debian.8, ubuntu 14.04, ubuntu 16.04, ubuntu 16.10

Create hosting targz archives
= 8 лет назад
Родитель
Сommit
a4e87d1dd8

+ 417 - 0
build/RuntimeStoreInstaller.targets

@@ -0,0 +1,417 @@
+<Project>
+  <PropertyGroup>
+    <_TemplatesDirectory>$(MSBuildThisFileDirectory)tools\templates\</_TemplatesDirectory>
+    <_DockerDir>$(MSBuildThisFileDirectory)tools\docker\</_DockerDir>
+    <_PackagingDir>$(MSBuildThisFileDirectory)tools\packaging\</_PackagingDir>
+    <_DebToolDir>$(MSBuildThisFileDirectory)tools\dotnet-deb-tool-consumer\</_DebToolDir>
+    <_TimestampRSSource>$(RepositoryRoot).deps\Signed\Store\</_TimestampRSSource>
+    <_TimestampFreeRSSource>$(RepositoryRoot).deps\Signed\Store-TimestampFree\</_TimestampFreeRSSource>
+    <_CoreInstallerSource>$(RepositoryRoot).deps\CoreInstallers\</_CoreInstallerSource>
+    <_WorkRoot>$(RepositoryRoot).w\</_WorkRoot>
+    <_WorkLayoutDir>$(_WorkRoot).l\</_WorkLayoutDir>
+    <_WorkOutputDir>$(_WorkRoot).o\</_WorkOutputDir>
+    <_DockerRootDirectory>/opt/code/</_DockerRootDirectory>
+
+    <RSInstallerName>aspnetcore-store</RSInstallerName>
+    <HostingInstallerName>dotnet-hosting</HostingInstallerName>
+    <RSDebConfigFile>$(_PackagingDir)store_debian_config.json</RSDebConfigFile>
+    <HostingDebConfigFile>$(_PackagingDir)hosting_debian_config.json</HostingDebConfigFile>
+  </PropertyGroup>
+
+  <Target Name="BuildInstallers" DependsOnTargets="GenerateTargzs;GenerateRpms;GenerateDebs" />
+
+  <Target Name="_EnsureInstallerPrerequisites" DependsOnTargets="_ResolveCurrentSharedFrameworkVersion">
+    <!-- Check Docker server OS -->
+    <Exec Command="docker version -f &quot;{{.Server.Os}}&quot;" ConsoleToMSBuild="true">
+      <Output TaskParameter="ConsoleOutput" PropertyName="DockerHostOS" />
+    </Exec>
+
+    <Error Text="Docker host must be using Linux containers." Condition="'$(DockerHostOS)' != 'linux'"/>
+
+    <!-- Generate timestamp free version -->
+    <RepoTasks.GetTimestampFreeVersion
+      TimestampVersion="$(Version)">
+      <Output TaskParameter="TimestampFreeVersion" ItemName="_TimestampFreeVersion" />
+    </RepoTasks.GetTimestampFreeVersion>
+
+    <PropertyGroup>
+      <!-- Temporary override -->
+      <SharedFrameworkVersion>2.0.3-servicing-25808-01</SharedFrameworkVersion>
+      <CoreFeedPrefix Condition="'CoreFeedPrefix'==''">http://dotnetcli.azureedge.net</CoreFeedPrefix>
+      <RuntimeTargzLink>$(CoreFeedPrefix)/dotnet/Runtime/$(SharedFrameworkVersion)/dotnet-runtime-$(SharedFrameworkVersion)-linux-x64.tar.gz</RuntimeTargzLink>
+    </PropertyGroup>
+    
+    <!-- Save properties for future use -->
+    <PropertyGroup>
+      <TimestampFreeVersion>@(_TimestampFreeVersion)</TimestampFreeVersion>
+    </PropertyGroup>
+
+    <ItemGroup>
+      <_TimestampRSArchive Include="$(_TimestampRSSource)aspnetcore-store-$(Version)-linux-x64.tar.gz"/>
+      <_TimestampFreeRSArchive Include="$(_TimestampFreeRSSource)aspnetcore-store-$(TimestampFreeVersion)-linux-x64.tar.gz"/>
+    </ItemGroup>
+
+    <Error 
+      Text="@(_TimestampRSArchive->Count()) timestamp linux archives found." 
+      Condition="'@(_TimestampRSArchive->Count())' != 1 Or !Exists('@(_TimestampRSArchive)')" />
+    <Error 
+      Text="@(_TimestampFreeRSArchive->Count()) no timestamp linux archives found." 
+      Condition="'@(_TimestampFreeRSArchive->Count())' != 1 Or !Exists('@(_TimestampRSArchive)')" />
+
+    <!-- Save properties for future use -->
+    <PropertyGroup>
+      <TimestampRSArchive>@(_TimestampRSArchive)</TimestampRSArchive>
+      <TimestampFreeRSArchive>@(_TimestampFreeRSArchive)</TimestampFreeRSArchive>
+    </PropertyGroup>
+
+    <!-- Download dotnet installers -->
+    <MakeDir Directories="$(_CoreInstallerSource)" />
+    <Exec Command="curl &quot;$(RuntimeTargzLink)$(CoreFeedSuffix)&quot; -o $(_CoreInstallerSource)dotnet-runtime-$(SharedFrameworkVersion)-linux-x64.tar.gz" />
+  </Target>
+
+  <Target Name="_GenerateTargz">
+    <!-- Clear working directory -->
+    <RemoveDir Directories="$(_WorkRoot)" />
+    <MakeDir Directories="$(_WorkRoot)" />
+
+    <!-- Create layout: Aspnet Hosting Bundle -->
+    <Exec Command="tar -xzf $(RSArchive) -C $(_WorkRoot)" />
+    <Exec Command="tar -xzf $(RuntimeArchive) -C $(_WorkRoot)" />
+
+    <!-- Create Aspnet Hosting Bundle tar.gz -->
+    <Exec Command="tar -czvf $(ArtifactsDir)$(HostingArchiveName) ." WorkingDirectory="$(_WorkRoot)"/>
+  </Target>
+
+  <Target Name="GenerateTargzs" DependsOnTargets="_EnsureInstallerPrerequisites">
+    <ItemGroup>
+      <_RuntimeArchive Include="$(_CoreInstallerSource)dotnet-runtime-$(SharedFrameworkVersion)-linux-x64.tar.gz" />
+    </ItemGroup>
+
+    <PropertyGroup>
+      <RuntimeArchive>@(_RuntimeArchive)</RuntimeArchive>
+      <HostingArchiveName>$(HostingInstallerName)-$(Version)-linux-x64.tar.gz</HostingArchiveName>
+      <TimestampFreeHostingArchiveName>$(HostingInstallerName)-$(TimestampFreeVersion)-linux-x64.tar.gz</TimestampFreeHostingArchiveName>
+    </PropertyGroup>
+
+    <!-- Timestamp hosting bundle -->
+    <MSBuild
+      Projects="$(MSBuildProjectFullPath)"
+      Targets="_GenerateTargz"
+      Properties="RuntimeArchive=$(RuntimeArchive);RSArchive=$(TimestampRSArchive);HostingArchiveName=$(HostingArchiveName)" />
+    <!-- Timestamp free hosting bundle -->
+    <MSBuild
+      Projects="$(MSBuildProjectFullPath)"
+      Targets="_GenerateTargz"
+      Properties="RuntimeArchive=$(RuntimeArchive);RSArchive=$(TimestampFreeRSArchive);HostingArchiveName=$(TimestampFreeHostingArchiveName)" />
+  </Target>
+
+  <Target Name="_BuildDockerImage">
+    <Exec
+      Command="docker build --build-arg USER_ID=%24(id -u) -t docker-image-$(Image) $(Image)"
+      WorkingDirectory="$(_DockerDir)" />
+  </Target>
+
+  <Target Name="_RemoveDockerImage">
+    <Exec Command="docker rmi docker-image-$(Image)" />
+  </Target>
+
+  <Target Name="_GenerateRpm">
+    <!-- Clear working directory -->
+    <RemoveDir Directories="$(_WorkRoot)" />
+    <MakeDir Directories="$(_WorkRoot)" />
+
+    <!-- Create layout: Extract archive if given -->
+    <MakeDir Directories="$(_WorkRoot)package_root\" />
+    <Exec Command="tar -xzf $(RSArchive) -C $(_WorkRoot)package_root\" Condition="'$(RSArchive)'!=''" />
+
+    <!-- Create layout: Place changelog -->
+    <Copy
+      SourceFiles="$(_PackagingDir)changelog"
+      DestinationFiles="$(_WorkRoot)templates/changelog"
+      OverwriteReadOnlyFiles="True"
+      SkipUnchangedFiles="False"
+      UseHardlinksIfPossible="False" />
+
+    <ItemGroup>
+      <ChangelogItems Include="DATE" Replacement="$([System.DateTime]::UtcNow.ToString(ddd MMM dd yyyy))" />
+      <ChangelogItems Include="MAINTAINER_NAME" Replacement="$(MaintainerName)" />
+      <ChangelogItems Include="MAINTAINER_EMAIL" Replacement="$(MaintainerEmail)" />
+      <ChangelogItems Include="PACKAGE_VERSION" Replacement="$(RPMVersion)" />
+      <ChangelogItems Include="PACKAGE_REVISION" Replacement="$(RPMRevision)" />
+    </ItemGroup>
+
+    <!-- Update Date, Maintainer, Version, Revision and Changelog Message -->
+    <RepoTasks.ReplaceInFile Filename="$(_WorkRoot)templates/changelog" Items="@(ChangelogItems)" />
+
+    <PropertyGroup>
+      <RPMMaintainer>$(MaintainerName) &lt;$(MaintainerEmail)&gt;</RPMMaintainer>
+    </PropertyGroup>
+
+    <!-- Run RPM -->
+    <Exec Command="docker run
+      --rm
+      -v $(RepositoryRoot):$(_DockerRootDirectory)
+      docker-image-$(Image)
+      fpm
+        --verbose
+        -s dir
+        -t rpm
+        -n $(RPMInstallerPrefix)-$(RPMVersion)
+        -p $(_DockerRootDirectory)artifacts/$(RPMInstallerPrefix)-$(RPMVersion)-$(RPMFileSuffix)
+        -v $(RPMVersion)
+        --iteration $(RPMRevision)
+        -a amd64
+        $(RPMArguments)
+        --rpm-changelog $(_DockerRootDirectory).w/templates/changelog
+        --rpm-summary &quot;$(RPMSummary)&quot;
+        --description &quot;$(RPMDescription)&quot;
+        --maintainer &quot;$(RPMMaintainer)&quot;
+        --vendor &quot;$(RPMVendor)&quot;
+        --license &quot;$(RPMLicense)&quot;
+        --url &quot;$(RPMHomepage)&quot;
+        $(_DockerRootDirectory).w/package_root/=&quot;$(RPMInstallRoot)&quot;" />
+  </Target>
+
+  <Target Name="GenerateRpms" DependsOnTargets="_EnsureInstallerPrerequisites">
+     <PropertyGroup>
+      <Image>rhel.7</Image>
+      <RPMVendor>.NET Foundation</RPMVendor>
+      <RHInstallerInstallRoot>/opt/rh/rh-dotnet20/root/usr/lib64/dotnet/</RHInstallerInstallRoot>
+      <GenericInstallerInstallRoot>/usr/share/dotnet/</GenericInstallerInstallRoot>
+    </PropertyGroup>
+    
+    <!-- Build Docker Image -->
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_BuildDockerImage" Properties="Image=$(Image)" />
+
+    <!-- Common installer parameters -->
+    <JsonPeek Query="$.short_description" JsonInputPath="$(RSDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_RSInstallerSummary" />
+    </JsonPeek>
+    <JsonPeek Query="$.long_description" JsonInputPath="$(RSDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_RSDescription" />
+    </JsonPeek>
+    <JsonPeek Query="$.license.type" JsonInputPath="$(RSDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_RSLicense" />
+    </JsonPeek>
+    <JsonPeek Query="$.release.package_revision" JsonInputPath="$(RSDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_RSPackageRevision" />
+    </JsonPeek>
+    <JsonPeek Query="$.homepage" JsonInputPath="$(RSDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_RSHomepage" />
+    </JsonPeek>
+    <JsonPeek Query="$.maintainer_name" JsonInputPath="$(RSDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_RSMaintainerName" />
+    </JsonPeek>
+    <JsonPeek Query="$.maintainer_email" JsonInputPath="$(RSDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_RSMaintainerEmail" />
+    </JsonPeek>
+    <JsonPeek Query="$.short_description" JsonInputPath="$(HostingDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_HostingSummary" />
+    </JsonPeek>
+    <JsonPeek Query="$.long_description" JsonInputPath="$(HostingDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_HostingDescription" />
+    </JsonPeek>
+    <JsonPeek Query="$.license.type" JsonInputPath="$(HostingDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_HostingLicense" />
+    </JsonPeek>
+    <JsonPeek Query="$.release.package_revision" JsonInputPath="$(HostingDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_HostingRevision" />
+    </JsonPeek>
+    <JsonPeek Query="$.homepage" JsonInputPath="$(HostingDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_HostingHomepage" />
+    </JsonPeek>
+    <JsonPeek Query="$.maintainer_name" JsonInputPath="$(HostingDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_HostingMaintainerName" />
+    </JsonPeek>
+    <JsonPeek Query="$.maintainer_email" JsonInputPath="$(HostingDebConfigFile)">
+      <Output TaskParameter="Result" ItemName="_HostingMaintainerEmail" />
+    </JsonPeek>
+
+    <ItemGroup>
+      <RHStoreDirectories Include="$(RHInstallerInstallRoot)additionalDeps" />
+      <RHStoreDirectories Include="$(RHInstallerInstallRoot)store" />
+      <GenericStoreDirectories Include="$(GenericInstallerInstallRoot)additionalDeps" />
+      <GenericStoreDirectories Include="$(GenericInstallerInstallRoot)store" />
+      <HostingBundleDependencies Include="$(RSInstallerName)-$(Version)">
+        <Version>$(Version)</Version>
+      </HostingBundleDependencies>
+      <HostingBundleDependencies Include="dotnet-runtime-$(SharedFrameworkVersion)">
+        <Version>$(SharedFrameworkVersion)</Version>
+      </HostingBundleDependencies>
+      <TimestampFreeHostingDependencies Include="$(RSInstallerName)-$(TimestampFreeVersion)">
+        <Version>$(TimestampFreeVersion)</Version>
+      </TimestampFreeHostingDependencies>
+      <TimestampFreeHostingDependencies Include="dotnet-runtime-$(SharedFrameworkVersion)">
+        <Version>$(SharedFrameworkVersion)</Version>
+      </TimestampFreeHostingDependencies>
+    </ItemGroup>
+
+    <PropertyGroup>
+      <HostingArguments>@(HostingBundleDependencies->' -d &quot;%(Identity) &gt;= %(Version)&quot;', ' ')</HostingArguments>
+      <TimestampFreeHostingArguments>@(TimestampFreeHostingDependencies->' -d &quot;%(Identity) &gt;= %(Version)&quot;', ' ')</TimestampFreeHostingArguments>
+      <RHRSArguments>@(RHStoreDirectories->' --directories &quot;%(FullPath)&quot;', ' ')</RHRSArguments>
+      <GenericRSArguments>@(GenericStoreDirectories->' --directories &quot;%(FullPath)&quot;', ' ')</GenericRSArguments>
+    
+      <CommonArguments>Image=$(Image);RPMVendor=$(RPMVendor)</CommonArguments>
+      <CommonGenericArguments>RPMFileSuffix=rhel.7-x64.rpm;RPMInstallRoot=$(GenericInstallerInstallRoot)</CommonGenericArguments>
+      <CommonRHArguments>RPMFileSuffix=rhel.rh.7-x64.rpm;RPMInstallRoot=$(RHInstallerInstallRoot)</CommonRHArguments>
+
+      <CommonRSArguments>MaintainerName=@(_RSMaintainerName);MaintainerEmail=@(_RSMaintainerEmail)</CommonRSArguments>
+      <CommonRSArguments>$(CommonRSArguments);RPMInstallerPrefix=$(RSInstallerName);RPMRevision=@(_RSPackageRevision)</CommonRSArguments>
+      <CommonRSArguments>$(CommonRSArguments);RPMSummary=@(_RSInstallerSummary);RPMDescription=@(_RSDescription)</CommonRSArguments>
+      <CommonRSArguments>$(CommonRSArguments);RPMLicense=@(_RSLicense);RPMHomepage=@(_RSHomepage)</CommonRSArguments>
+      
+      <CommonHostingArguments>$(CommonArguments);MaintainerName=@(_HostingMaintainerName);MaintainerEmail=@(_HostingMaintainerEmail)</CommonHostingArguments>
+      <CommonHostingArguments>$(CommonHostingArguments);RPMInstallerPrefix=$(HostingInstallerName);RPMRevision=@(_HostingRevision)</CommonHostingArguments>
+      <CommonHostingArguments>$(CommonHostingArguments);RPMSummary=@(_HostingSummary);RPMDescription=@(_HostingDescription)</CommonHostingArguments>
+      <CommonHostingArguments>$(CommonHostingArguments);RPMLicense=@(_HostingLicense);RPMHomepage=@(_HostingHomepage)</CommonHostingArguments>
+
+      <TimestampRSArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonRSArguments)</TimestampRSArguments>
+      <TimestampRSArguments>$(TimestampRSArguments);RSArchive=$(TimestampRSArchive);RPMVersion=$(Version);RPMArguments=$(GenericRSArguments)</TimestampRSArguments>
+      
+      <TimestampFreeRSArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonRSArguments)</TimestampFreeRSArguments>
+      <TimestampFreeRSArguments>$(TimestampFreeRSArguments);RSArchive=$(TimestampFreeRSArchive);RPMVersion=$(TimestampFreeVersion);RPMArguments=$(GenericRSArguments)</TimestampFreeRSArguments>
+      
+      <TimestampHostingArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonHostingArguments)</TimestampHostingArguments>
+      <TimestampHostingArguments>$(TimestampHostingArguments);RPMVersion=$(Version);RPMArguments=$(HostingArguments)</TimestampHostingArguments>
+      
+      <TimestampFreeHostingArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonHostingArguments)</TimestampFreeHostingArguments>
+      <TimestampFreeHostingArguments>$(TimestampFreeHostingArguments);RPMVersion=$(TimestampFreeVersion);RPMArguments=$(TimestampFreeHostingArguments)</TimestampFreeHostingArguments>
+
+      <RHTimestampRSArguments>$(CommonArguments);$(CommonRHArguments);$(CommonRSArguments)</RHTimestampRSArguments>
+      <RHTimestampRSArguments>$(RHTimestampRSArguments);RSArchive=$(TimestampRSArchive);RPMVersion=$(Version);RPMArguments=$(RHRSArguments)</RHTimestampRSArguments>
+      
+      <RHTimestampFreeRSArguments>$(CommonArguments);$(CommonRHArguments);$(CommonRSArguments)</RHTimestampFreeRSArguments>
+      <RHTimestampFreeRSArguments>$(RHTimestampFreeRSArguments);RSArchive=$(TimestampFreeRSArchive);RPMVersion=$(TimestampFreeVersion);RPMArguments=$(RHRSArguments)</RHTimestampFreeRSArguments>
+      
+      <RHTimestampHostingArguments>$(CommonArguments);$(CommonRHArguments);$(CommonHostingArguments)</RHTimestampHostingArguments>
+      <RHTimestampHostingArguments>$(RHTimestampHostingArguments);RPMVersion=$(Version);RPMArguments=$(HostingArguments)</RHTimestampHostingArguments>
+      
+      <RHTimestampFreeHostingArguments>$(CommonArguments);$(CommonRHArguments);$(CommonHostingArguments)</RHTimestampFreeHostingArguments>
+      <RHTimestampFreeHostingArguments>$(RHTimestampFreeHostingArguments);RPMVersion=$(TimestampFreeVersion);RPMArguments=$(TimestampFreeHostingArguments)</RHTimestampFreeHostingArguments>
+    </PropertyGroup>
+
+    <!-- General Timestamp runtime store -->
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(TimestampRSArguments)" />
+    <!-- General Timestamp free runtime store -->
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(TimestampFreeRSArguments)" />
+    <!-- General Timestamp hosting bundle -->
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(TimestampHostingArguments)" />
+    <!-- General Timestamp free hosting bundle -->
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(TimestampFreeHostingArguments)" />
+    
+    <!-- RH Timestamp runtime store -->
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RHTimestampRSArguments)" />
+    <!-- RH Timestamp free runtime store -->
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RHTimestampFreeRSArguments)" />
+    <!-- RH Timestamp hosting bundle -->
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RHTimestampHostingArguments)" />
+    <!-- RH Timestamp free hosting bundle -->
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RHTimestampFreeHostingArguments)" />
+
+    <!-- Remove Docker Image to save disk space -->
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_RemoveDockerImage" Properties="Image=$(Image)" />
+  </Target>
+
+  <Target Name="_GenerateDeb">
+    <!-- Create layout: Clear work directory -->
+    <RemoveDir Directories="$(_WorkRoot)" />
+    <MakeDir Directories="$(_WorkRoot)" />
+
+    <!-- Create layout: Extract archive if given -->
+    <MakeDir Directories="$(_WorkLayoutDir)package_root\" />
+    <Exec Command="tar -xzf $(RSArchive) -C $(_WorkLayoutDir)package_root\" Condition="'$(RSArchive)'!=''" />
+
+    <!-- Create layout: Generate and Place debian_config.json -->
+    <Copy
+      SourceFiles="$(DebConfig)"
+      DestinationFiles="$(_WorkLayoutDir)debian_config.json"
+      OverwriteReadOnlyFiles="True"
+      SkipUnchangedFiles="False"
+      UseHardlinksIfPossible="False" />
+
+    <ItemGroup>
+      <DebConfigItems Include="DOTNET_VERSION" Replacement="$(DotnetVersion)" />
+      <DebConfigItems Include="DEB_VERSION" Replacement="$(DebVersion)" />
+    </ItemGroup>
+
+    <!-- Update versions -->
+    <RepoTasks.ReplaceInFile Filename="$(_WorkLayoutDir)debian_config.json" Items="@(DebConfigItems)" />
+
+    <!-- Build Runtime Store and Hosting Bundle Deb package -->
+    <Exec Command="docker run
+      --rm
+      -v $(RepositoryRoot):$(_DockerRootDirectory)
+      -e DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
+      -e INSTALLER_NAME=$(DebPrefix)-$(DebVersion)
+      -e INSTALLER_VERSION=$(DebVersion)
+      docker-image-$(Image)
+      ./build.sh /t:RunDebTool"
+      ContinueOnError="WarnAndContinue" />
+
+    <!-- Copy Runtime Store and Hosting Bundle packages to output -->
+    <ItemGroup>
+      <GeneratedDebFiles Include="$(_WorkOutputDir)/*.deb" />
+    </ItemGroup>
+    
+    <Error Text="@(GeneratedDebFiles->Count()) deb installer files generated." Condition="'@(GeneratedDebFiles->Count())' != 1" />
+    
+    <Copy
+      DestinationFiles="$(ArtifactsDir)$(DebPrefix)-$(DebVersion)-$(Image)-x64.deb"
+      SourceFiles="@(GeneratedDebFiles)"
+      OverwriteReadOnlyFiles="True"
+      SkipUnchangedFiles="False"
+      UseHardlinksIfPossible="False" />
+  </Target>
+
+  <Target Name="_GenerateDebOnPlatform">
+    <PropertyGroup>
+      <CommonRSArguments>Image=$(Image);DebConfig=$(RSDebConfigFile);DebPrefix=$(RSInstallerName)</CommonRSArguments>
+      <CommonHostingArguments>Image=$(Image);DebConfig=$(HostingDebConfigFile);DotnetVersion=$(SharedFrameworkVersion);DebPrefix=$(HostingInstallerName)</CommonHostingArguments>
+    </PropertyGroup>
+  
+    <!-- Build Docker Image -->
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_BuildDockerImage" Properties="Image=$(Image)" />
+
+    <MSBuild 
+      Projects="$(MSBuildProjectFullPath)" 
+      Targets="_GenerateDeb" 
+      Properties="$(CommonRSArguments);RSArchive=$(TimestampRSArchive);DebVersion=$(Version)" />
+    <MSBuild 
+      Projects="$(MSBuildProjectFullPath)" 
+      Targets="_GenerateDeb" 
+      Properties="$(CommonRSArguments);RSArchive=$(TimestampFreeRSArchive);DebVersion=$(TimestampFreeVersion)" />
+    <MSBuild 
+      Projects="$(MSBuildProjectFullPath)" 
+      Targets="_GenerateDeb" 
+      Properties="$(CommonHostingArguments);DebVersion=$(Version)" />
+    <MSBuild 
+      Projects="$(MSBuildProjectFullPath)" 
+      Targets="_GenerateDeb" 
+      Properties="$(CommonHostingArguments);DebVersion=$(TimestampFreeVersion)" />
+  
+    <!-- Remove Docker Image to save disk space -->
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_RemoveDockerImage" Properties="Image=$(Image)" />
+  </Target>
+
+  <Target Name="GenerateDebs" DependsOnTargets="_EnsureInstallerPrerequisites">
+    <PropertyGroup>
+      <CommonArguments>Version=$(Version);TimestampFreeVersion=$(TimestampFreeVersion)</CommonArguments>
+    </PropertyGroup>
+
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateDebOnPlatform" Properties="$(CommonArguments);Image=debian.8" />  
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateDebOnPlatform" Properties="$(CommonArguments);Image=ubuntu.14.04" />  
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateDebOnPlatform" Properties="$(CommonArguments);Image=ubuntu.16.04" />  
+    <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateDebOnPlatform" Properties="$(CommonArguments);Image=ubuntu.16.10" />  
+  </Target>
+
+  <Target Name="RunDebTool">
+    <!-- Install dotnet-deb tool -->
+    <MSBuild Projects="$(_DebToolDir)dotnet-deb-tool-consumer.csproj" Targets="Restore" />
+
+    <!-- Build deb package -->
+    <Exec 
+      Command="dotnet deb-tool -i $(_WorkLayoutDir) -o $(_WorkOutputDir) -n $(INSTALLER_NAME) -v $(INSTALLER_VERSION)"
+      WorkingDirectory="$(_DebToolDir)" />
+  </Target>
+</Project>

+ 1 - 0
build/repo.targets

@@ -1,6 +1,7 @@
 <Project>
   <Import Project="RepositoryBuild.targets" />
   <Import Project="RuntimeStore.targets" />
+  <Import Project="RuntimeStoreInstaller.targets" />
   <Import Project="PackageArchive.targets" />
   <Import Project="Templating.targets" />
   <Import Project="push.targets" />

+ 2 - 6
build/tasks/AddArchiveReferences.cs

@@ -63,9 +63,7 @@ namespace RepoTasks
 
                 if (RemoveTimestamp)
                 {
-                    var version = new NuGetVersion(packageVersion);
-                    var updatedVersion = new NuGetVersion(version.Version, VersionUtilities.GetNoTimestampReleaseLabel(version.Release));
-                    packageVersion = updatedVersion.ToNormalizedString();
+                    packageVersion = VersionUtilities.GetTimestampFreeVersion(packageVersion);
                 }
 
                 Log.LogMessage(MessageImportance.High, $" - Package: {packageName} Version: {packageVersion}");
@@ -99,9 +97,7 @@ namespace RepoTasks
 
                 if (RemoveTimestamp)
                 {
-                    var version = new NuGetVersion(packageVersion);
-                    var updatedVersion = new NuGetVersion(version.Version, VersionUtilities.GetNoTimestampReleaseLabel(version.Release));
-                    packageVersion = updatedVersion.ToNormalizedString();
+                    packageVersion = VersionUtilities.GetTimestampFreeVersion(packageVersion);
                 }
 
                 Log.LogMessage(MessageImportance.High, $" - Tool: {packageName} Version: {packageVersion}");

+ 26 - 0
build/tasks/GetTimestampFreeVersion.cs

@@ -0,0 +1,26 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.Linq;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+using RepoTasks.Utilities;
+
+namespace RepoTasks
+{
+    public class GetTimestampFreeVersion : Task
+    {
+        [Required]
+        public string TimestampVersion { get; set; }
+
+        [Output]
+        public string TimestampFreeVersion { get; set; }
+
+        public override bool Execute()
+        {
+            TimestampFreeVersion = VersionUtilities.GetTimestampFreeVersion(TimestampVersion);
+
+            return true;
+        }
+    }
+}

+ 33 - 0
build/tasks/ReplaceInFile.cs

@@ -0,0 +1,33 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.IO;
+using System.Linq;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace RepoTasks
+{
+    public class ReplaceInFile : Task
+    {
+        [Required]
+        public string Filename { get; set; }
+
+        [Required]
+        public ITaskItem[] Items { get; set; }
+
+        public override bool Execute()
+        {
+            var fileText = File.ReadAllText(Filename);
+
+            foreach (var item in Items)
+            {
+                fileText = fileText.Replace(item.ItemSpec, item.GetMetadata("Replacement"));
+            }
+
+            File.WriteAllText(Filename, fileText);
+
+            return true;
+        }
+    }
+}

+ 2 - 0
build/tasks/RepoTasks.tasks

@@ -17,4 +17,6 @@
   <UsingTask TaskName="RepoTasks.CreateCommonManifest" AssemblyFile="$(_RepoTaskAssembly)" />
   <UsingTask TaskName="RepoTasks.ComposeNewStore" AssemblyFile="$(_RepoTaskAssembly)" />
   <UsingTask TaskName="RepoTasks.ConsolidateManifests" AssemblyFile="$(_RepoTaskAssembly)" />
+  <UsingTask TaskName="RepoTasks.GetTimestampFreeVersion" AssemblyFile="$(_RepoTaskAssembly)" />
+  <UsingTask TaskName="RepoTasks.ReplaceInFile" AssemblyFile="$(_RepoTaskAssembly)" />
 </Project>

+ 9 - 1
build/tasks/Utilities/VersionUtilities.cs

@@ -2,12 +2,20 @@
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 using System;
+using NuGet.Versioning;
 
 namespace RepoTasks.Utilities
 {
     public class VersionUtilities
     {
-        public static string GetNoTimestampReleaseLabel(string releaseLabel)
+        public static string GetTimestampFreeVersion(string packageVersion)
+        {
+            var version = new NuGetVersion(packageVersion);
+            var updatedVersion = new NuGetVersion(version.Version, GetTimestampFreeReleaseLabel(version.Release));
+            return  updatedVersion.ToNormalizedString();
+        }
+
+        public static string GetTimestampFreeReleaseLabel(string releaseLabel)
         {
             if (releaseLabel.StartsWith("rtm-", StringComparison.OrdinalIgnoreCase))
             {

+ 51 - 0
build/tools/docker/debian.8/Dockerfile

@@ -0,0 +1,51 @@
+#
+# Copyright (c) .NET Foundation. All rights reserved.
+# Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+#
+
+# Dockerfile that creates a container suitable to build dotnet-cli
+FROM debian:jessie
+
+# Misc Dependencies for build
+RUN apt-get update && \
+    apt-get -qqy install \
+        curl \
+        unzip \
+        gettext \
+        sudo \
+        libunwind8 \
+        libkrb5-3 \
+        libicu52 \
+        liblttng-ust0 \
+        libssl1.0.0 \
+        zlib1g \
+        libuuid1 \
+        debhelper \
+        build-essential \
+        devscripts \
+        git \
+        cmake \
+        clang-3.5 \
+        wget && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists/*
+
+# Use clang as c++ compiler
+RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-3.5 100
+RUN update-alternatives --set c++ /usr/bin/clang++-3.5
+
+# Setup User to match Host User, and give superuser permissions
+ARG USER_ID=0
+RUN useradd -m code_executor -u ${USER_ID} -g sudo
+RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+
+# With the User Change, we need to change permissions on these directories
+RUN chmod -R a+rwx /usr/local
+RUN chmod -R a+rwx /home
+RUN chmod -R 755 /usr/lib/sudo
+
+# Set user to the one we just created
+USER ${USER_ID}
+
+# Set working directory
+WORKDIR /opt/code

+ 27 - 0
build/tools/docker/rhel.7/Dockerfile

@@ -0,0 +1,27 @@
+#
+# Copyright (c) .NET Foundation. All rights reserved.
+# Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+#
+
+# Dockerfile that creates a container suitable to build dotnet-cli
+FROM microsoft/dotnet-buildtools-prereqs:rhel-7-rpmpkg-c982313-20174116044113
+
+# Install from sudo main package TODO This package needs to be mirrored
+RUN yum install -y https://www.sudo.ws/sudo/dist/packages/RHEL/7/sudo-1.8.20-3.el7.x86_64.rpm \
+    && yum clean all
+
+# Setup User to match Host User, and give superuser permissions
+ARG USER_ID=0
+RUN useradd -m code_executor -u ${USER_ID} -g root
+RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+
+# With the User Change, we need to change permssions on these directories
+RUN chmod -R a+rwx /usr/local
+RUN chmod -R a+rwx /home
+RUN chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
+
+# Set user to the one we just created
+USER ${USER_ID}
+
+# Set working directory
+WORKDIR /opt/code

+ 52 - 0
build/tools/docker/ubuntu.14.04/Dockerfile

@@ -0,0 +1,52 @@
+#
+# Copyright (c) .NET Foundation. All rights reserved.
+# Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+#
+
+# Dockerfile that creates a container suitable to build dotnet-cli
+FROM ubuntu:14.04
+
+# Misc Dependencies for build
+RUN apt-get update && \
+    apt-get -qqy install \
+        curl \
+        unzip \
+        gettext \
+        sudo \
+        libunwind8 \
+        libkrb5-3 \
+        libicu52 \
+        liblttng-ust0 \
+        libssl1.0.0 \
+        zlib1g \
+        libuuid1 \
+        debhelper \
+        build-essential \
+        devscripts \
+        git \
+        cmake \
+        clang-3.5 \
+        lldb-3.6 \
+        wget && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists/*
+
+# Use clang as c++ compiler
+RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-3.5 100
+RUN update-alternatives --set c++ /usr/bin/clang++-3.5
+
+# Setup User to match Host User, and give superuser permissions
+ARG USER_ID=0
+RUN useradd -m code_executor -u ${USER_ID} -g sudo
+RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+
+# With the User Change, we need to change permissions on these directories
+RUN chmod -R a+rwx /usr/local
+RUN chmod -R a+rwx /home
+RUN chmod -R 755 /usr/lib/sudo
+
+# Set user to the one we just created
+USER ${USER_ID}
+
+# Set working directory
+WORKDIR /opt/code

+ 48 - 0
build/tools/docker/ubuntu.16.04/Dockerfile

@@ -0,0 +1,48 @@
+#
+# Copyright (c) .NET Foundation. All rights reserved.
+# Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+#
+
+FROM ubuntu:16.04
+
+# Install the base toolchain we need to build anything (clang, cmake, make and the like)
+# this does not include libraries that we need to compile different projects, we'd like
+# them in a different layer.
+RUN apt-get update && \
+    apt-get install -y cmake \
+        make \
+        llvm-3.5 \
+        clang-3.5 \
+        git \
+        curl \
+        tar \
+        sudo \
+        debhelper \
+        build-essential \
+        devscripts \
+        libunwind8 \
+        libkrb5-3 \
+        libicu55 \
+        liblttng-ust0 \
+        libssl1.0.0 \
+        zlib1g \
+        libuuid1 \
+        liblldb-3.6 \
+        wget && \
+    apt-get clean
+
+# Setup User to match Host User, and give superuser permissions
+ARG USER_ID=0
+RUN useradd -m code_executor -u ${USER_ID} -g sudo
+RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+
+# With the User Change, we need to change permissions on these directories
+RUN chmod -R a+rwx /usr/local
+RUN chmod -R a+rwx /home
+RUN chmod -R 755 /usr/lib/sudo
+
+# Set user to the one we just created
+USER ${USER_ID}
+
+# Set working directory
+WORKDIR /opt/code

+ 52 - 0
build/tools/docker/ubuntu.16.10/Dockerfile

@@ -0,0 +1,52 @@
+#
+# Copyright (c) .NET Foundation. All rights reserved.
+# Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+#
+
+# Dockerfile that creates a container suitable to build dotnet-cli
+FROM ubuntu:16.10
+
+# Misc Dependencies for build
+RUN apt-get update && \
+    apt-get -qqy install \
+        curl \
+        unzip \
+        gettext \
+        sudo \
+        libunwind8 \
+        libkrb5-3 \
+        libicu57 \
+        liblttng-ust0 \
+        libssl1.0.0 \
+        zlib1g \
+        libuuid1 \
+        liblldb-3.5 \
+        debhelper \
+        build-essential \
+        devscripts \
+        git \
+        cmake \
+        clang-3.5 \
+        wget && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists/*
+
+# Use clang as c++ compiler
+RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-3.5 100
+RUN update-alternatives --set c++ /usr/bin/clang++-3.5
+
+# Setup User to match Host User, and give superuser permissions
+ARG USER_ID=0
+RUN useradd -m code_executor -u ${USER_ID} -g sudo
+RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+
+# With the User Change, we need to change permissions on these directories
+RUN chmod -R a+rwx /usr/local
+RUN chmod -R a+rwx /home
+RUN chmod -R 755 /usr/lib/sudo
+
+# Set user to the one we just created
+USER ${USER_ID}
+
+# Set working directory
+WORKDIR /opt/code

+ 12 - 0
build/tools/dotnet-deb-tool-consumer/dotnet-deb-tool-consumer.csproj

@@ -0,0 +1,12 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>netcoreapp1.0</TargetFramework>
+    <RestoreSources>$(RestoreSources);https://dotnet.myget.org/F/cli-deps/api/v3/index.json</RestoreSources>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <DotNetCliToolReference Include="dotnet-deb-tool" Version="2.0.0" />
+  </ItemGroup>
+
+</Project>

+ 2 - 0
build/tools/packaging/changelog

@@ -0,0 +1,2 @@
+* DATE MAINTAINER_NAME <MAINTAINER_EMAIL> - PACKAGE_VERSION-PACKAGE_REVISION
+-

+ 35 - 0
build/tools/packaging/hosting_debian_config.json

@@ -0,0 +1,35 @@
+{
+    "maintainer_name": "Microsoft",
+    "maintainer_email": "[email protected]",
+
+    "package_name": "dotnet-hosting",
+    "install_root": "/usr/share/dotnet",
+
+    "short_description": "Microsoft .NET Core DEB_VERSION Linux Server Hosting",
+    "long_description": "Microsoft .NET Core DEB_VERSION Linux Server Hosting enables hosting of ASP.NET Core applications and contains the ASP.NET Core Runtime Package Store and .NET Core Runtime. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/aspnet/home). We happily accept issues and PRs.",
+    "homepage": "https://www.asp.net/",
+
+    "release":{
+        "package_version":"0.0.0.0",
+        "package_revision":"1",
+        "urgency" : "low",
+        "changelog_message" : ""
+    },
+
+    "control": {
+        "priority":"standard",
+        "section":"devel",
+        "architecture":"any"
+    },
+
+    "copyright": "Microsoft",
+    "license": {
+        "type": "Apache-2.0",
+        "full_text": "Copyright (c) .NET Foundation. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthese files except in compliance with the License. You may obtain a copy of the\nLicense at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed\nunder the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\nCONDITIONS OF ANY KIND, either express or implied. See the License for the\nspecific language governing permissions and limitations under the License."
+    },
+
+    "debian_dependencies": {
+        "dotnet-runtime-DOTNET_VERSION": {},
+        "aspnetcore-store-DEB_VERSION": {}
+    }
+}

+ 34 - 0
build/tools/packaging/store_debian_config.json

@@ -0,0 +1,34 @@
+{
+    "maintainer_name": "Microsoft",
+    "maintainer_email": "[email protected]",
+
+    "package_name": "aspnetcore-store",
+    "install_root": "/usr/share/dotnet",
+
+    "short_description": "Microsoft ASP.NET Core DEB_VERSION Runtime Package Store",
+    "long_description": "Runtime package store for Microsoft ASP.NET Core. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/aspnet/home). We happily accept issues and PRs.",
+    "homepage": "https://www.asp.net/",
+
+    "release":{
+        "package_version":"0.0.0.0",
+        "package_revision":"1",
+        "urgency" : "low",
+        "changelog_message" : ""
+    },
+
+    "control": {
+        "priority":"standard",
+        "section":"devel",
+        "architecture":"any"
+    },
+
+    "copyright": "Microsoft",
+    "license": {
+        "type": "Apache-2.0",
+        "full_text": "Copyright (c) .NET Foundation. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthese files except in compliance with the License. You may obtain a copy of the\nLicense at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed\nunder the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\nCONDITIONS OF ANY KIND, either express or implied. See the License for the\nspecific language governing permissions and limitations under the License."
+    },
+
+    "debian_dependencies": {
+        "aspnetcore-store-2.0.0": {}
+    }
+}