]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
opensuse: implements remove_packages()
authorFranck Bui <fbui@suse.com>
Mon, 13 Feb 2023 16:10:36 +0000 (17:10 +0100)
committerFranck Bui <fbui@suse.com>
Fri, 17 Feb 2023 13:32:33 +0000 (14:32 +0100)
mkosi/distributions/opensuse.py

index 817a9df8c824347abe64793b83ba1c7612252779..4e53aed5a18d62fe42a80a865760a7d84548450c 100644 (file)
@@ -23,6 +23,10 @@ class OpensuseInstaller(DistributionInstaller):
     def install(cls, state: MkosiState) -> None:
         return install_opensuse(state)
 
+    @classmethod
+    def remove_packages(cls, state: MkosiState, packages: list[str]) -> None:
+        zypper_remove(state, packages)
+
     @staticmethod
     def initrd_path(kver: str) -> Path:
         return Path("boot") / f"initrd-{kver}"
@@ -60,6 +64,11 @@ def zypper_install(state: MkosiState, packages: Iterable[str]) -> None:
     run_with_apivfs(state, cmdline)
 
 
+def zypper_remove(state: MkosiState, packages: Iterable[str]) -> None:
+        cmdline = ["zypper", "--root", state.root, "remove", "-y", "--clean-deps", *packages]
+        run_with_apivfs(state, cmdline)
+
+
 @complete_step("Installing openSUSE…")
 def install_opensuse(state: MkosiState) -> None:
     release = state.config.release.strip('"')