/
chocolatey-install-package.json
83 lines (83 loc) · 5.85 KB
/
chocolatey-install-package.json
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
"Id": "b2385b12-e5b5-440f-bed8-6598c29b2528",
"Name": "Chocolatey - Install Package",
"Description": "Installs or upgrades a package using the Chocolatey package manager.",
"ActionType": "Octopus.Script",
"Version": 6,
"Properties": {
"Octopus.Action.Script.ScriptBody": "[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12\n$chocolateyBin = [Environment]::GetEnvironmentVariable(\"ChocolateyInstall\", \"Machine\") + \"\\bin\"\nif(-not (Test-Path $chocolateyBin)) {\n Write-Output \"Environment variable 'ChocolateyInstall' was not found in the system variables. Attempting to find it in the user variables...\"\n $chocolateyBin = [Environment]::GetEnvironmentVariable(\"ChocolateyInstall\", \"User\") + \"\\bin\"\n}\n\n$choco = \"$chocolateyBin\\choco.exe\"\n\nif (-not (Test-Path $choco)) {\n throw \"Chocolatey was not found at $chocolateyBin.\"\n}\n\n$chocoArgs = @('install')\nif (-not $ChocolateyPackageId) {\n throw \"Please specify the ID of an application package to install.\"\n}\nelse {\n $chocoArgs += $ChocolateyPackageId -split ' '\n}\n\n$chocoVersion = & $choco --version\nWrite-Output \"Running Chocolatey version $chocoVersion\"\n\nif (-not $ChocolateyPackageVersion) {\n Write-Output \"Installing package(s) $ChocolateyPackageId from the Chocolatey package repository...\"\n} else {\n Write-Output \"Installing package $ChocolateyPackageId version $ChocolateyPackageVersion from the Chocolatey package repository...\"\n $chocoArgs += @('--version', $ChocolateyPackageVersion)\n}\n\nif([System.Version]::Parse($chocoVersion) -ge [System.Version]::Parse(\"0.9.8.33\")) {\n Write-Output \"Adding --yes to arguments passed to Chocolatey\"\n $chocoArgs += @(\"--yes\")\n}\n\nif (![String]::IsNullOrEmpty($ChocolateyCacheLocation)) {\n Write-Output \"Using --cache-location $ChocolateyCacheLocation\"\n $chocoArgs += @(\"--cache-location\", \"`\"'$ChocolateyCacheLocation'`\"\")\n}\n\nif (![String]::IsNullOrEmpty($ChocolateySource)) {\n Write-Output \"Using package --source $ChocolateySource\"\n $chocoArgs += @('--source', \"`\"'$ChocolateySource'`\"\")\n}\n\nif (($ChocolateyNoProgress -eq 'True') -and ([System.Version]::Parse($chocoVersion) -ge [System.Version]::Parse(\"0.10.4\"))) {\n Write-Output \"Disabling download progress with --no-progress\"\n $chocoArgs += @('--no-progress')\n}\n\nif (![String]::IsNullOrEmpty($ChocolateyOtherParameters)) {\n\t$chocoArgs += $ChocolateyOtherParameters -split ' '\n}\n\n# execute the command line\nWrite-Output \"Running the command: $choco $chocoArgs\"\n& $choco $chocoArgs\n\nif ($global:LASTEXITCODE -eq 3010) { \n\t# ignore reboot required exit code\n Write-Output \"A restart may be required for the package to work\"\n $global:LASTEXITCODE = 0\n}",
"Octopus.Action.Script.Syntax": "PowerShell",
"Octopus.Action.Script.ScriptSource": "Inline",
"Octopus.Action.EnabledFeatures": ""
},
"Parameters": [
{
"Id": "449e25a9-2984-4cb7-b190-ae5114cfbb19",
"Name": "ChocolateyPackageId",
"Label": "(Required) Package Name",
"HelpText": "The name of the Chocolatey package to install. Install multiple packages by separating them with a space.\n\nExamples:\n\n* _git_\n* _git_ _vscode_ _notepadplusplus_\n",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "17ff15ac-f925-493c-9330-64180687f44c",
"Name": "ChocolateyPackageVersion",
"Label": "(Optional) Version",
"HelpText": "If a specific version of the Chocolatey package is required enter it here. Otherwise, leave this field blank to use the latest version. Example: _2.3.4_.",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "8bad47c8-9537-4e8d-8ff4-0508df29ed67",
"Name": "ChocolateyCacheLocation",
"Label": "(Optional) Cache Location",
"HelpText": "Use a specific folder to cache the Chocolatey package.",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "e4251d60-1a9c-4ee4-aa49-bd2ecfd5d64e",
"Name": "ChocolateySource",
"Label": "(Optional) Package Source",
"HelpText": "Use a package source to install Chocolatey packages from. This can be a http or https URL, a local folder or file share. When using URL's don't forget the trailing `/` at the end.\n\nFor example: \n\n* _https://chocolatey.org/api/v2/_\n* _c:\\choco-packages_\n* _\\\\business.server.local\\chocolatey-packages_",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "7790d99f-9fb2-4cfb-bdcb-74b4d254dba7",
"Name": "ChocolateyNoProgress",
"Label": "(Optional) Disable Download Progress",
"HelpText": "Disables the download progress percentage being displayed as this can generate a lot of output for the logs.",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "Checkbox"
}
},
{
"Id": "e994f28e-f306-4af9-90da-0ad68ec8f30c",
"Name": "ChocolateyOtherParameters",
"Label": "(Optional) Other Parameters",
"HelpText": "Add additional Chocolatey parameters here, separated by spaces, and they will be prefixed to the end of the Chocolatey command being executed. Examples:\n\n* _--ignorepackagecodes_\n* _--ignorepackagecodes --requirechecksum --allow-downgrade_",
"DefaultValue": "",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
}
],
"LastModifiedOn": "2021-07-26T16:50:00.000+00:00",
"LastModifiedBy": "bobjwalker",
"$Meta": {
"ExportedAt": "2020-08-10T15:59:10.300Z",
"OctopusVersion": "2020.3.2",
"Type": "ActionTemplate"
},
"Category": "chocolatey"
}