forked from 15below/Ensconce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeployHelp.ps1
58 lines (51 loc) · 1.38 KB
/
deployHelp.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
$deployToolsDir = Split-Path ((Get-Variable MyInvocation -Scope 0).Value.MyCommand.Path)
if (Test-Path variable:\OctopusParameters)
{
foreach($kp in $OctopusParameters.GetEnumerator())
{
if (!($kp -like '*Octopus.Step*'))
{
Set-Content ("env:\" + $kp.Key.replace("[","-").replace("]","")) ($kp.Value) -Force
}
}
}
if(!(Test-Path "env:\ConfigOnly"))
{
Set-Content "env:\ConfigOnly" $false
}
function ensconce
{
if (@($input).Count -ne 0)
{
$input.Reset()
$results = $input | & "$deployToolsDir\ensconce.exe" $args
}
else {
$results = & "$deployToolsDir\ensconce.exe" $args
}
if ($LASTEXITCODE -ne 0)
{
Write-Host "##teamcity[buildStatus status='FAILURE' text='{build.status.text}; Ensconce failure']"
$results
exit $LASTEXITCODE
}
$results
}
function EnsurePath([string]$name)
{
$path = $name | ensconce -i
if ((Test-Path $path) -eq $False)
{
md $path
}
}
function is64bit() {
return ( (Get-WmiObject Win32_OperatingSystem).OSArchitecture -eq "64-bit")
}
function CreateDesktopShortcut($exePath, $shortcutName)
{
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut((Join-Path $wshShell.SpecialFolders.Item("AllUsersDesktop") "$shortcutName.lnk"))
$Shortcut.TargetPath = $exePath
$Shortcut.Save()
}