Skip to content

Commit

Permalink
#399: Implement uninstall for docker on linux (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
slskiba authored Jun 25, 2024
1 parent 79ff36f commit 3bf3f12
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions cli/src/main/java/com/devonfw/tools/ide/tool/docker/Docker.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package com.devonfw.tools.ide.tool.docker;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.os.SystemArchitecture;
Expand All @@ -14,6 +9,11 @@
import com.devonfw.tools.ide.tool.PackageManagerCommand;
import com.devonfw.tools.ide.version.VersionIdentifier;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

/**
* {@link GlobalToolCommandlet} for <a href="https://www.docker.com/">docker</a> either as
* <a href="https://rancherdesktop.io/">Rancher Desktop</a> or as
Expand Down Expand Up @@ -66,13 +66,34 @@ private List<PackageManagerCommand> getPackageManagerCommandsInstall() {
+ " sudo dd status=none of=/usr/share/keyrings/isv-rancher-stable-archive-keyring.gpg",
"echo 'deb [signed-by=/usr/share/keyrings/isv-rancher-stable-archive-keyring.gpg]"
+ " https://download.opensuse.org/repositories/isv:/Rancher:/stable/deb/ ./' |"
+ " sudo dd status=none of=/etc/apt/sources.list.d/isv-rancher-stable.list",
"sudo apt update",
+ " sudo dd status=none of=/etc/apt/sources.list.d/isv-rancher-stable.list", "sudo apt update",
String.format("sudo apt install -y --allow-downgrades rancher-desktop=%s*", resolvedVersion))));

return pmCommands;
}

@Override
public void uninstall() {

if (this.context.getSystemInfo().isLinux()) {
runWithPackageManager(false, getPackageManagerCommandsUninstall());
} else {
super.uninstall();
}

}

private List<PackageManagerCommand> getPackageManagerCommandsUninstall() {

List<PackageManagerCommand> pmCommands = new ArrayList<>();
pmCommands.add(
new PackageManagerCommand(PackageManager.ZYPPER, Arrays.asList("sudo zypper remove rancher-desktop")));
pmCommands.add(
new PackageManagerCommand(PackageManager.APT, Arrays.asList("sudo apt -y autoremove rancher-desktop")));

return pmCommands;
}

@Override
protected String getBinaryName() {

Expand Down

0 comments on commit 3bf3f12

Please sign in to comment.