remove app

This commit is contained in:
2026-06-08 10:54:52 +07:00
parent f9bec78c82
commit 47407cdbca
9 changed files with 112 additions and 13 deletions

View File

@@ -83,6 +83,13 @@ class DebInstaller:
env=APT_NONINTERACTIVE_ENV,
)
def cleanup_after_remove(self, purge: bool = False) -> None:
autoremove_command = ["apt-get", *APT_DPKG_OPTIONS, "autoremove", "--yes"]
if purge:
autoremove_command.append("--purge")
self.command_runner.run(autoremove_command, env=APT_NONINTERACTIVE_ENV)
self.command_runner.run(["apt-get", "clean"], env=APT_NONINTERACTIVE_ENV)
def get_package_version(self, package_name: str) -> str | None:
result = self.command_runner.run(["dpkg-query", "-W", "-f=${Version}", package_name])
version = result.stdout.strip()