Pino Toscano
2018-Feb-12 12:57 UTC
[Libguestfs] [PATCH] inspect: recognize the Kali Linux distribution (RHBZ#1544227)
Read the information from os-release, and make it behave like a Debian distribution (i.e. using dpkg, and apt). --- daemon/inspect_fs.ml | 2 ++ daemon/inspect_fs_unix.ml | 1 + daemon/inspect_types.ml | 2 ++ daemon/inspect_types.mli | 1 + generator/actions_inspection.ml | 4 ++++ 5 files changed, 10 insertions(+) diff --git a/daemon/inspect_fs.ml b/daemon/inspect_fs.ml index 2db218bb2..383e3e0a7 100644 --- a/daemon/inspect_fs.ml +++ b/daemon/inspect_fs.ml @@ -275,6 +275,7 @@ and check_package_format { distro } | Some DISTRO_SUSE_BASED -> Some PACKAGE_FORMAT_RPM | Some DISTRO_DEBIAN + | Some DISTRO_KALI_LINUX | Some DISTRO_LINUX_MINT | Some DISTRO_UBUNTU -> Some PACKAGE_FORMAT_DEB @@ -344,6 +345,7 @@ and check_package_management { distro; version } | Some DISTRO_ALTLINUX | Some DISTRO_DEBIAN + | Some DISTRO_KALI_LINUX | Some DISTRO_LINUX_MINT | Some DISTRO_UBUNTU -> Some PACKAGE_MANAGEMENT_APT diff --git a/daemon/inspect_fs_unix.ml b/daemon/inspect_fs_unix.ml index d0323af3f..53c86e878 100644 --- a/daemon/inspect_fs_unix.ml +++ b/daemon/inspect_fs_unix.ml @@ -140,6 +140,7 @@ and distro_of_os_release_id = function | "debian" -> Some DISTRO_DEBIAN | "fedora" -> Some DISTRO_FEDORA | "frugalware" -> Some DISTRO_FRUGALWARE + | "kali" -> Some DISTRO_KALI_LINUX | "mageia" -> Some DISTRO_MAGEIA | "neokylin" -> Some DISTRO_NEOKYLIN | "opensuse" -> Some DISTRO_OPENSUSE diff --git a/daemon/inspect_types.ml b/daemon/inspect_types.ml index 464b8c2a6..70b34c51c 100644 --- a/daemon/inspect_types.ml +++ b/daemon/inspect_types.ml @@ -78,6 +78,7 @@ and distro | DISTRO_FREEDOS | DISTRO_FRUGALWARE | DISTRO_GENTOO + | DISTRO_KALI_LINUX | DISTRO_LINUX_MINT | DISTRO_MAGEIA | DISTRO_MANDRIVA @@ -208,6 +209,7 @@ and string_of_distro = function | DISTRO_FREEDOS -> "freedos" | DISTRO_FRUGALWARE -> "frugalware" | DISTRO_GENTOO -> "gentoo" + | DISTRO_KALI_LINUX -> "kalilinux" | DISTRO_LINUX_MINT -> "linuxmint" | DISTRO_MAGEIA -> "mageia" | DISTRO_MANDRIVA -> "mandriva" diff --git a/daemon/inspect_types.mli b/daemon/inspect_types.mli index 78051b510..7493aa3a6 100644 --- a/daemon/inspect_types.mli +++ b/daemon/inspect_types.mli @@ -85,6 +85,7 @@ and distro | DISTRO_FREEDOS | DISTRO_FRUGALWARE | DISTRO_GENTOO + | DISTRO_KALI_LINUX | DISTRO_LINUX_MINT | DISTRO_MAGEIA | DISTRO_MANDRIVA diff --git a/generator/actions_inspection.ml b/generator/actions_inspection.ml index 0ac282435..d8cf571c9 100644 --- a/generator/actions_inspection.ml +++ b/generator/actions_inspection.ml @@ -210,6 +210,10 @@ Frugalware. Gentoo. +=item \"kalilinux\" + +Kali Linux. + =item \"linuxmint\" Linux Mint. -- 2.14.3
Pino Toscano
2018-Feb-12 13:18 UTC
[Libguestfs] [PATCH] customize, sysprep, v2v: handle Kali Linux as Debian
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
Richard W.M. Jones
2018-Feb-12 13:23 UTC
Re: [Libguestfs] [PATCH] customize, sysprep, v2v: handle Kali Linux as Debian
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.3ACK 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