Olaf Hering
2013-Apr-11 14:36 UTC
[Libguestfs] [PATCH] always work with empty --root in zypp driver
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;
Richard W.M. Jones
2013-Apr-11 15:10 UTC
[Libguestfs] [PATCH] always work with empty --root in zypp driver
On Thu, Apr 11, 2013 at 04:36:40PM +0200, Olaf Hering wrote:> 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;Thanks - I have pushed this. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top