From b6b95c4d634aaaef35ab820093c284484fd04c7b Mon Sep 17 00:00:00 2001 From: "Raghu Shantha [MSFT]" Date: Thu, 4 Aug 2016 13:30:00 -0700 Subject: [PATCH] EULA for MSI Installer --- assets/license.rtf | Bin 0 -> 1413 bytes build.psm1 | 34 ++++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 assets/license.rtf diff --git a/assets/license.rtf b/assets/license.rtf new file mode 100644 index 0000000000000000000000000000000000000000..2638e5c55cc5c68cb056c2d03675d6522f26c352 GIT binary patch literal 1413 zcmZ8hOK;ma5Z-fu{D(nKZ6J7Mw@tUZCq<@XqOv4Na?=31=s{WBl}Ur7Vgy0{dxw;g zwhI`tHJtfgL-@H=rdyVk(A+(m(_y*#v?^QHb$%)2$QyY)RmK*EN*tE{hY!zXCxtQf zfIs}Q6MQJUrmvJ{#)q&Pc&+$9FE5uD&*gP_V1lX2NCg>hde*LdSo#ZpvGhOvb@Ng_ za(4cYi}qtVHcPm?C{LAYOI@veztqF(^9??a<6xGKO0QO>Rq+KCd z7=-flr1+sX@UD3eJKiX%WoNLiP7*b6DW=8%r(B~3#WYiotX+U*zP#Ac0wUfpq1jYO znL2W91Sh664#?V6TySxK3K|qQb6~&e z5zLA^SBl|C3zgQg;T57nE1U7igmH?Y;{((1&h!kfuJU>0>gv5CYgskSs9Yc_gVzo? zbJNSwScgXO#=7@_i)I*GtLXK3;72|)+3`7+$ve6kHM+9eJvhpiclMh(tEaIZxb8h@ zxh1GagPqzIU3#8%^(U@f+Z|1Kh{Mr~^Z!$+>$J&XYN%xnPut45m&e~-VQdptH!6Yj z7#H@n62o-t|FXu|iuKaTVUTBQwvnRcHUa&&y8#nKfjw0%ADJ^a-5ene>USG)J93() z_0LDTuh3A<<}6VFCT~l>dqm@7tqtB2jw{0Z=ji|MeetWDErC4Q6!$?!faZ{9$v3(t zYq$<_e82YKo)+6=UjTMwL0mjQvVkCefUh)OdqBRY8Od`TXqc*QARbc8MvD3Eprqy(ooup?QxMf~8FMznbFX1EP4VvD~)f&kJWD`>cnf(+7q zmL@qtDQg6eX}rmhi|j~TERY*(K)&G%_0J#JFgau7vYb;FSBEwe?eP_iR zz&*{02SG-28__09kYo~Q!^SyeLMWV$$%JJW;e5R93tMcEdyL^t*O~+oBI5GmUrfJ_ LEG7#4oBZPk<2}m6 literal 0 HcmV?d00001 diff --git a/build.psm1 b/build.psm1 index ad44e0e92c..19b247b6d9 100644 --- a/build.psm1 +++ b/build.psm1 @@ -784,10 +784,13 @@ Built upon .NET Core, it is also a C# REPL. $Source = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions -Publish)) Write-Verbose "Packaging $Source" + Write-Verbose "Copy license and third party notice to $Source" + Copy-Item "$PSScriptRoot\LICENSE.txt" "$Source" -Force -ErrorAction SilentlyContinue + if ($IsWindows) { # Product Guid needs to be unique for every PowerShell version to allow SxS install $productGuid = [guid]::NewGuid() - $msiPackagePath = New-MSIPackage -ProductSourcePath $Source -ProductVersion $Version -AssetsPath "$PSScriptRoot\Assets" -ProductGuid $productGuid + $msiPackagePath = New-MSIPackage -ProductSourcePath $Source -ProductVersion $Version -AssetsPath "$PSScriptRoot\assets" -LicenseFilePath "$PSScriptRoot\assets\license.rtf" -ProductGuid $productGuid $appxPackagePath = New-AppxPackage -PackageVersion $Version -SourcePath $Source -AssetsPath "$PSScriptRoot\Assets" $packages = @($msiPackagePath, $appxPackagePath) @@ -1526,9 +1529,10 @@ function New-MSIPackage { [CmdletBinding()] param ( + # Name of the Product [ValidateNotNullOrEmpty()] - [string] $ProductName = 'PowerShell', + [string] $ProductName = 'PowerShell', # Version of the Product [Parameter(Mandatory = $true)] @@ -1551,14 +1555,20 @@ function New-MSIPackage # Path to Assets folder containing artifacts such as icons, images [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [string] $AssetsPath + [string] $AssetsPath, - ) + # Path to license.rtf file - for the EULA + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] $LicenseFilePath + + ) $wixToolsetBinPath = "${env:ProgramFiles(x86)}\WiX Toolset v3.10\bin" Write-Verbose "Ensure Wix Toolset is present on the machine @ $wixToolsetBinPath" - if (-not (Test-Path $wixToolsetBinPath)) { + if (-not (Test-Path $wixToolsetBinPath)) + { throw "Install Wix Toolset prior to running this script - https://wix.codeplex.com/downloads/get/1540240" } @@ -1568,15 +1578,15 @@ function New-MSIPackage $wixLightExePath = Join-Path $wixToolsetBinPath "Light.exe" $ProductVersion = Get-PackageVersionAsMajorMinorBuildRevision -Version $ProductVersion -Verbose - + $assetsInSourcePath = "$ProductSourcePath" + '\assets' New-Item $assetsInSourcePath -type directory -Force | Write-Verbose $assetsInSourcePath = Join-Path $ProductSourcePath 'assets' - Write-Verbose "Place dependencies such as icons to $assetsInSourcePath" + Write-Verbose "Place dependencies such as icons to $assetsInSourcePath" Copy-Item "$AssetsPath\*.ico" $assetsInSourcePath -Force - + $productVersionWithName = $ProductName + "_" + $ProductVersion Write-Verbose "Create MSI for Product $productVersionWithName" @@ -1589,14 +1599,14 @@ function New-MSIPackage $wixFragmentPath = (Join-path $env:Temp "Fragment.wxs") $wixObjProductPath = (Join-path $env:Temp "Product.wixobj") $wixObjFragmentPath = (Join-path $env:Temp "Fragment.wixobj") - - $msiLocationPath = Join-Path $pwd "$productVersionWithName.msi" + + $msiLocationPath = Join-Path $pwd "$productVersionWithName.msi" Remove-Item -ErrorAction SilentlyContinue $msiLocationPath -Force & $wixHeatExePath dir $ProductSourcePath -dr $productVersionWithName -cg $productVersionWithName -gg -sfrag -srd -scom -sreg -out $wixFragmentPath -var env.ProductSourcePath -v | Write-Verbose & $wixCandleExePath "$ProductWxsPath" "$wixFragmentPath" -out (Join-Path "$env:Temp" "\\") -arch x64 -v | Write-Verbose - & $wixLightExePath -out "$productVersionWithName.msi" $wixObjProductPath $wixObjFragmentPath -ext WixUIExtension -v | Write-Verbose - + & $wixLightExePath -out "$productVersionWithName.msi" $wixObjProductPath $wixObjFragmentPath -ext WixUIExtension -dWixUILicenseRtf="$LicenseFilePath" -v | Write-Verbose + Remove-Item -ErrorAction SilentlyContinue *.wixpdb -Force Write-Verbose "You can find the MSI @ $msiLocationPath"