1 <# 2 .Synopsis 3 Compiles and signs a catalog file. 4 .Description 5 Given the CDF definition file, builds and signs a catalog. 6 .Parameter catalog 7 The path to the catalog definition file to compile and 8 sign. It is assumed that the .cat file will be the same 9 name with a new extension. 10 .Parameter outfile 11 The path to move the built .cat file to (optional). 12 .Parameter description 13 The description to add to the signature (optional). 14 .Parameter certname 15 The name of the certificate to sign with (optional). 16 .Parameter certsha1 17 The SHA1 hash of the certificate to sign with (optional). 18 #> 19 param( 20 [Parameter(Mandatory=$true)][string]$catalog, 21 [string]$outfile, 22 [switch]$sign, 23 [string]$description, 24 [string]$certname, 25 [string]$certsha1, 26 [string]$certfile 27 ) 28 29 $tools = $script:MyInvocation.MyCommand.Path | Split-Path -parent; 30 Import-Module $tools\sdktools.psm1 -WarningAction SilentlyContinue -Force 31 32 Set-Alias MakeCat (Find-Tool "makecat.exe") -Scope Script 33 34 MakeCat $catalog 35 if (-not $?) { 36 throw "Catalog compilation failed" 37 } 38 if ($sign) { 39 Sign-File -certname $certname -certsha1 $certsha1 -certfile $certfile -description $description -files @($catalog -replace 'cdf$', 'cat') 40 } 41 42 if ($outfile) { 43 Split-Path -Parent $outfile | ?{ $_ } | %{ mkdir -Force $_; } 44 Move-Item ($catalog -replace 'cdf$', 'cat') $outfile 45 } 46