Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion docker-compose/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$packageToolsDir = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)"
$executablePath = Join-Path $packageToolsDir 'docker-compose.exe'

$executableTargetDir = 'C:\ProgramData\Docker\cli-plugins\'
$executableTargetDir = 'C:\Program Files\Docker\cli-plugins\'
Comment thread
geicht marked this conversation as resolved.
$executableTargetPath = Join-Path $executableTargetDir 'docker-compose.exe'

# create plugin directory if it doesn't exist
Expand All @@ -13,5 +13,28 @@ if (-not (Test-Path -Path $executableTargetDir)) {
# remove docker-compose shim if it still exists
Uninstall-BinFile -name docker-compose -ErrorAction:Ignore

# clean up old installation location (backward compatibility)
$oldExecutableDir = 'C:\ProgramData\Docker\cli-plugins\'
$oldExecutablePath = Join-Path $oldExecutableDir 'docker-compose.exe'
$oldDockerPath = Split-Path -Path $oldExecutableDir -Parent

if (Test-Path -Path $oldExecutablePath) {
Remove-Item -Path $oldExecutablePath -Force
}

# remove old plugin directory if empty
if (Test-Path -Path $oldExecutableDir) {
if ($null -eq (Get-ChildItem -Path $oldExecutableDir)) {
Remove-Item -Path $oldExecutableDir -Force
}
}

# remove old docker directory if empty
if (Test-Path -Path $oldDockerPath) {
if ($null -eq (Get-ChildItem -Path $oldDockerPath)) {
Remove-Item -Path $oldDockerPath -Force
}
}

# move executable
Move-Item -Path $executablePath -Destination $executableTargetPath -Force
2 changes: 1 addition & 1 deletion docker-compose/tools/chocolateyUninstall.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ErrorActionPreference = "Stop"
$executableDir = 'C:\ProgramData\Docker\cli-plugins\'
$executableDir = 'C:\Program Files\Docker\cli-plugins\'
$executablePath = Join-Path $executableDir 'docker-compose.exe'
Comment thread
geicht marked this conversation as resolved.

$dockerPath = Split-Path -Path $executableDir -Parent
Comment thread
geicht marked this conversation as resolved.
Expand Down