Ubuntu and ZFS
by Tim Fletcher
Moved from Richard's blog to here....
A couple of people have requested removing the dependency on zfs-fuse
from the ubuntu packages that Richard released last week, and there is
some confusion about the state of ZFS in Ubuntu.
There are 2 Linux compatible implementations of ZFS, zfs-fuse
(http://gitweb.zfs-fuse.net/) and ZFS on Linux (http://zfsonlinux.org/).
ZFS-fuse is in the official Ubuntu repos but is rather outdated and
almost all development has stopped.
ZFS on Linux (aka ZoL) is an open source but license incompatible kernel
module that is under active development and released as source packages
for most major distos. There is a ppa for Ubuntu here:
https://launchpad.net/~zfs-native/+archive/stable
ZoL is actively used in various NAS distros, as well as things like
proxmox. I am currently using it as a backup target combined with rsync
and snapshots.
ZFS-fuse and ZoL packages can't be installed together and so installing
guestfish which depends on zfs-fuse causes removal of the ZoL packages.
--
Tim Fletcher
<tim(a)night-shade.org.uk>
11 years, 6 months
[PATCH] Mask some package names if appliance is build for SUSE
by Olaf Hering
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
Not compile-tested!
appliance/packagelist.in | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/appliance/packagelist.in b/appliance/packagelist.in
index 8a4a5ea..a00a7ad 100644
--- a/appliance/packagelist.in
+++ b/appliance/packagelist.in
@@ -126,11 +126,9 @@ dosfstools
file
findutils
gawk
-gdisk
grep
gzip
jfsutils
-kmod
less
libxml2
lsof
@@ -146,17 +144,14 @@ ocfs2-tools
*/
parted
procps
-procps-ng
psmisc
rsync
-scrub
sed
strace
syslinux
tar
udev
util-linux
-util-linux-ng
#ifndef UBUNTU
/* on Ubuntu contains a file in /lib64 which conflicts with libc6 that has
* /lib64 as a symbolic link
@@ -165,6 +160,14 @@ xfsprogs
#endif
zerofree
+#ifndef SUSE
+gdisk
+kmod
+procps-ng
+scrub
+util-linux-ng
+#endif
+
#ifdef VALGRIND_DAEMON
valgrind
#endif
11 years, 6 months
Re: [Libguestfs] noapic in /etc/libguestfs-tools.conf
by Richard W.M. Jones
[Please send all questions and replies to the mailing list]
On Mon, Jun 10, 2013 at 09:34:09PM -0400, Preetam Jinka wrote:
> Hi Richard,
>
> I wanted to know how to set LIBGUESTFS_APPEND="noapic" through
> /etc/libguestfs-tools.conf
> but I'm not sure what the format of the file should be.
>
> Could you give me the exact line I should add which will work?
>
> Thanks and in advance, and thanks for your great work with libguestfs!
It's not possible to set this in /etc/libguestfs-tools.conf.
You have to set LIBGUESTFS_APPEND="noapic" as an environment variable,
eg. by doing:
export LIBGUESTFS_APPEND="noapic"
or putting this same command into /etc/profile.d/local.sh.
See:
http://stackoverflow.com/questions/1641477/how-to-set-environment-variabl...
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
11 years, 6 months
libguestfs support snapshot based virutal disk analysis?
by 雨居轩
Hi dear all:
I have browsed almost all architecture of libGuestFs and use it on Fedora 18. It really seems greate!
However,
1. No virtual disk (*.vdi, *.vmdk...) based snashot analysis code
Current LibGuestFs could recognize and virtual disk format (e.g. *.VDI) and the file syste inside it (e.g. NTFS ), but find no support for snapshot virtual disk.
Virtual Machine such VirtualBox will generate snapshot (*.VDI for virtual disk diff, *.sav for virtual memory diff), and these snapshots are always diff towards based virtutual disk.
2. So I missed this feature? Or these feature not supported now?
If not support, so does libguestFs will support it in the future?
What is the effort or difficulty for this part development? Or you have any other opitions?
Thnaks very much for your kind reply.
Best regards
11 years, 6 months
[PATCH] Change fallback name for external supermin helper
by Olaf Hering
Use basename of external helper instead of 'no' for external supermin
helpers. This gives a clear error messages what binary is actually
missing, and it is now possible to install the missing package without
recompiling libguestfs. In addition its now also possible to use private
builds of supermin (if they are in PATH) with a given libguestfs binary
package.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 30af871..8f025d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -442,9 +442,9 @@ AC_SUBST([ENABLE_APPLIANCE])
dnl Check for supermin >= 4.1.0 or febootstrap >= 3.20.
AC_CHECK_PROGS([SUPERMIN],
- [supermin febootstrap],[no])
+ [supermin febootstrap],[supermin])
AC_CHECK_PROGS([SUPERMIN_HELPER],
- [supermin-helper febootstrap-supermin-helper],[no])
+ [supermin-helper febootstrap-supermin-helper],[supermin-helper])
dnl Pass supermin --packager-config option.
dnl
11 years, 6 months
[PATCH] inspect: Fix bogus warning for partitions without /boot.ini
by Matthew Booth
Fix a bogus warning introduced by
5abb196de869cd27a6fa2377d79b9a267120f48e. If a non-windows partition
hasn't been detected as something else and falls through to windows
detection, inspection would display a bogus warning about missing
/boot.ini.
---
src/inspect-fs-windows.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/inspect-fs-windows.c b/src/inspect-fs-windows.c
index 4eea6a3..c67f164 100644
--- a/src/inspect-fs-windows.c
+++ b/src/inspect-fs-windows.c
@@ -154,7 +154,7 @@ guestfs___get_windows_systemroot (guestfs_h *g)
* systemroot locations */
CLEANUP_FREE char *boot_ini_path =
guestfs___case_sensitive_path_silently (g, "/boot.ini");
- if (boot_ini_path) {
+ if (boot_ini_path && guestfs_is_file (g, boot_ini_path)) {
CLEANUP_FREE_STRING_LIST char **boot_ini =
guestfs_read_lines (g, boot_ini_path);
if (!boot_ini) {
--
1.8.2.1
11 years, 6 months
[supermin PATCH] RFC: Add a --names-only flag.
by Gabriel de Perthuis
This takes a list of package names, adding them to the image
without pulling any dependencies.
Only implemented for Debian at the moment.
zypper wasn't build-tested because I don't have the dependency.
---
src/.depend | 2 +-
src/supermin.ml | 6 +++---
src/supermin_cmdline.ml | 13 ++++++++++---
src/supermin_cmdline.mli | 10 +++++++---
src/supermin_debian.ml | 7 +++++--
src/supermin_package_handlers.ml | 2 +-
src/supermin_package_handlers.mli | 4 ++--
src/supermin_pacman.ml | 2 +-
src/supermin_yum_rpm.ml | 2 +-
src/supermin_zypp_rpm.ml | 10 +++++-----
10 files changed, 36 insertions(+), 22 deletions(-)
diff --git a/src/.depend b/src/.depend
index 624191e..8342f31 100644
--- a/src/.depend
+++ b/src/.depend
@@ -5,11 +5,11 @@ supermin_cmdline.cmo: config.cmo supermin_cmdline.cmi
supermin_cmdline.cmx: config.cmx supermin_cmdline.cmi
supermin.cmo: supermin_utils.cmi supermin_package_handlers.cmi supermin_cmdline.cmi config.cmo
supermin.cmx: supermin_utils.cmx supermin_package_handlers.cmx supermin_cmdline.cmx config.cmx
supermin_debian.cmo: supermin_utils.cmi supermin_package_handlers.cmi supermin_cmdline.cmi config.cmo
supermin_debian.cmx: supermin_utils.cmx supermin_package_handlers.cmx supermin_cmdline.cmx config.cmx
-supermin_package_handlers.cmi:
+supermin_package_handlers.cmi: supermin_cmdline.cmi
supermin_package_handlers.cmo: supermin_utils.cmi supermin_cmdline.cmi supermin_package_handlers.cmi
supermin_package_handlers.cmx: supermin_utils.cmx supermin_cmdline.cmx supermin_package_handlers.cmi
supermin_pacman.cmo: supermin_utils.cmi supermin_package_handlers.cmi supermin_cmdline.cmi config.cmo
supermin_pacman.cmx: supermin_utils.cmx supermin_package_handlers.cmx supermin_cmdline.cmx config.cmx
supermin_utils.cmi:
diff --git a/src/supermin.ml b/src/supermin.ml
index 57189b4..c36d80f 100644
--- a/src/supermin.ml
+++ b/src/supermin.ml
@@ -39,11 +39,11 @@ let () =
let ph = get_package_handler () in
debug "selected package handler: %s" (get_package_handler_name ());
(* Not --names: check files exist. *)
- if not names_mode then (
+ if mode == PkgFiles then (
List.iter (
fun pkg ->
if not (file_exists pkg) then (
eprintf "supermin: %s: no such file (did you miss out the --names option?)\n" pkg;
exit 1
@@ -53,12 +53,12 @@ let () =
(* --names: resolve the package list to a full list of package names
* (including dependencies).
*)
let packages =
- if names_mode then (
- let packages = ph.ph_resolve_dependencies_and_download packages in
+ if mode != PkgFiles then (
+ let packages = ph.ph_resolve_dependencies_and_download packages mode in
debug "resolved packages: %s" (String.concat " " packages);
packages
)
else packages in
diff --git a/src/supermin_cmdline.ml b/src/supermin_cmdline.ml
index 65f6250..8aaac28 100644
--- a/src/supermin_cmdline.ml
+++ b/src/supermin_cmdline.ml
@@ -16,12 +16,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*)
open Printf
+type mode =
+ |PkgFiles
+ |PkgNames
+ |PkgNamesOnly
+
let excludes = ref []
-let names_mode = ref false
+let mode = ref PkgFiles
let outputdir = ref "."
let packages = ref []
let save_temps = ref false
let use_installed = ref false
let verbose = ref false
@@ -50,12 +55,14 @@ let set_packager_config filename =
packager_config := Some filename
let argspec = Arg.align [
"--exclude", Arg.String add_exclude,
"regexp Exclude packages matching regexp";
- "--names", Arg.Set names_mode,
+ "--names", Arg.Unit (fun () -> mode := PkgNames),
" Specify set of root package names on command line";
+ "--names-only", Arg.Unit (fun () -> mode := PkgNamesOnly),
+ " Specify exact set of package names on command line";
"--no-warnings", Arg.Clear warnings,
" Suppress warnings";
"-o", Arg.Set_string outputdir,
"outputdir Set output directory (default: \".\")";
"--packager-config", Arg.String set_packager_config,
@@ -99,11 +106,11 @@ let () =
eprintf "supermin: no packages listed on the command line\n";
exit 1
)
let excludes = List.rev !excludes
-let names_mode = !names_mode
+let mode = !mode
let outputdir = !outputdir
let packages = List.rev !packages
let save_temps = !save_temps
let use_installed = !use_installed
let verbose = !verbose
diff --git a/src/supermin_cmdline.mli b/src/supermin_cmdline.mli
index 54a229c..fbdf4ae 100644
--- a/src/supermin_cmdline.mli
+++ b/src/supermin_cmdline.mli
@@ -20,16 +20,20 @@
val debug : ('a, unit, string, unit) format4 -> 'a
(** Print string (like printf), but only if --verbose was given on
the command line. *)
+type mode =
+ |PkgFiles
+ |PkgNames
+ |PkgNamesOnly
+
val excludes : Str.regexp list
(** List of package regexps to exclude. *)
-val names_mode : bool
- (** True if [--names] was given on the command line (otherwise
- {!packages} is a list of filenames). *)
+val mode : mode
+ (** How to interpret {!packages} *)
val outputdir : string
(** Output directory. *)
val packages : string list
diff --git a/src/supermin_debian.ml b/src/supermin_debian.ml
index 08e7d7c..3759f9a 100644
--- a/src/supermin_debian.ml
+++ b/src/supermin_debian.ml
@@ -51,13 +51,16 @@ let get_installed_pkgs () =
* 'apt-get install'.
*)
let which_dependencies = "-i"
(*let which_dependencies = "--no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances"*)
-let rec debian_resolve_dependencies_and_download names =
+let rec debian_resolve_dependencies_and_download names mode =
+ let which_dependencies =
+ if mode == PkgNames then which_dependencies ^ " --recurse"
+ else which_dependencies in
let cmd =
- sprintf "%s depends --recurse %s %s | grep -v '^[<[:space:]]' | grep -Ev ':\\w+\\b'"
+ sprintf "%s depends %s %s | grep -v '^[<[:space:]]' | grep -Ev ':\\w+\\b'"
Config.apt_cache which_dependencies
(String.concat " " (List.map Filename.quote names)) in
let pkgs = run_command_get_lines cmd in
let pkgs =
if Config.apt_cache_depends_recurse_broken then
diff --git a/src/supermin_package_handlers.ml b/src/supermin_package_handlers.ml
index aea557e..7048f66 100644
--- a/src/supermin_package_handlers.ml
+++ b/src/supermin_package_handlers.ml
@@ -23,11 +23,11 @@ open Supermin_utils
open Supermin_cmdline
type package_handler = {
ph_detect : unit -> bool;
ph_init : unit -> unit;
- ph_resolve_dependencies_and_download : string list -> string list;
+ ph_resolve_dependencies_and_download : string list -> mode -> string list;
ph_list_files : string -> (string * file_type) list;
ph_get_file_from_package : string -> string -> string
}
and file_type = {
ft_dir : bool;
diff --git a/src/supermin_package_handlers.mli b/src/supermin_package_handlers.mli
index 27750e1..8ee12dd 100644
--- a/src/supermin_package_handlers.mli
+++ b/src/supermin_package_handlers.mli
@@ -27,12 +27,12 @@ type package_handler = {
(** After a package handler is selected, this function is called
which can optionally do any initialization that is required.
This is only called on the package handler if it has returned
[true] from {!ph_detect}. *)
- ph_resolve_dependencies_and_download : string list -> string list;
- (** [ph_resolve_dependencies_and_download pkgs]
+ ph_resolve_dependencies_and_download : string list -> Supermin_cmdline.mode -> string list;
+ (** [ph_resolve_dependencies_and_download pkgs mode]
Take a list of package names, and using the package manager
resolve those to a list of all the packages that are required
including dependencies. Download the full list of packages and
dependencies into a tmpdir. Return the list of full filenames.
diff --git a/src/supermin_pacman.ml b/src/supermin_pacman.ml
index c08a7e3..01d66f9 100644
--- a/src/supermin_pacman.ml
+++ b/src/supermin_pacman.ml
@@ -34,11 +34,11 @@ let pacman_detect () =
let pacman_init () =
if use_installed then
failwith "pacman driver doesn't support --use-installed"
-let pacman_resolve_dependencies_and_download names =
+let pacman_resolve_dependencies_and_download names mode =
let cmd =
sprintf "(for p in %s; do pactree -u $p; done) | awk '{print $1}' | sort -u"
(String.concat " " (List.map Filename.quote names)) in
let pkgs = run_command_get_lines cmd in
diff --git a/src/supermin_yum_rpm.ml b/src/supermin_yum_rpm.ml
index b242aaf..be83582 100644
--- a/src/supermin_yum_rpm.ml
+++ b/src/supermin_yum_rpm.ml
@@ -34,11 +34,11 @@ let yum_rpm_detect () =
let yum_rpm_init () =
if use_installed then
failwith "yum_rpm driver doesn't support --use-installed"
-let yum_rpm_resolve_dependencies_and_download names =
+let yum_rpm_resolve_dependencies_and_download names mode =
(* Liberate this data from python. *)
let tmpfile = tmpdir // "names.tmp" in
let py = sprintf "
import yum
import yum.misc
diff --git a/src/supermin_zypp_rpm.ml b/src/supermin_zypp_rpm.ml
index 655ba99..ad5a347 100644
--- a/src/supermin_zypp_rpm.ml
+++ b/src/supermin_zypp_rpm.ml
@@ -74,11 +74,11 @@ let zypp_rpm_detect () =
let zypp_rpm_init () =
if use_installed then
eprintf "supermin: zypp_rpm driver assumes all packages are already installed when called with option --use-installed.\n%!"
-let zypp_rpm_resolve_dependencies_and_download_no_installed names =
+let zypp_rpm_resolve_dependencies_and_download_no_installed names mode =
(* Liberate this data from shell. *)
let tmp_pkg_cache_dir = tmpdir // "pkg_cache_dir" in
let tmp_root = tmpdir // "root" in
let sh = sprintf "
%s
@@ -136,11 +136,11 @@ time zypper \
let pkgs = walk_directory_tree tmp_pkg_cache_dir ".*\\.rpm" in
(* Return list of package filenames. *)
pkgs
-let zypp_rpm_resolve_dependencies_and_download_use_installed names =
+let zypp_rpm_resolve_dependencies_and_download_use_installed names mode =
let cmd = sprintf "
%s
unset LANG ${!LC_*}
zypper \
%s \
@@ -167,15 +167,15 @@ zypper \
let pkg_names = run_command_get_lines cmd in
(* Return list of package names, remove empty lines. *)
List.filter (fun s -> s <> "") pkg_names
-let zypp_rpm_resolve_dependencies_and_download names =
+let zypp_rpm_resolve_dependencies_and_download names mode =
if use_installed then
- zypp_rpm_resolve_dependencies_and_download_use_installed names
+ zypp_rpm_resolve_dependencies_and_download_use_installed names mode
else
- zypp_rpm_resolve_dependencies_and_download_no_installed names
+ zypp_rpm_resolve_dependencies_and_download_no_installed names mode
let rec zypp_rpm_list_files pkg =
(* Run rpm -qlp with some extra magic. *)
let cmd =
sprintf "rpm -q --qf '[%%{FILENAMES} %%{FILEFLAGS:fflags} %%{FILEMODES} %%{FILESIZES}\\n]' %s %S"
--
1.8.3.222.g430da9e
11 years, 6 months
[PATCH 1/3] inspection: Refactor windows systemroot detection to allow re-use
by Matthew Booth
This change refactors guestfs___has_windows_systemroot to
guestfs___get_windows_systemroot. The new function returns a
dynamically allocated char * which must be freed.
The new function is no less efficient than before, as it returns the
result of guestfs___case_sensitive_path_silently, which is required
anyway. The new code is slightly more efficient than before, as it
re-uses the result of this testing in guestfs___check_windows_root
rather than running it again.
---
src/guestfs-internal.h | 4 +--
src/inspect-fs-windows.c | 72 +++++++++++++++++++++++-------------------------
src/inspect-fs.c | 8 ++++--
3 files changed, 43 insertions(+), 41 deletions(-)
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index 6e97948..bc13b3c 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -668,8 +668,8 @@ extern int guestfs___check_hurd_root (guestfs_h *g, struct inspect_fs *fs);
/* inspect-fs-windows.c */
extern char *guestfs___case_sensitive_path_silently (guestfs_h *g, const char *);
-extern int guestfs___has_windows_systemroot (guestfs_h *g);
-extern int guestfs___check_windows_root (guestfs_h *g, struct inspect_fs *fs);
+extern char * guestfs___get_windows_systemroot (guestfs_h *g);
+extern int guestfs___check_windows_root (guestfs_h *g, struct inspect_fs *fs, char *windows_systemroot);
/* inspect-fs-cd.c */
extern int guestfs___check_installer_root (guestfs_h *g, struct inspect_fs *fs);
diff --git a/src/inspect-fs-windows.c b/src/inspect-fs-windows.c
index a979775..8ddea95 100644
--- a/src/inspect-fs-windows.c
+++ b/src/inspect-fs-windows.c
@@ -101,60 +101,58 @@ static char *map_registry_disk_blob (guestfs_h *g, const void *blob);
* "/Program Files" and "/System Volume Information". Those would
* *not* be Windows root disks. (RHBZ#674130)
*/
-static const char *systemroots[] =
- { "/windows", "/winnt", "/win32", "/win", NULL };
-int
-guestfs___has_windows_systemroot (guestfs_h *g)
+static int is_systemroot (guestfs_h *const g, const char *const systemroot)
{
- size_t i;
char path[256];
- for (i = 0; i < sizeof systemroots / sizeof systemroots[0]; ++i) {
- CLEANUP_FREE char *systemroot =
- guestfs___case_sensitive_path_silently (g, systemroots[i]);
- if (!systemroot)
- continue;
+ snprintf (path, sizeof path, "%s/system32", systemroot);
+ if (!guestfs___is_dir_nocase (g, path))
+ return 0;
- snprintf (path, sizeof path, "%s/system32", systemroot);
- if (!guestfs___is_dir_nocase (g, path))
- continue;
+ snprintf (path, sizeof path, "%s/system32/config", systemroot);
+ if (!guestfs___is_dir_nocase (g, path))
+ return 0;
- snprintf (path, sizeof path, "%s/system32/config", systemroot);
- if (!guestfs___is_dir_nocase (g, path))
- continue;
+ snprintf (path, sizeof path, "%s/system32/cmd.exe", systemroot);
+ if (!guestfs___is_file_nocase (g, path))
+ return 0;
+
+ return 1;
+}
+
+char *
+guestfs___get_windows_systemroot (guestfs_h *g)
+{
+ /* Check a predefined list of common windows system root locations */
+ static const char *systemroots[] =
+ { "/windows", "/winnt", "/win32", "/win", NULL };
- snprintf (path, sizeof path, "%s/system32/cmd.exe", systemroot);
- if (!guestfs___is_file_nocase (g, path))
+ for (size_t i = 0; i < sizeof systemroots / sizeof systemroots[0]; ++i) {
+ char *systemroot =
+ guestfs___case_sensitive_path_silently (g, systemroots[i]);
+ if (!systemroot)
continue;
- return (int)i;
+ if (is_systemroot (g, systemroot)) {
+ debug (g, "windows %%SYSTEMROOT%% = %s", systemroot);
+
+ return systemroot;
+ } else {
+ free (systemroot);
+ }
}
- return -1; /* not found */
+ return NULL; /* not found */
}
int
-guestfs___check_windows_root (guestfs_h *g, struct inspect_fs *fs)
+guestfs___check_windows_root (guestfs_h *g, struct inspect_fs *fs,
+ char *const systemroot)
{
- int i;
- char *systemroot;
-
fs->type = OS_TYPE_WINDOWS;
fs->distro = OS_DISTRO_WINDOWS;
- i = guestfs___has_windows_systemroot (g);
- if (i == -1) {
- error (g, "check_windows_root: has_windows_systemroot unexpectedly returned -1");
- return -1;
- }
-
- systemroot = guestfs_case_sensitive_path (g, systemroots[i]);
- if (!systemroot)
- return -1;
-
- debug (g, "windows %%SYSTEMROOT%% = %s", systemroot);
-
/* Freed by guestfs___free_inspect_info. */
fs->windows_systemroot = systemroot;
@@ -179,7 +177,7 @@ check_windows_arch (guestfs_h *g, struct inspect_fs *fs)
char cmd_exe[len];
snprintf (cmd_exe, len, "%s/system32/cmd.exe", fs->windows_systemroot);
- /* Should exist because of previous check above in has_windows_systemroot. */
+ /* Should exist because of previous check above in get_windows_systemroot. */
CLEANUP_FREE char *cmd_exe_path = guestfs_case_sensitive_path (g, cmd_exe);
if (!cmd_exe_path)
return -1;
diff --git a/src/inspect-fs.c b/src/inspect-fs.c
index d220634..0473e92 100644
--- a/src/inspect-fs.c
+++ b/src/inspect-fs.c
@@ -175,6 +175,9 @@ check_filesystem (guestfs_h *g, const char *mountable,
const struct guestfs_internal_mountable *m,
int whole_device)
{
+ /* Not CLEANUP_FREE, as it will be cleaned up with inspection info */
+ char *windows_systemroot = NULL;
+
if (extend_fses (g) == -1)
return -1;
@@ -274,10 +277,11 @@ check_filesystem (guestfs_h *g, const char *mountable,
guestfs_is_dir (g, "/spool") > 0)
;
/* Windows root? */
- else if (guestfs___has_windows_systemroot (g) >= 0) {
+ else if ((windows_systemroot = guestfs___get_windows_systemroot (g)) != NULL)
+ {
fs->is_root = 1;
fs->format = OS_FORMAT_INSTALLED;
- if (guestfs___check_windows_root (g, fs) == -1)
+ if (guestfs___check_windows_root (g, fs, windows_systemroot) == -1)
return -1;
}
/* Windows volume with installed applications (but not root)? */
--
1.8.2.1
11 years, 6 months
[PATCH / RFC] Handle --packager-config in zypp_rpm
by Olaf Hering
This is an attempt to handle a different --reposd-dir in the zypp_rpm
driver. Up to now the system repositories in /etc/zypp/repos.d were
used.
To specify a different set of repositories for zypp a parser for a
simple zypper.conf is added in this patch. It just looks for reposdir=
in section main, like this:
[main]
reposdir=/path/to/other/repofiles
If the config file provided via "--packager-config my_zypp.conf" is
valid the other directory is passed to zypper, otherwise the system
repos.d is used like its done in current code.
Depending on the kind of provided repos, the current code may fail to
import a repo in non-interactive mode. This happens if the repo data are
not properly signed. For this reason the option --no-gpg-checks is added
by this patch.
Finally, the parser uses ocaml-inifiles to read the config file. This is
a new build dependency. inifiles should be available in various
distributions, copies of the original sources can be found via google.
This patch has received some light testing, I sent it out to the list
for further comments. Particular about the new inifiles dependency..
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
src/Makefile.am | 2 +-
src/supermin_zypp_rpm.ml | 23 ++++++++++++++++++++---
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 3b6ca9b..6ed0faf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,7 +56,7 @@ OBJECTS = $(XOBJECTS)
BEST = opt
endif
-OCAMLPACKAGES = -package unix,str
+OCAMLPACKAGES = -package unix,str,inifiles
OCAMLFLAGS = -warn-error CDEFLMPSUVXYZ
supermin: $(OBJECTS)
diff --git a/src/supermin_zypp_rpm.ml b/src/supermin_zypp_rpm.ml
index c269aab..c9786ce 100644
--- a/src/supermin_zypp_rpm.ml
+++ b/src/supermin_zypp_rpm.ml
@@ -45,6 +45,7 @@
*)
open Unix
open Printf
+open Inifiles
open Supermin_package_handlers
open Supermin_utils
@@ -54,6 +55,19 @@ open Supermin_cmdline
(* Create a temporary directory for use by all the functions in this file. *)
let tmpdir = tmpdir ()
+let get_repos_dir () =
+ let zypper_default = "/etc/zypp/repos.d" in
+ let parse_repos_dir path =
+ let cfg = new inifile path in
+ let dir = (try cfg#getval "main" "reposdir" with _ -> zypper_default) in
+ dir
+ in
+ let dir = (match packager_config with None -> zypper_default |
+ Some filename -> (try parse_repos_dir filename with _ -> zypper_default) ) in
+ dir
+
+let repos_dir = get_repos_dir ()
+
let zypp_rpm_detect () =
(file_exists "/etc/SuSE-release") &&
Config.zypper <> "no" && Config.rpm <> "no"
@@ -75,10 +89,11 @@ pkg_cache_dir=%S
time zypper \
%s \
%s \
- --root %S --reposd-dir /etc/zypp/repos.d \
+ --root %S --reposd-dir %S \
--cache-dir \"${cache_dir}\" \
--pkg-cache-dir \"${pkg_cache_dir}\" \
--gpg-auto-import-keys \
+ --no-gpg-checks \
--non-interactive \
install \
--auto-agree-with-licenses \
@@ -92,6 +107,7 @@ time zypper \
(match packager_config with None -> ""
| Some filename -> sprintf "--config %s" filename)
tmp_root
+ repos_dir
in
run_shell sh names;
@@ -129,9 +145,10 @@ unset LANG ${!LC_*}
zypper \
%s \
%s \
- --root %S --reposd-dir /etc/zypp/repos.d \
+ --root %S --reposd-dir %S \
--cache-dir %S \
--gpg-auto-import-keys \
+ --no-gpg-checks \
--non-interactive \
--xml \
install \
@@ -146,7 +163,7 @@ zypper \
(if verbose then "--verbose --verbose" else "--quiet")
(match packager_config with None -> ""
| Some filename -> sprintf "--config %s" filename)
- tmpdir tmpdir (String.concat " " (List.map Filename.quote names)) in
+ tmpdir repos_dir tmpdir (String.concat " " (List.map Filename.quote names)) in
let pkg_names = run_command_get_lines cmd in
(* Return list of package names, remove empty lines. *)
11 years, 6 months