[Libguestfs] [PATCH] customize, sysprep, v2v: handle Kali Linux as Debian

Richard W.M. Jones rjones at redhat.com
Mon Feb 12 13:23:25 UTC 2018


On Mon, Feb 12, 2018 at 02:18:03PM +0100, Pino Toscano wrote:
> Kali Linux is a Debian derivative, so add basic support for it by using
> most of the Debian code paths.  The only exception is the crypto
> algorithm for passwords in passwd, which is always assumed as SHA512
> (as Kali Linux is relatively new).
> ---
>  customize/firstboot.ml                 | 2 +-
>  customize/hostname.ml                  | 2 +-
>  customize/password.ml                  | 2 +-
>  customize/random_seed.ml               | 2 +-
>  sysprep/sysprep_operation_pacct_log.ml | 2 +-
>  v2v/convert_linux.ml                   | 4 ++--
>  v2v/convert_linux.mli                  | 4 ++--
>  7 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/customize/firstboot.ml b/customize/firstboot.ml
> index a37c872c7..1140d73a5 100644
> --- a/customize/firstboot.ml
> +++ b/customize/firstboot.ml
> @@ -158,7 +158,7 @@ WantedBy=%s
>        install_sysvinit_redhat g
>      | "opensuse"|"sles"|"suse-based" ->
>        install_sysvinit_suse g
> -    | "debian" ->
> +    | ("debian"|"kalilinux") ->
>        install_sysvinit_debian g;
>        if major <= 7 then try_update_rc_d g root
>      | "ubuntu" ->
> diff --git a/customize/hostname.ml b/customize/hostname.ml
> index 745e43ab6..88fcc0ca4 100644
> --- a/customize/hostname.ml
> +++ b/customize/hostname.ml
> @@ -42,7 +42,7 @@ let rec set_hostname (g : Guestfs.guestfs) root hostname =
>      update_etc_machine_info g hostname;
>      true
>  
> -  | "linux", ("debian"|"ubuntu"), _ ->
> +  | "linux", ("debian"|"ubuntu"|"kalilinux"), _ ->
>      let old_hostname = read_etc_hostname g in
>      update_etc_hostname g hostname;
>      replace_host_in_etc_hosts g old_hostname hostname;
> diff --git a/customize/password.ml b/customize/password.ml
> index 2d737bf08..489096aeb 100644
> --- a/customize/password.ml
> +++ b/customize/password.ml
> @@ -165,7 +165,7 @@ and default_crypto g root =
>    | ("opensuse"|"sles"), _ -> `MD5
>  
>    (* Rolling distributions, which hopefully should be updated enough. *)
> -  | ("archlinux"|"voidlinux"), _ -> `SHA512
> +  | ("archlinux"|"voidlinux"|"kalilinux"), _ -> `SHA512
>  
>    | _, _ ->
>      let minor = g#inspect_get_minor_version root in
> diff --git a/customize/random_seed.ml b/customize/random_seed.ml
> index 90001a728..7aea6851e 100644
> --- a/customize/random_seed.ml
> +++ b/customize/random_seed.ml
> @@ -49,7 +49,7 @@ let rec set_random_seed (g : Guestfs.guestfs) root =
>        match typ, distro with
>        | "linux", ("fedora"|"rhel"|"centos"|"scientificlinux"|"oraclelinux"|"redhat-based") ->
>          Some "/var/lib/random-seed"
> -      | "linux", ("debian"|"ubuntu") ->
> +      | "linux", ("debian"|"ubuntu"|"kalilinux") ->
>          Some "/var/lib/urandom/random-seed"
>        | "linux", ("opensuse"|"sles"|"suse-based") ->
>          Some "/var/lib/misc/random-seed"
> diff --git a/sysprep/sysprep_operation_pacct_log.ml b/sysprep/sysprep_operation_pacct_log.ml
> index 047cb39f3..7c734a493 100644
> --- a/sysprep/sysprep_operation_pacct_log.ml
> +++ b/sysprep/sysprep_operation_pacct_log.ml
> @@ -36,7 +36,7 @@ let pacct_log_perform (g : Guestfs.guestfs) root side_effects =
>         side_effects#created_file ()
>       with G.Error _ -> ())
>  
> -  | "linux", ("debian"|"ubuntu") ->
> +  | "linux", ("debian"|"ubuntu"|"kalilinux") ->
>      let files = g#glob_expand "/var/log/account/pacct*" in
>      Array.iter (
>        fun file ->
> diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
> index c4625e8f8..b273785e6 100644
> --- a/v2v/convert_linux.ml
> +++ b/v2v/convert_linux.ml
> @@ -52,7 +52,7 @@ let convert (g : G.guestfs) inspect source output rcaps =
>      | "rhel" | "centos" | "scientificlinux" | "redhat-based"
>      | "oraclelinux" -> `RHEL_family
>      | "sles" | "suse-based" | "opensuse" -> `SUSE_family
> -    | "debian" | "ubuntu" | "linuxmint" -> `Debian_family
> +    | "debian" | "ubuntu" | "linuxmint" | "kalilinux" -> `Debian_family
>      | _ -> assert false in
>  
>    assert (inspect.i_package_format = "rpm" || inspect.i_package_format = "deb");
> @@ -1062,7 +1062,7 @@ let () =
>                      | "rhel" | "centos" | "scientificlinux" | "redhat-based"
>                      | "oraclelinux"
>                      | "sles" | "suse-based" | "opensuse"
> -                    | "debian" | "ubuntu" | "linuxmint") } -> true
> +                    | "debian" | "ubuntu" | "linuxmint" | "kalilinux") } -> true
>      | _ -> false
>    in
>    Modules_list.register_convert_module matching "linux" convert
> diff --git a/v2v/convert_linux.mli b/v2v/convert_linux.mli
> index cc767033b..6abba4deb 100644
> --- a/v2v/convert_linux.mli
> +++ b/v2v/convert_linux.mli
> @@ -19,8 +19,8 @@
>  (** Convert a Linux guest to run on KVM.
>  
>      This module converts certain Enterprise Linux guests to run on
> -    KVM.  RHEL, SuSE, Fedora, CentOS, OracleLinux, Debian, Ubuntu
> -    and Mint are supported by this module.
> +    KVM.  RHEL, SuSE, Fedora, CentOS, OracleLinux, Debian, Ubuntu,
> +    Mint and Kali are supported by this module.
>  
>      No functions are exported.  When the module is linked to virt-v2v
>      it registers itself with
> -- 
> 2.14.3

ACK series.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list