Repository: cordova-windows Updated Branches: refs/heads/master 2f6c5d180 -> dabf44423
CB-7144 Windows8 run fails if replace default certificate Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/dabf4442 Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/dabf4442 Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/dabf4442 Branch: refs/heads/master Commit: dabf44423d1aecbc927578283a7c23f0c1ccaba5 Parents: 2f6c5d1 Author: sgrebnov <[email protected]> Authored: Wed Jul 16 16:56:28 2014 +0400 Committer: sgrebnov <[email protected]> Committed: Wed Jul 16 16:56:28 2014 +0400 ---------------------------------------------------------------------- .../cordova/lib/WindowsStoreAppUtils.ps1 | 37 ++++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/dabf4442/windows/template/cordova/lib/WindowsStoreAppUtils.ps1 ---------------------------------------------------------------------- diff --git a/windows/template/cordova/lib/WindowsStoreAppUtils.ps1 b/windows/template/cordova/lib/WindowsStoreAppUtils.ps1 index 603b5a4..86bc579 100644 --- a/windows/template/cordova/lib/WindowsStoreAppUtils.ps1 +++ b/windows/template/cordova/lib/WindowsStoreAppUtils.ps1 @@ -81,15 +81,46 @@ function CheckIfNeedDeveloperLicense return $Result } +# +# Checks whether the package certificate must be installed on the machine. +# +function CheckIfNeedInstallCertificate +{ + param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)] + [string] $ScriptDir <# Full path to the dir where Add-AppDevPackage.ps1 is stored #> + ) + + $PackagePath = Get-ChildItem (Join-Path $ScriptDir "*.appx") | Where-Object { $_.Mode -NotMatch "d" } + $BundlePath = Get-ChildItem (Join-Path $ScriptDir "*.appxbundle") | Where-Object { $_.Mode -NotMatch "d" } + # There must be exactly 1 package/bundle + if (($PackagePath.Count + $BundlePath.Count) -lt 1) + { + Throw "The app package has not been found at dir $ScriptDir" + } + if (($PackagePath.Count + $BundlePath.Count) -gt 1) + { + Throw "To many app packages have been found at dir $ScriptDir" + } + + if ($PackagePath.Count -ne 1) # there is *.appxbundle + { + $PackagePath = $BundlePath + } + + $PackageSignature = (Get-AuthenticodeSignature $PackagePath) + $Valid = ($PackageSignature -and $PackageSignature.Status -eq "Valid") + return (-not $Valid) +} + function Install-App { param( [Parameter(Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)] [string] $Path <# Full path to Add-AppDevPackage.ps1 #> ) - - if (CheckIfNeedDeveloperLicense) + if ((CheckIfNeedDeveloperLicense) -or (CheckIfNeedInstallCertificate (Join-Path $Path ".."))) { - # we can't run the script with -force param if license installation step is required + # we can't run the script with -force param if license/certificate installation step is required Invoke-Expression ("& `"$Path`"") } else
