[Libguestfs] [PATCH] always work with empty --root in zypp driver

Olaf Hering olaf at aepfle.de
Thu Apr 11 14:36:40 UTC 2013


The current mode of operation in the zypp driver is to download all
packages into a temporary pkg-cache-dir. Installed packages in the root
filesystem are ignored, otherwise zypper would download only a subset of
packages, and it would not provide a list of all required dependencies.

Remove the getuid check to force an empty root directory and use the
configured system repositories.

This works for root and non-root users.

Signed-off-by: Olaf Hering <olaf at aepfle.de>
---
 src/supermin_zypp_rpm.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/supermin_zypp_rpm.ml b/src/supermin_zypp_rpm.ml
index 51f01eb..2089837 100644
--- a/src/supermin_zypp_rpm.ml
+++ b/src/supermin_zypp_rpm.ml
@@ -50,7 +50,7 @@ pkg_cache_dir=%S
 time zypper \
 	%s \
 	%s \
-	%s \
+	--root %S --reposd-dir /etc/zypp/repos.d \
 	--cache-dir \"${cache_dir}\" \
 	--pkg-cache-dir \"${pkg_cache_dir}\" \
 	--gpg-auto-import-keys \
@@ -65,7 +65,7 @@ time zypper \
     (if verbose then "--verbose --verbose" else "--quiet")
     (match packager_config with None -> ""
      | Some filename -> sprintf "--config %s" filename)
-    (if Unix.getuid() > 0 then sprintf "--root %S --reposd-dir /etc/zypp/repos.d" tmp_root else "")
+    tmp_root
     in
   run_shell sh names;
 




More information about the Libguestfs mailing list