diff --git a/0000-hotfix.patch b/0000-hotfix.patch index 839636c..bc10c38 100644 --- a/0000-hotfix.patch +++ b/0000-hotfix.patch @@ -1,208 +1,1276 @@ -From c977e24dec46803fe691f5da35756523e6356473 Mon Sep 17 00:00:00 2001 -From: Olaf Hering -Date: Tue, 13 May 2014 15:31:21 +0200 -Subject: hotfix - -Signed-off-by: Olaf Hering ---- - pkg-hotfix.txt | 1 + - 1 file changed, 1 insertion(+) - create mode 100644 pkg-hotfix.txt - -Index: libguestfs-1.26.10/pkg-hotfix.txt +Index: libguestfs-1.32.4/fish/options.c +=================================================================== +--- libguestfs-1.32.4.orig/fish/options.c ++++ libguestfs-1.32.4/fish/options.c +@@ -280,7 +280,33 @@ display_mountpoints_on_failure (const ch + guestfs_int_program_name); + + for (i = 0; fses[i] != NULL; i += 2) { +- CLEANUP_FREE char *p = guestfs_canonical_device_name (g, fses[i]); ++ CLEANUP_FREE char *p = NULL; ++ CLEANUP_FREE char *device = guestfs_mountable_device (g, fses[i]); ++ CLEANUP_FREE char *subvolume = NULL; ++ ++ guestfs_push_error_handler (g, NULL, NULL); ++ ++ subvolume = guestfs_mountable_subvolume (g, fses[i]); ++ if (subvolume == NULL && guestfs_last_errno (g) != EINVAL) { ++ fprintf (stderr, ++ _("%s: cannot determine the subvolume for %s: %s (%d)\n"), ++ guestfs_int_program_name, fses[i], ++ guestfs_last_error (g), guestfs_last_errno (g)); ++ exit (EXIT_FAILURE); ++ } ++ ++ guestfs_pop_error_handler (g); ++ ++ /* Reformat the internal btrfsvol string into a valid mount option */ ++ if (device && subvolume) { ++ if (asprintf (&p, "%s:/:subvol=%s", device, subvolume) == -1) { ++ perror ("asprintf"); ++ exit (EXIT_FAILURE); ++ } ++ } else { ++ p = guestfs_canonical_device_name (g, fses[i]); ++ } ++ + fprintf (stderr, "%s: \t%s (%s)\n", guestfs_int_program_name, + p ? p : fses[i], fses[i+1]); + } +Index: libguestfs-1.32.4/generator/actions.ml +=================================================================== +--- libguestfs-1.32.4.orig/generator/actions.ml ++++ libguestfs-1.32.4/generator/actions.ml +@@ -1290,6 +1290,32 @@ Please read L for + See also C." }; + + { defaults with ++ name = "mountable_device"; added = (1, 33, 15); ++ style = RString "device", [Mountable "mountable"], []; ++ shortdesc = "extract the device part of a mountable"; ++ longdesc = "\ ++Returns the device name of a mountable. In quite a lot of ++cases, the mountable is the device name. ++ ++However this doesn't apply for btrfs subvolumes, where the ++mountable is a combination of both the device name and the ++subvolume path (see also C to ++extract the subvolume path of the mountable if any)." }; ++ ++ { defaults with ++ name = "mountable_subvolume"; added = (1, 33, 15); ++ style = RString "subvolume", [Mountable "mountable"], []; ++ shortdesc = "extract the subvolume part of a mountable"; ++ longdesc = "\ ++Returns the subvolume path of a mountable. Btrfs subvolumes ++mountables are a combination of both the device name and the ++subvolume path (see also C to extract ++the device of the mountable). ++ ++If the mountable does not represent a btrfs subvolume, then ++this function fails and the C is set to C." }; ++ ++ { defaults with + name = "set_network"; added = (1, 5, 4); + style = RErr, [Bool "network"], []; + fish_alias = ["network"]; config_only = true; +Index: libguestfs-1.32.4/po/POTFILES +=================================================================== +--- libguestfs-1.32.4.orig/po/POTFILES ++++ libguestfs-1.32.4/po/POTFILES +@@ -344,6 +344,7 @@ src/libvirt-is-version.c + src/listfs.c + src/lpj.c + src/match.c ++src/mountable.c + src/osinfo.c + src/private-data.c + src/proto.c +Index: libguestfs-1.32.4/src/Makefile.am +=================================================================== +--- libguestfs-1.32.4.orig/src/Makefile.am ++++ libguestfs-1.32.4/src/Makefile.am +@@ -121,6 +121,7 @@ libguestfs_la_SOURCES = \ + listfs.c \ + lpj.c \ + match.c \ ++ mountable.c \ + osinfo.c \ + private-data.c \ + proto.c \ +Index: libguestfs-1.32.4/src/mountable.c =================================================================== --- /dev/null -+++ libguestfs-1.26.10/pkg-hotfix.txt -@@ -0,0 +1 @@ ++++ libguestfs-1.32.4/src/mountable.c +@@ -0,0 +1,52 @@ ++/* libguestfs ++ * Copyright (C) 2016 SUSE LLC ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ + -Index: libguestfs-1.26.10/daemon/btrfs.c ++#include ++#include ++#include ++ ++#include "guestfs.h" ++#include "guestfs-internal.h" ++#include "guestfs-internal-actions.h" ++ ++ ++char * ++guestfs_impl_mountable_device (guestfs_h *g, const char *mountable) ++{ ++ CLEANUP_FREE_INTERNAL_MOUNTABLE struct guestfs_internal_mountable *mnt = NULL; ++ ++ mnt = guestfs_internal_parse_mountable (g, mountable); ++ if (mnt == NULL) ++ return NULL; ++ ++ return safe_strdup (g, mnt->im_device); ++} ++ ++char * ++guestfs_impl_mountable_subvolume (guestfs_h *g, const char *mountable) ++{ ++ CLEANUP_FREE_INTERNAL_MOUNTABLE struct guestfs_internal_mountable *mnt = NULL; ++ ++ mnt = guestfs_internal_parse_mountable (g, mountable); ++ if (mnt == NULL || STREQ (mnt->im_volume, "")) { ++ guestfs_int_error_errno (g, EINVAL, "not a btrfs subvolume identifier"); ++ return NULL; ++ } ++ ++ return safe_strdup (g, mnt->im_volume); ++} +Index: libguestfs-1.32.4/v2v/windows_virtio.ml =================================================================== ---- libguestfs-1.26.10.orig/daemon/btrfs.c -+++ libguestfs-1.26.10/daemon/btrfs.c -@@ -356,6 +356,7 @@ do_btrfs_subvolume_list (const mountable - ADD_ARG (argv, i, str_btrfs); - ADD_ARG (argv, i, "subvolume"); - ADD_ARG (argv, i, "list"); -+ ADD_ARG (argv, i, "-o"); - ADD_ARG (argv, i, fs_buf); - ADD_ARG (argv, i, NULL); +--- libguestfs-1.32.4.orig/v2v/windows_virtio.ml ++++ libguestfs-1.32.4/v2v/windows_virtio.ml +@@ -26,6 +26,10 @@ open Regedit + open Types + open Utils -Index: libguestfs-1.26.10/customize/customize_run.ml ++let scsi_class_guid = "{4D36E97B-E325-11CE-BFC1-08002BE10318}" ++let viostor_pciid = "VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00" ++let vioscsi_pciid = "VEN_1AF4&DEV_1004&SUBSYS_00081AF4&REV_00" ++ + let virtio_win = + try Sys.getenv "VIRTIO_WIN" + with Not_found -> +@@ -47,14 +51,26 @@ let rec install_drivers g inspect system + else ( + (* Can we install the block driver? *) + let block : guestcaps_block_type = +- let source = driverdir // "viostor.sys" in +- if g#exists source then ( +- let target = sprintf "%s/system32/drivers/viostor.sys" systemroot in ++ let filenames = ["virtio_blk"; "vrtioblk"; "viostor"] in ++ let viostor_driver = try ( ++ Some ( ++ List.find ( ++ fun driver_file -> ++ let source = driverdir // driver_file ^ ".sys" in ++ g#exists source ++ ) filenames ++ ) ++ ) with Not_found -> None in ++ match viostor_driver with ++ | Some driver_name -> ( ++ let source = driverdir // (driver_name ^ ".sys") in ++ let target = sprintf "%s/system32/drivers/%s.sys" systemroot driver_name in + let target = g#case_sensitive_path target in + g#cp source target; +- add_viostor_to_registry g inspect root current_cs; +- Virtio_blk +- ) else ( ++ add_guestor_to_registry g root current_cs driver_name ++ viostor_pciid; ++ Virtio_blk ) ++ | None -> ( + warning (f_"there is no viostor (virtio block device) driver for this version of Windows (%d.%d %s). virt-v2v looks for this driver in %s\n\nThe guest will be configured to use a slower emulated device.") + inspect.i_major_version inspect.i_minor_version + inspect.i_arch virtio_win; +@@ -63,7 +79,12 @@ let rec install_drivers g inspect system + + (* Can we install the virtio-net driver? *) + let net : guestcaps_net_type = +- if not (g#exists (driverdir // "netkvm.inf")) then ( ++ let filenames = ["virtio_net.inf"; "netkvm.inf"] in ++ let has_netkvm = ++ List.exists ( ++ fun driver_file -> g#exists (driverdir // driver_file) ++ ) filenames in ++ if not has_netkvm then ( + warning (f_"there is no virtio network driver for this version of Windows (%d.%d %s). virt-v2v looks for this driver in %s\n\nThe guest will be configured to use a slower emulated device.") + inspect.i_major_version inspect.i_minor_version + inspect.i_arch virtio_win; +@@ -88,270 +109,66 @@ let rec install_drivers g inspect system + (block, net, video) + ) + +-and add_viostor_to_registry g inspect root current_cs = +- let { i_major_version = major; i_minor_version = minor; +- i_arch = arch } = inspect in +- if (major == 6 && minor >= 2) || major >= 7 then (* Windows >= 8 *) +- add_viostor_to_driver_database g root arch current_cs +- else (* Windows <= 7 *) +- add_viostor_to_critical_device_database g root current_cs +- +-and add_viostor_to_critical_device_database g root current_cs = +- (* See http://rwmj.wordpress.com/2010/04/30/tip-install-a-device-driver-in-a-windows-vm/ +- * NB: All these edits are in the HKLM\SYSTEM hive. No other +- * hive may be modified here. +- *) +- let regedits = [ +- [ current_cs; "Control"; "CriticalDeviceDatabase"; "pci#ven_1af4&dev_1001&subsys_00000000" ], +- [ "Service", REG_SZ "viostor"; +- "ClassGUID", REG_SZ "{4D36E97B-E325-11CE-BFC1-08002BE10318}" ]; +- +- [ current_cs; "Control"; "CriticalDeviceDatabase"; "pci#ven_1af4&dev_1001&subsys_00020000" ], +- [ "Service", REG_SZ "viostor"; +- "ClassGUID", REG_SZ "{4D36E97B-E325-11CE-BFC1-08002BE10318}" ]; +- +- [ current_cs; "Control"; "CriticalDeviceDatabase"; "pci#ven_1af4&dev_1001&subsys_00021af4" ], +- [ "Service", REG_SZ "viostor"; +- "ClassGUID", REG_SZ "{4D36E97B-E325-11CE-BFC1-08002BE10318}" ]; +- +- [ current_cs; "Control"; "CriticalDeviceDatabase"; "pci#ven_1af4&dev_1001&subsys_00021af4&rev_00" ], +- [ "Service", REG_SZ "viostor"; +- "ClassGUID", REG_SZ "{4D36E97B-E325-11CE-BFC1-08002BE10318}" ]; ++and add_guestor_to_registry g root current_cs drv_name drv_pciid = ++ let ddb_node = g#hivex_node_get_child root "DriverDatabase" in + +- [ current_cs; "Services"; "viostor" ], ++ let regedits = ++ if ddb_node = 0L then ++ cdb_regedits current_cs drv_name drv_pciid ++ else ++ ddb_regedits current_cs drv_name drv_pciid in ++ ++ let drv_sys_path = sprintf "system32\\drivers\\%s.sys" drv_name in ++ let common_regedits = [ ++ [ current_cs; "Services"; drv_name ], + [ "Type", REG_DWORD 0x1_l; + "Start", REG_DWORD 0x0_l; + "Group", REG_SZ "SCSI miniport"; + "ErrorControl", REG_DWORD 0x1_l; +- "ImagePath", REG_EXPAND_SZ "system32\\drivers\\viostor.sys"; +- "Tag", REG_DWORD 0x21_l ]; +- +- [ current_cs; "Services"; "viostor"; "Parameters" ], +- [ "BusType", REG_DWORD 0x1_l ]; ++ "ImagePath", REG_EXPAND_SZ drv_sys_path ]; ++ ] in + +- [ current_cs; "Services"; "viostor"; "Parameters"; "MaxTransferSize" ], +- [ "ParamDesc", REG_SZ "Maximum Transfer Size"; +- "type", REG_SZ "enum"; +- "default", REG_SZ "0" ]; +- +- [ current_cs; "Services"; "viostor"; "Parameters"; "MaxTransferSize"; "enum" ], +- [ "0", REG_SZ "64 KB"; +- "1", REG_SZ "128 KB"; +- "2", REG_SZ "256 KB" ]; +- +- [ current_cs; "Services"; "viostor"; "Parameters"; "PnpInterface" ], +- [ "5", REG_DWORD 0x1_l ]; +- +- [ current_cs; "Services"; "viostor"; "Enum" ], +- [ "0", REG_SZ "PCI\\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00\\3&13c0b0c5&0&20"; +- "Count", REG_DWORD 0x1_l; +- "NextInstance", REG_DWORD 0x1_l ]; +- ] in ++ reg_import g root (regedits @ common_regedits) + +- reg_import g root regedits ++and cdb_regedits current_cs drv_name drv_pciid = ++ (* See http://rwmj.wordpress.com/2010/04/30/tip-install-a-device-driver-in-a-windows-vm/ ++ * NB: All these edits are in the HKLM\SYSTEM hive. No other ++ * hive may be modified here. ++ *) ++ [ ++ [ current_cs; "Control"; "CriticalDeviceDatabase"; ++ "PCI#" ^ drv_pciid ], ++ [ "Service", REG_SZ drv_name; ++ "ClassGUID", REG_SZ scsi_class_guid ]; ++ ] + +-and add_viostor_to_driver_database g root arch current_cs = ++and ddb_regedits current_cs drv_name drv_pciid = + (* Windows >= 8 doesn't use the CriticalDeviceDatabase. Instead + * one must add keys into the DriverDatabase. + *) + +- let viostor_inf = +- let arch = +- match arch with +- | "x86_64" -> "amd64" +- | "i386" | "i486" | "i585" | "i686" -> "x86" +- | _ -> +- error (f_"when adding viostor to the DriverDatabase, unknown architecture: %s") arch in +- (* XXX I don't know what the significance of the c863.. string is. It +- * may even be random. +- *) +- sprintf "viostor.inf_%s_%s" arch "c86329aaeb0a7904" in +- +- let scsi_adapter_guid = "{4d36e97b-e325-11ce-bfc1-08002be10318}" in +- (* There should be a key +- * HKLM\SYSTEM\DriverDatabase\DeviceIds\ +- * We want to add: +- * "oem1.inf"=hex(0): +- * but if we find "oem1.inf" we'll add "oem2.inf" (etc). +- *) +- let oem_inf = +- let path = [ "DriverDatabase"; "DeviceIds"; scsi_adapter_guid ] in +- match Windows.get_node g root path with +- | None -> +- error (f_"cannot find HKLM\\SYSTEM\\DriverDatabase\\DeviceIds\\%s in the guest registry") scsi_adapter_guid +- | Some node -> +- let rec loop node i = +- let oem_inf = sprintf "oem%d.inf" i in +- let value = g#hivex_node_get_value node oem_inf in +- if value = 0_L then oem_inf else loop node (i+1) +- in +- let oem_inf = loop node 1 in +- (* Create the key. *) +- g#hivex_node_set_value node oem_inf (* REG_NONE *) 0_L ""; +- oem_inf in +- +- (* There should be a key +- * HKLM\SYSTEM\ControlSet001\Control\Class\ +- * There may be subkey(s) of this called "0000", "0001" etc. We want +- * to create the next free subkey. MSFT covers the key here: +- * https://technet.microsoft.com/en-us/library/cc957341.aspx +- * That page incorrectly states that the key has the form "000n". +- * In fact we observed from real registries that the key is a +- * decimal number that goes 0009 -> 0010 etc. +- *) +- let controller_path = +- [ current_cs; "Control"; "Class"; scsi_adapter_guid ] in +- let controller_offset = +- match Windows.get_node g root controller_path with +- | None -> +- error (f_"cannot find HKLM\\SYSTEM\\%s in the guest registry") +- (String.concat "\\" controller_path) +- | Some node -> +- let rec loop node i = +- let controller_offset = sprintf "%04d" i in +- let child = g#hivex_node_get_child node controller_offset in +- if child = 0_L then controller_offset else loop node (i+1) +- in +- loop node 0 in +- +- let regedits = [ +- controller_path @ [ controller_offset ], +- [ "DriverDate", REG_SZ "6-4-2014"; +- "DriverDateData", REG_BINARY "\x00\x40\x90\xed\x87\x7f\xcf\x01"; +- "DriverDesc", REG_SZ "Red Hat VirtIO SCSI controller"; +- "DriverVersion", REG_SZ "62.71.104.8600" (* XXX *); +- "InfPath", REG_SZ oem_inf; +- "InfSection", REG_SZ "rhelscsi_inst"; +- "MatchingDeviceId", REG_SZ "PCI\\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00"; +- "ProviderName", REG_SZ "Red Hat, Inc." ]; +- +- [ current_cs; "Enum"; "PCI"; "VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00\\3&13c0b0c5&0&38" ], +- [ "Capabilities", REG_DWORD 0x6_l; +- "ClassGUID", REG_SZ scsi_adapter_guid; +- "CompatibleIDs", REG_MULTI_SZ [ +- "PCI\\VEN_1AF4&DEV_1001&REV_00"; +- "PCI\\VEN_1AF4&DEV_1001"; +- "PCI\\VEN_1AF4&CC_010000"; +- "PCI\\VEN_1AF4&CC_0100"; +- "PCI\\VEN_1AF4"; +- "PCI\\CC_010000"; +- "PCI\\CC_0100"; +- ]; +- "ConfigFlags", REG_DWORD 0_l; +- "ContainerID", REG_SZ "{00000000-0000-0000-ffff-ffffffffffff}"; +- "DeviceDesc", REG_SZ (sprintf "@%s,%%rhelscsi.devicedesc%%;Red Hat VirtIO SCSI controller" oem_inf); +- "Driver", REG_SZ (sprintf "%s\\%s" scsi_adapter_guid controller_offset); +- "HardwareID", REG_MULTI_SZ [ +- "PCI\\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00"; +- "PCI\\VEN_1AF4&DEV_1001&SUBSYS_00021AF4"; +- "PCI\\VEN_1AF4&DEV_1001&CC_010000"; +- "PCI\\VEN_1AF4&DEV_1001&CC_0100"; +- ]; +- "LocationInformation", REG_SZ "@System32\\drivers\\pci.sys,#65536;PCI bus %1, device %2, function %3;(0,7,0)"; +- "Mfg", REG_SZ (sprintf "@%s,%%rhel%%;Red Hat, Inc." oem_inf); +- "ParentIdPrefix", REG_SZ "4&87f7bfb&0"; +- "Service", REG_SZ "viostor"; +- "UINumber", REG_DWORD 0x7_l ]; +- +- [ current_cs; "Services"; "viostor" ], +- [ "ErrorControl", REG_DWORD 0x1_l; +- "Group", REG_SZ "SCSI miniport"; +- "ImagePath", REG_EXPAND_SZ "system32\\drivers\\viostor.sys"; +- "Owners", REG_MULTI_SZ [ oem_inf ]; +- "Start", REG_DWORD 0x0_l; +- "Tag", REG_DWORD 0x58_l; +- "Type", REG_DWORD 0x1_l ]; +- +- [ current_cs; "Services"; "viostor"; "Parameters" ], +- [ "BusType", REG_DWORD 0x1_l ]; +- +- [ current_cs; "Services"; "viostor"; "Parameters"; "PnpInterface" ], +- [ "5", REG_DWORD 0x1_l ]; +- +- [ "DriverDatabase"; "DriverInfFiles"; oem_inf ], +- [ "", REG_MULTI_SZ [ viostor_inf ]; +- "Active", REG_SZ viostor_inf; +- "Configurations", REG_MULTI_SZ [ "rhelscsi_inst" ] +- ]; +- +- [ "DriverDatabase"; "DeviceIds"; "PCI"; "VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00" ], +- [ oem_inf, REG_BINARY "\x01\xff\x00\x00" ]; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf ], +- [ "", REG_SZ oem_inf; +- "F6", REG_DWORD 0x1_l; +- "InfName", REG_SZ "viostor.inf"; +- "OemPath", REG_SZ ("X:\\windows\\System32\\DriverStore\\FileRepository\\" ^ viostor_inf); +- "Provider", REG_SZ "Red Hat, Inc."; +- "SignerName", REG_SZ "Microsoft Windows Hardware Compatibility Publisher"; +- "SignerScore", REG_DWORD 0x0d000005_l; +- "StatusFlags", REG_DWORD 0x00000012_l; +- (* NB: scsi_adapter_guid appears inside this string. *) +- "Version", REG_BINARY "\x00\xff\x09\x00\x00\x00\x00\x00\x7b\xe9\x36\x4d\x25\xe3\xce\x11\xbf\xc1\x08\x00\x2b\xe1\x03\x18\x00\x40\x90\xed\x87\x7f\xcf\x01\x98\x21\x68\x00\x47\x00\x3e\x00\x00\x00\x00\x00\x00\x00\x00\x00" ]; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Configurations" ], +- []; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Configurations"; "rhelscsi_inst" ], +- [ "ConfigFlags", REG_DWORD 0_l; +- "Service", REG_SZ "viostor" ]; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Configurations"; "rhelscsi_inst"; "Device" ], +- []; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Configurations"; "rhelscsi_inst"; "Device"; "Interrupt Management" ], +- []; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Configurations"; "rhelscsi_inst"; "Device"; "Interrupt Management"; "Affinity Policy" ], +- [ "DevicePolicy", REG_DWORD 0x00000005_l ]; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Configurations"; "rhelscsi_inst"; "Device"; "Interrupt Management"; "MessageSignaledInterruptProperties" ], +- [ "MSISupported", REG_DWORD 0x00000001_l; +- "MessageNumberLimit", REG_DWORD 0x00000002_l ]; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Configurations"; "rhelscsi_inst"; "Services" ], +- []; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Configurations"; "rhelscsi_inst"; "Services"; "viostor" ], +- []; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Configurations"; "rhelscsi_inst"; "Services"; "viostor"; "Parameters" ], +- [ "BusType", REG_DWORD 0x00000001_l ]; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Configurations"; "rhelscsi_inst"; "Services"; "viostor"; "Parameters"; "PnpInterface" ], +- [ "5", REG_DWORD 0x00000001_l ]; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Descriptors" ], +- []; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Descriptors"; "PCI" ], +- []; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Descriptors"; "PCI"; "VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00" ], +- [ "Configuration", REG_SZ "rhelscsi_inst"; +- "Description", REG_SZ "%rhelscsi.devicedesc%"; +- "Manufacturer", REG_SZ "%rhel%" ]; +- +- [ "DriverDatabase"; "DriverPackages"; viostor_inf; "Strings" ], +- [ "rhel", REG_SZ "Red Hat, Inc."; +- "rhelscsi.devicedesc", REG_SZ "Red Hat VirtIO SCSI controller" ]; +- ] in +- +- reg_import g root regedits; +- +-(* +- A few more keys which we don't add above. Note that "oem1.inf" == +- 6f,00,65,00,6d,00,31,00,2e,00,69,00,6e,00,66,00. +- +- [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\PCI\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00\3&13c0b0c5&0&38\Properties\{540b947e-8b40-45bc-a8a2-6a0b894cbda2}\0007] +- @=hex(ffff0012):6f,00,65,00,6d,00,31,00,2e,00,69,00,6e,00,66,00,3a,00,50,00,43,00,49,00,5c,00,56,00,45,00,4e,00,5f,00,31,00,41,00,46,00,34,00,26,00,44,00,45,00,56,00,5f,00,31,00,30,00,30,00,31,00,26,00,53,00,55,00,42,00,53,00,59,00,53,00,5f,00,30,00,30,00,30,00,32,00,31,00,41,00,46,00,34,00,26,00,52,00,45,00,56,00,5f,00,30,00,30,00,2c,00,72,00,68,00,65,00,6c,00,73,00,63,00,73,00,69,00,5f,00,69,00,6e,00,73,00,74,00,00,00 +- +- [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\PCI\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00\3&13c0b0c5&0&38\Properties\{83da6326-97a6-4088-9453-a1923f573b29}\0003] +- @=hex(ffff0012):6f,00,65,00,6d,00,31,00,2e,00,69,00,6e,00,66,00,3a,00,32,00,65,00,35,00,31,00,37,00,32,00,63,00,33,00,62,00,33,00,37,00,62,00,65,00,39,00,39,00,38,00,3a,00,72,00,68,00,65,00,6c,00,73,00,63,00,73,00,69,00,5f,00,69,00,6e,00,73,00,74,00,3a,00,36,00,32,00,2e,00,37,00,31,00,2e,00,31,00,30,00,34,00,2e,00,38,00,36,00,30,00,30,00,3a,00,50,00,43,00,49,00,5c,00,56,00,45,00,4e,00,5f,00,31,00,41,00,46,00,34,00,26,00,44,00,45,00,56,00,5f,00,31,00,30,00,30,00,31,00,26,00,53,00,55,00,42,00,53,00,59,00,53,00,5f,00,30,00,30,00,30,00,32,00,31,00,41,00,46,00,34,00,26,00,52,00,45,00,56,00,5f,00,30,00,30,00,00,00 +- +- [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\PCI\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00\3&13c0b0c5&0&38\Properties\{a8b865dd-2e3d-4094-ad97-e593a70c75d6}\0005] +- @=hex(ffff0012):6f,00,65,00,6d,00,31,00,2e,00,69,00,6e,00,66,00,00,00 +-*) ++ let drv_inf = "guestor.inf" in ++ let drv_inf_label = drv_inf ^ "_tmp" in ++ let drv_config = "guestor_conf" in ++ ++ [ ++ [ "DriverDatabase"; "DriverInfFiles"; drv_inf ], ++ [ "", REG_MULTI_SZ [ drv_inf_label ]; ++ "Active", REG_SZ drv_inf_label; ++ "Configurations", REG_MULTI_SZ [ drv_config ] ]; ++ ++ [ "DriverDatabase"; "DeviceIds"; "PCI"; drv_pciid ], ++ [ drv_inf, REG_BINARY "\x01\xff\x00\x00" ]; ++ ++ [ "DriverDatabase"; "DriverPackages"; drv_inf_label; ++ "Configurations"; drv_config ], ++ [ "ConfigFlags", REG_DWORD 0_l; ++ "Service", REG_SZ drv_name ]; ++ ++ [ "DriverDatabase"; "DriverPackages"; drv_inf_label; ++ "Descriptors"; "PCI"; drv_pciid ], ++ [ "Configuration", REG_SZ drv_config ]; ++ ] + + (* Copy the matching drivers to the driverdir; return true if any have + * been copied. +@@ -359,7 +176,7 @@ and add_viostor_to_driver_database g roo + and copy_drivers g inspect driverdir = + let ret = ref false in + if is_directory virtio_win then ( +- let cmd = sprintf "cd %s && find -type f" (quote virtio_win) in ++ let cmd = sprintf "cd %s && find -L -type f" (quote virtio_win) in + let paths = external_command cmd in + List.iter ( + fun path -> +Index: libguestfs-1.32.4/appliance/init =================================================================== ---- libguestfs-1.26.10.orig/customize/customize_run.ml -+++ libguestfs-1.26.10/customize/customize_run.ml -@@ -103,10 +103,11 @@ exec >>%s 2>&1 - | "urpmi" -> - sprintf "urpmi %s" quoted_args - | "yum" -> -- sprintf "yum -y install %s" quoted_args -+ sprintf " -+ yum -y install %s -+ pkill gpg-agent" quoted_args - | "zypper" -> -- (* XXX Should we use -n option? *) -- sprintf "zypper in %s" quoted_args -+ sprintf "zypper -n in -l %s" quoted_args - | "unknown" -> - eprintf (f_"%s: --install is not supported for this guest operating system\n") - prog; -@@ -135,7 +136,7 @@ exec >>%s 2>&1 - | "yum" -> - sprintf "yum -y update" - | "zypper" -> -- sprintf "zypper update" -+ sprintf "zypper -n update -l" - | "unknown" -> - eprintf (f_"%s: --update is not supported for this guest operating system\n") - prog; -Index: libguestfs-1.26.10/builder/downloader.ml +--- libguestfs-1.32.4.orig/appliance/init ++++ libguestfs-1.32.4/appliance/init +@@ -47,7 +47,9 @@ ln -s ../run/lock /var/lock + + # On Fedora 23, util-linux creates /etc/mtab in %post .. stupid + # and e2fsprogs fails if the link doesn't exist .. stupid stupid +-ln -s /proc/mounts /etc/mtab ++if ! test -e /etc/mtab; then ++ ln -s /proc/mounts /etc/mtab ++fi + + # devtmpfs is required since udev 176 + mount -t devtmpfs /dev /dev +Index: libguestfs-1.32.4/appliance/packagelist.in =================================================================== ---- libguestfs-1.26.10.orig/builder/downloader.ml -+++ libguestfs-1.26.10/builder/downloader.ml -@@ -97,7 +97,7 @@ and download_to ~prog t ?(progress_bar = - ) - | _ -> (* Any other protocol. *) - (* Get the status code first to ensure the file exists. *) -- let cmd = sprintf "%s%s -g -o /dev/null -I -w '%%{http_code}' %s" -+ let cmd = sprintf "%s%s -L --max-redirs 5 -g -o /dev/null -I -w '%%{http_code}' %s" - t.curl - (if t.verbose then "" else " -s -S") - (quote uri) in -@@ -122,7 +122,7 @@ and download_to ~prog t ?(progress_bar = - ); - - (* Now download the file. *) -- let cmd = sprintf "%s%s -g -o %s %s" -+ let cmd = sprintf "%s%s -L --max-redirs 5 -g -o %s %s" - t.curl - (if t.verbose then "" else if progress_bar then " -#" else " -s -S") - (quote filename_new) (quote uri) in -Index: libguestfs-1.26.10/builder/Makefile.am +--- libguestfs-1.32.4.orig/appliance/packagelist.in ++++ libguestfs-1.32.4/appliance/packagelist.in +@@ -134,6 +134,7 @@ ifelse(SUSE,1, + btrfsprogs + cryptsetup + dhcpcd ++ dhcp-client + genisoimage + glibc-locale + gptfdisk +@@ -141,9 +142,12 @@ ifelse(SUSE,1, + iproute2 + iputils + libcap2 ++ libhivex0 + libselinux1 + libyajl2 + mkisofs ++ ntfsprogs ++ ntfs-3g + reiserfs + systemd + vim +Index: libguestfs-1.32.4/builder/virt-builder.pod =================================================================== ---- libguestfs-1.26.10.orig/builder/Makefile.am -+++ libguestfs-1.26.10/builder/Makefile.am -@@ -261,7 +261,7 @@ DISTCLEANFILES = .depend - # virt-builder's default repository +--- libguestfs-1.32.4.orig/builder/virt-builder.pod ++++ libguestfs-1.32.4/builder/virt-builder.pod +@@ -839,16 +839,17 @@ F<~root/virt-sysprep-firstboot.log>. + =item Windows - repoconfdir = $(sysconfdir)/xdg/virt-builder/repos.d --repoconf_DATA = libguestfs.conf libguestfs.gpg -+repoconf_DATA = libguestfs.conf libguestfs.gpg opensuse.conf opensuse.gpg + F, available from sources at +-L, is installed to run the ++L, or F, available ++with SUSE VMDP is installed to run the + first boot scripts. It is required, and the setup of first boot + scripts will fail if it is not present. - install-exec-hook: - $(LN_S) xdg/virt-builder $(DESTDIR)$(sysconfdir)/virt-builder -Index: libguestfs-1.26.10/builder/Makefile.in +-F is copied from the location pointed to by the ++F or F is copied from the location pointed to by the + C environment variable; if not set, a compiled-in + default will be used (something like F). + + The output of the first boot scripts is available in the guest as +-F. ++F. + + =back + +@@ -1819,6 +1820,12 @@ I<--firstboot> or I<--firstboot-command> + + See also: C + ++=item F ++ ++This is a Windows binary shipped with SUSE VMDP, used to install a "firstboot" ++script in Windows guests. It is required if you intend to use the ++I<--firstboot> or I<--firstboot-command> options with Windows guests. ++ + =back + + =item C +Index: libguestfs-1.32.4/customize/firstboot.ml =================================================================== ---- libguestfs-1.26.10.orig/builder/Makefile.in -+++ libguestfs-1.26.10/builder/Makefile.in -@@ -1649,7 +1649,7 @@ DISTCLEANFILES = .depend +--- libguestfs-1.32.4.orig/customize/firstboot.ml ++++ libguestfs-1.32.4/customize/firstboot.ml +@@ -185,19 +185,25 @@ module Windows = struct + try Sys.getenv "VIRT_TOOLS_DATA_DIR" + with Not_found -> Guestfs_config.datadir // "virt-tools" in - # virt-builder's default repository - repoconfdir = $(sysconfdir)/xdg/virt-builder/repos.d --repoconf_DATA = libguestfs.conf libguestfs.gpg -+repoconf_DATA = libguestfs.conf libguestfs.gpg opensuse.conf opensuse.gpg - virt_index_validate_SOURCES = \ - index-parse.y \ - index-scan.l \ -Index: libguestfs-1.26.10/builder/opensuse.conf.in +- (* rhsrvany.exe must exist. ++ (* Either rhsrvany.exe or pvvxsvc.exe must exist. + * + * (Check also that it's not a dangling symlink but a real file). + *) +- let rhsrvany_exe = virt_tools_data_dir // "rhsrvany.exe" in +- (try +- let chan = open_in rhsrvany_exe in +- close_in chan +- with +- Sys_error msg -> +- error (f_"'%s' is missing. This file is required in order to install Windows firstboot scripts. You can get it by building rhsrvany (https://github.com/rwmjones/rhsrvany). Original error: %s") +- rhsrvany_exe msg +- ); ++ let services = ["rhsrvany.exe"; "pvvxsvc.exe"] in ++ let srvany = ++ try ++ List.find ( ++ fun service -> ++ try ++ let chan = open_in (virt_tools_data_dir // service) in ++ close_in chan; ++ true ++ with _ -> ++ false ++ ) services ++ with Not_found -> ++ error (f_"One of rhsrvany.exe or pvvxsvc.exe is missing in %s. One of them is required in order to install Windows firstboot scripts. You can get one by building rhsrvany (https://github.com/rwmjones/rhsrvany)") ++ virt_tools_data_dir in + + (* Create a directory for firstboot files in the guest. *) + let firstboot_dir, firstboot_dir_win = +@@ -211,12 +217,12 @@ module Windows = struct + g#mkdir_p firstboot_dir; + loop firstboot_dir firstboot_dir_win path + in +- loop "" "C:" ["Program Files"; "Red Hat"; "Firstboot"] in ++ loop "" "C:" ["Program Files"; "Guestfs"; "Firstboot"] in + + g#mkdir_p (firstboot_dir // "scripts"); + +- (* Copy rhsrvany to the guest. *) +- g#upload rhsrvany_exe (firstboot_dir // "rhsrvany.exe"); ++ (* Copy pvvxsvc or rhsrvany to the guest. *) ++ g#upload (virt_tools_data_dir // srvany) (firstboot_dir // srvany); + + (* Write a firstboot.bat control script which just runs the other + * scripts in the directory. Note we need to use CRLF line endings +@@ -232,7 +238,7 @@ set log=%%firstboot%%\\log.txt + set scripts=%%firstboot%%\\scripts + set scripts_done=%%firstboot%%\\scripts-done + +-call :main > \"%%log%%\" 2>&1 ++call :main >> \"%%log%%\" 2>&1 + exit /b + + :main +@@ -244,17 +250,17 @@ if not exist \"%%scripts_done%%\" ( + + for %%%%f in (\"%%scripts%%\"\\*.bat) do ( + echo running \"%%%%f\" +- call \"%%%%f\" ++ move \"%%%%f\" \"%%scripts_done%%\" ++ pushd \"%%scripts_done%%\" ++ call \"%%%%~nf\" + set elvl=!errorlevel! + echo .... exit code !elvl! +- if !elvl! equ 0 ( +- move \"%%%%f\" \"%%scripts_done%%\" +- ) ++ popd + ) + + echo uninstalling firstboot service +-rhsrvany.exe -s firstboot uninstall +-" firstboot_dir_win in ++%s -s firstboot uninstall ++" firstboot_dir_win srvany in + + g#write (firstboot_dir // "firstboot.bat") (unix2dos firstboot_script); + +@@ -283,7 +289,7 @@ rhsrvany.exe -s firstboot uninstall + "Start", REG_DWORD 0x2_l; + "ErrorControl", REG_DWORD 0x1_l; + "ImagePath", +- REG_SZ (firstboot_dir_win ^ "\\rhsrvany.exe -s firstboot"); ++ REG_SZ (sprintf "%s\\%s -s firstboot" firstboot_dir_win srvany); + "DisplayName", REG_SZ "Virt tools firstboot service"; + "ObjectName", REG_SZ "LocalSystem" ]; + +Index: libguestfs-1.32.4/customize/virt-customize.pod +=================================================================== +--- libguestfs-1.32.4.orig/customize/virt-customize.pod ++++ libguestfs-1.32.4/customize/virt-customize.pod +@@ -250,6 +250,12 @@ I<--firstboot> or I<--firstboot-command> + + See also: C + ++=item F ++ ++This is a Windows binary shipped with SUSE VMDP, used to install a "firstboot" ++script in Windows guests. It is required if you intend to use the ++I<--firstboot> or I<--firstboot-command> options with Windows guests. ++ + =back + + =back +Index: libguestfs-1.32.4/sysprep/virt-sysprep.pod +=================================================================== +--- libguestfs-1.32.4.orig/sysprep/virt-sysprep.pod ++++ libguestfs-1.32.4/sysprep/virt-sysprep.pod +@@ -550,6 +550,12 @@ I<--firstboot> or I<--firstboot-command> + + See also: C + ++=item F ++ ++This is a Windows binary shipped with SUSE VMDP, used to install a "firstboot" ++script in Windows guests. It is required if you intend to use the ++I<--firstboot> or I<--firstboot-command> options with Windows guests. ++ + =back + + =back +Index: libguestfs-1.32.4/v2v/convert_linux.ml +=================================================================== +--- libguestfs-1.32.4.orig/v2v/convert_linux.ml ++++ libguestfs-1.32.4/v2v/convert_linux.ml +@@ -125,7 +125,7 @@ let rec convert ~keep_serial_console (g + let installed_kernels : kernel_info list = + let rex_ko = Str.regexp ".*\\.k?o\\(\\.xz\\)?$" in + let rex_ko_extract = Str.regexp ".*/\\([^/]+\\)\\.k?o\\(\\.xz\\)?$" in +- let rex_initrd = Str.regexp "^initr\\(d\\|amfs\\)-.*\\.img$" in ++ let rex_initrd = Str.regexp "^initr\\(d\\|amfs\\)-.*\\(\\.img\\)?$" in + filter_map ( + function + | { G.app2_name = name } as app +@@ -158,7 +158,8 @@ let rec convert ~keep_serial_console (g + + (* Get/construct the version. XXX Read this from kernel file. *) + let version = +- sprintf "%s-%s" app.G.app2_version app.G.app2_release in ++ let prefix_len = String.length "/lib/modules/" in ++ String.sub modpath prefix_len (String.length modpath - prefix_len) in + + (* Find the initramfs which corresponds to the kernel. + * Since the initramfs is built at runtime, and doesn't have +@@ -173,12 +174,11 @@ let rec convert ~keep_serial_console (g + let files = + List.filter ( + fun n -> +- String.find n app.G.app2_version >= 0 && +- String.find n app.G.app2_release >= 0 ++ String.find n version >= 0 + ) files in + (* Don't consider kdump initramfs images (RHBZ#1138184). *) + let files = +- List.filter (fun n -> String.find n "kdump.img" == -1) files in ++ List.filter (fun n -> String.find n "kdump" == -1) files in + (* If several files match, take the shortest match. This + * handles the case where we have a mix of same-version non-Xen + * and Xen kernels: +Index: libguestfs-1.32.4/v2v/test-v2v-in-place.sh +=================================================================== +--- libguestfs-1.32.4.orig/v2v/test-v2v-in-place.sh ++++ libguestfs-1.32.4/v2v/test-v2v-in-place.sh +@@ -97,7 +97,7 @@ mktest () + :> "$script" + :> "$expected" + +-firstboot_dir="/Program Files/Red Hat/Firstboot" ++firstboot_dir="/Program Files/Guestfs/Firstboot" + mktest "is-dir \"$firstboot_dir\"" true + mktest "is-file \"$firstboot_dir/firstboot.bat\"" true + mktest "is-dir \"$firstboot_dir/scripts\"" true +Index: libguestfs-1.32.4/v2v/test-v2v-virtio-win-iso.sh +=================================================================== +--- libguestfs-1.32.4.orig/v2v/test-v2v-virtio-win-iso.sh ++++ libguestfs-1.32.4/v2v/test-v2v-virtio-win-iso.sh +@@ -93,7 +93,7 @@ mktest () + :> "$script" + :> "$expected" + +-firstboot_dir="/Program Files/Red Hat/Firstboot" ++firstboot_dir="/Program Files/Guestfs/Firstboot" + mktest "is-dir \"$firstboot_dir\"" true + mktest "is-file \"$firstboot_dir/firstboot.bat\"" true + mktest "is-dir \"$firstboot_dir/scripts\"" true +Index: libguestfs-1.32.4/v2v/test-v2v-windows-conversion.sh +=================================================================== +--- libguestfs-1.32.4.orig/v2v/test-v2v-windows-conversion.sh ++++ libguestfs-1.32.4/v2v/test-v2v-windows-conversion.sh +@@ -86,7 +86,7 @@ mktest () + :> "$script" + :> "$expected" + +-firstboot_dir="/Program Files/Red Hat/Firstboot" ++firstboot_dir="/Program Files/Guestfs/Firstboot" + mktest "is-dir \"$firstboot_dir\"" true + mktest "is-file \"$firstboot_dir/firstboot.bat\"" true + mktest "is-dir \"$firstboot_dir/scripts\"" true +Index: libguestfs-1.32.4/v2v/virt-v2v.pod +=================================================================== +--- libguestfs-1.32.4.orig/v2v/virt-v2v.pod ++++ libguestfs-1.32.4/v2v/virt-v2v.pod +@@ -167,6 +167,8 @@ OVAs from other hypervisors will not wor + + =item RHEL 5 Xen + ++=item SUSE Xen ++ + =item Citrix Xen + + Citrix Xen has not been recently tested. +@@ -336,7 +338,7 @@ Xen remote connections can be used. Oth + will not work in general. + + See also L, +-L below. ++L below. + + =item B<-if> format + +@@ -1256,9 +1258,10 @@ Perform the conversion of the guest usin + + Remove the F and F files. + +-=head1 INPUT FROM RHEL 5 XEN ++=head1 INPUT FROM XEN + +-Virt-v2v is able to import Xen guests from RHEL 5 Xen hosts. ++Virt-v2v is able to import Xen guests from RHEL 5 Xen or SLES and ++openSUSE Xen hosts. + + Virt-v2v uses libvirt for access to the remote Xen host, and therefore + the input mode should be I<-i libvirt>. As this is the default, you +@@ -1852,6 +1855,12 @@ script in the guest during conversion of + + See also: C + ++=item F ++ ++This is a Windows binary shipped with SUSE VMDP, used to install a "firstboot" ++script in Windows guests. It is required if you intend to use the ++I<--firstboot> or I<--firstboot-command> options with Windows guests. ++ + =item F + + (Optional) +Index: libguestfs-1.32.4/v2v/Makefile.am +=================================================================== +--- libguestfs-1.32.4.orig/v2v/Makefile.am ++++ libguestfs-1.32.4/v2v/Makefile.am +@@ -291,6 +291,7 @@ TESTS_ENVIRONMENT = $(top_builddir)/run + TESTS = \ + test-v2v-i-ova-formats.sh \ + test-v2v-i-ova-gz.sh \ ++ test-v2v-i-ova-subfolders.sh \ + test-v2v-i-ova-two-disks.sh \ + test-v2v-copy-to-local.sh + +Index: libguestfs-1.32.4/v2v/convert_windows.ml +=================================================================== +--- libguestfs-1.32.4.orig/v2v/convert_windows.ml ++++ libguestfs-1.32.4/v2v/convert_windows.ml +@@ -43,18 +43,25 @@ let convert ~keep_serial_console (g : G. + try Sys.getenv "VIRT_TOOLS_DATA_DIR" + with Not_found -> Guestfs_config.datadir // "virt-tools" in + +- (* Check if RHEV-APT exists. This is optional. *) +- let rhev_apt_exe = virt_tools_data_dir // "rhev-apt.exe" in +- let rhev_apt_exe = ++ (* Check if either RHEV-APT or VMDP exists. This is optional. *) ++ let tools = [`RhevApt, "rhev-apt.exe"; `VmdpExe, "vmdp.exe"] in ++ let installer = + try +- let chan = open_in rhev_apt_exe in +- close_in chan; +- Some rhev_apt_exe +- with +- Sys_error msg -> +- warning (f_"'%s' is missing. Unable to install RHEV-APT (RHEV guest agent). Original error: %s") +- rhev_apt_exe msg; +- None in ++ let t, tool = List.find ( ++ fun (_, tool) -> ++ try ( ++ let exe_path = virt_tools_data_dir // tool in ++ let chan = open_in exe_path in ++ close_in chan; ++ true ++ ) with _ -> ++ false ++ ) tools in ++ Some (t, virt_tools_data_dir // tool) ++ with Not_found -> ( ++ warning (f_"Neither rhev-apt.exe nor vmdp.exe can be found. Unable to install one of them."); ++ None ++ ) in + + (* Get the Windows %systemroot%. *) + let systemroot = g#inspect_get_windows_systemroot inspect.i_root in +@@ -158,19 +165,19 @@ let convert ~keep_serial_console (g : G. + (* Perform the conversion of the Windows guest. *) + + let rec configure_firstboot () = +- configure_rhev_apt (); ++ match installer with ++ | None -> () ++ | Some (`RhevApt, tool_path) -> configure_rhev_apt tool_path ++ | Some (`VmdpExe, tool_path) -> configure_vmdp tool_path; + unconfigure_xenpv () + +- and configure_rhev_apt () = ++ and configure_rhev_apt tool_path = + (* Configure RHEV-APT (the RHEV guest agent). However if it doesn't + * exist just warn about it and continue. + *) +- match rhev_apt_exe with +- | None -> () +- | Some rhev_apt_exe -> +- g#upload rhev_apt_exe "/rhev-apt.exe"; (* XXX *) ++ g#upload tool_path "/rhev-apt.exe"; (* XXX *) + +- let fb_script = "\ ++ let fb_script = "\ + @echo off + + echo installing rhev-apt +@@ -179,8 +186,38 @@ echo installing rhev-apt + echo starting rhev-apt + net start rhev-apt + " in +- Firstboot.add_firstboot_script g inspect.i_root +- "configure rhev-apt" fb_script ++ Firstboot.add_firstboot_script g inspect.i_root ++ "configure rhev-apt" fb_script ++ ++ and configure_vmdp tool_path = ++ (* Configure VMDP if possible *) ++ g#upload tool_path "/vmdp.exe"; ++ ++ let fb_script = "\ ++echo V2V first boot script started ++echo Decompressing VMDP installer ++\"\\vmdp.exe\" ++pushd \"VMDP-*\" ++echo Installing VMDP ++setup.exe /eula_accepted /no_reboot ++popd ++" in ++ ++ let fb_recover_script = "\ ++echo Finishing VMDP installation ++if not exist VMDP-* ( ++ \"\\vmdp.exe\" ++) ++pushd \"VMDP-*\" ++setup.exe /eula_accepted /no_reboot ++popd ++" in ++ ++ Firstboot.add_firstboot_script g inspect.i_root ++ "configure vmdp" fb_script; ++ ++ Firstboot.add_firstboot_script g inspect.i_root ++ "finish vmdp setup" fb_recover_script + + and unconfigure_xenpv () = + match xenpv_uninst with +Index: libguestfs-1.32.4/v2v/input_ova.ml +=================================================================== +--- libguestfs-1.32.4.orig/v2v/input_ova.ml ++++ libguestfs-1.32.4/v2v/input_ova.ml +@@ -139,13 +139,14 @@ object + let rex = Str.regexp "SHA1(\\(.*\\))=\\([0-9a-fA-F]+\\)\r?" in + List.iter ( + fun mf -> ++ let mf_folder = Filename.dirname mf in + let chan = open_in mf in + let rec loop () = + let line = input_line chan in + if Str.string_match rex line 0 then ( + let disk = Str.matched_group 1 line in + let expected = Str.matched_group 2 line in +- let cmd = sprintf "sha1sum %s" (quote (exploded // disk)) in ++ let cmd = sprintf "sha1sum %s" (quote (mf_folder // disk)) in + let out = external_command cmd in + match out with + | [] -> +@@ -166,6 +167,7 @@ object + ) mf; + + (* Parse the ovf file. *) ++ let ovf_folder = Filename.dirname ovf in + let xml = read_whole_file ovf in + let doc = Xml.parse_memory xml in + +@@ -266,7 +268,7 @@ object + | Some s -> s in + + (* Does the file exist and is it readable? *) +- let filename = exploded // filename in ++ let filename = ovf_folder // filename in + Unix.access filename [Unix.R_OK]; + + (* The spec allows the file to be gzip-compressed, in which case +Index: libguestfs-1.32.4/v2v/test-v2v-i-ova-subfolders.expected =================================================================== --- /dev/null -+++ libguestfs-1.26.10/builder/opensuse.conf.in -@@ -0,0 +1,3 @@ -+[opensuse.org] -+uri=http://download.opensuse.org/repositories/Virtualization:/virt-builder-images/images/index -+gpgkey=file://@SYSCONFDIR@/xdg/virt-builder/repos.d/opensuse.gpg -Index: libguestfs-1.26.10/builder/opensuse.gpg ++++ libguestfs-1.32.4/v2v/test-v2v-i-ova-subfolders.expected +@@ -0,0 +1,18 @@ ++Source guest information (--print-source option): ++ ++ source name: 2K8R2EESP1_2_Medium ++hypervisor type: vmware ++ memory: 1073741824 (bytes) ++ nr vCPUs: 1 ++ CPU features: ++ firmware: uefi ++ display: ++ video: ++ sound: ++disks: ++ subfolder/disk1.vmdk (vmdk) [scsi] ++removable media: ++ CD-ROM [ide] in slot 0 ++NICs: ++ Network "Network adapter 1" ++ +Index: libguestfs-1.32.4/v2v/test-v2v-i-ova-subfolders.ovf =================================================================== --- /dev/null -+++ libguestfs-1.26.10/builder/opensuse.gpg -@@ -0,0 +1,21 @@ -+-----BEGIN PGP PUBLIC KEY BLOCK----- -+Version: GnuPG v1.4.5 (GNU/Linux) ++++ libguestfs-1.32.4/v2v/test-v2v-i-ova-subfolders.ovf +@@ -0,0 +1,138 @@ ++ ++ ++ ++ ++ ++ ++ Virtual disk information ++ ++ ++ ++ The list of logical networks ++ ++ The PG-VLAN60 network ++ ++ ++ ++ A virtual machine ++ 2K8R2EESP1_2_Medium ++ ++ The kind of installed guest operating system ++ Microsoft Windows Server 2008 R2 (64-bit) ++ ++ ++ Virtual hardware requirements ++ ++ Virtual Hardware Family ++ 0 ++ 2K8R2EESP1_2_Medium ++ vmx-10 ++ ++ ++ hertz * 10^6 ++ Number of Virtual CPUs ++ 1 virtual CPU(s) ++ 1 ++ 3 ++ 1 ++ ++ ++ byte * 2^20 ++ Memory Size ++ 1024MB of memory ++ 2 ++ 4 ++ 1024 ++ ++ ++ 0 ++ SCSI Controller ++ SCSI controller 0 ++ 3 ++ lsilogicsas ++ 6 ++ ++ ++ ++ 1 ++ IDE Controller ++ IDE 1 ++ 4 ++ 5 ++ ++ ++ 0 ++ IDE Controller ++ IDE 0 ++ 5 ++ 5 ++ ++ ++ false ++ Video card ++ 6 ++ 24 ++ ++ ++ ++ ++ ++ ++ false ++ VMCI device ++ 7 ++ vmware.vmci ++ 1 ++ ++ ++ ++ ++ 0 ++ false ++ CD/DVD drive 1 ++ 8 ++ 4 ++ vmware.cdrom.atapi ++ 15 ++ ++ ++ 0 ++ Hard disk 1 ++ ovf:/disk/vmdisk1 ++ 9 ++ 3 ++ 17 ++ ++ ++ ++ 7 ++ true ++ PG-VLAN60 ++ E1000 ethernet adapter on "PG-VLAN60" ++ Network adapter 1 ++ 11 ++ E1000 ++ 10 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +Index: libguestfs-1.32.4/v2v/test-v2v-i-ova-subfolders.sh +=================================================================== +--- /dev/null ++++ libguestfs-1.32.4/v2v/test-v2v-i-ova-subfolders.sh +@@ -0,0 +1,65 @@ ++#!/bin/bash - ++# libguestfs virt-v2v test script ++# Copyright (C) 2014 Red Hat Inc. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + -+mQENBFImAl0BCACkjaXGvVLHBGTVXVP0khtpUVHqFvCRtaIIMHaX/5oTr3nyehDQ -+Ex9VLsSRcNa0QxtnCHFRQzjWWqe+i6pBginnSjucgmjnIKyJsF4l6R+rwAiinHQX -+C4s6Lqg/wH9xDPRBrMYFqlc/7MVf0Glhk1+lAxgQjolMt+5AbbrWlBbwc/i+++zl -+ES3MaeH8aiwup/ogjhmk0SbCQQ/ib21p3XWBwx2oz/KM6Voq9tKDvMczjzNRY3ZT -+6Di3FsUSKI7kgljiNiuN+675YwqEqxWEJgdE5a7Zb67giH1Ik08b5wQiF5jSAICD -+DxW7/ibWBvZJnqhqQT2xJpLC5VaJqwkN8o83ABEBAAG0PlZpcnR1YWxpemF0aW9u -+IE9CUyBQcm9qZWN0IDxWaXJ0dWFsaXphdGlvbkBidWlsZC5vcGVuc3VzZS5vcmc+ -+iQE7BBMBAgAmBQJSJgJdAhsDBQkEHrAABgsJCAcDAgQVAggDBBYCAwECHgECF4AA -+CgkQoZP7tXIXT8ITnwf3SVUUoVjVLFCjhIxdet8BL011cJDwr9TwKEQfq4Ybsq5L -+5Y1/Zk86rTzrVOZrODLwNRIC3fMuegZV5f85KMggXu37Di+UvX+dQW9v1hte+hAT -++gsqb60kOnE/Yacgkb6D3xIzRudAB2q/xfvHl/hgfn416yGI8NvntT7n4Hk9wT28 -+9JSFkun0uaessg77aXlAdsqHwdugm9hELeva89OoYoiZ4d9r4ScTMSj0UkNgnh7g -+CyIScZHYqiiOeosUtAX9u1PyUFfFsg9s5snfud7aF48EfXU0RTtZAGKtG4GPDv3q -+bYc5TJ2pQzs9y5Bk/jAMR/QQw8CKglBsn1cjYkKViEYEExECAAYFAlImAl0ACgkQ -+OzARt2udZSO5yACgr6Ei7QZ+PAmg4Mr5db+4M3aepAEAniU33RaTKBCGkwQi6kHr -+4VaII2/E -+=l8DH -+-----END PGP PUBLIC KEY BLOCK----- -Index: libguestfs-1.26.10/configure.ac -=================================================================== ---- libguestfs-1.26.10.orig/configure.ac -+++ libguestfs-1.26.10/configure.ac -@@ -1635,6 +1635,7 @@ AC_CONFIG_FILES([Makefile - bash/Makefile - builder/Makefile - builder/libguestfs.conf -+ builder/opensuse.conf - builder/test-config/virt-builder/repos.d/test-index.conf - builder/test-website/virt-builder/repos.d/libguestfs.conf - builder/website/Makefile -Index: libguestfs-1.26.10/customize/password.ml -=================================================================== ---- libguestfs-1.26.10.orig/customize/password.ml -+++ libguestfs-1.26.10/customize/password.ml -@@ -166,6 +166,9 @@ and default_crypto ~prog g root = - | "ubuntu", v when v >= 10 -> `SHA512 - | "ubuntu", _ -> `MD5 - -+ | ("opensuse"|"sles"), v when v >= 11 -> `SHA512 -+ | ("opensuse"|"sles"), _ -> `MD5 ++# Test -i ova option with files located in a subfolder. + - | _, _ -> - warning ~prog (f_"password: using insecure md5 password encryption for - guest of type %s version %d.\nIf this is incorrect, use --password-crypto option and file a bug.") distro major; -Index: libguestfs-1.26.10/builder/builder.ml -=================================================================== ---- libguestfs-1.26.10.orig/builder/builder.ml -+++ libguestfs-1.26.10/builder/builder.ml -@@ -159,7 +159,7 @@ let main () = - (* Try to make the directory. If that fails, warn and continue - * without any cache. - *) -- try mkdir dir 0o755; Some dir -+ try mkdir_p dir 0o755; Some dir - with exn -> - warning ~prog (f_"cache %s: %s") dir (Printexc.to_string exn); - warning ~prog (f_"disabling the cache"); -Index: libguestfs-1.26.10/mllib/common_utils.ml -=================================================================== ---- libguestfs-1.26.10.orig/mllib/common_utils.ml -+++ libguestfs-1.26.10/mllib/common_utils.ml -@@ -508,3 +508,14 @@ let is_char_device file = - let is_directory path = - try Sys.is_directory path - with Sys_error _ -> false ++unset CDPATH ++export LANG=C ++set -e + -+let rec mkdir_p path permissions = -+ try Unix.mkdir path permissions -+ with -+ | Unix.Unix_error (Unix.EEXIST, _, _) -> () -+ | Unix.Unix_error (Unix.ENOENT, _, _) -> -+ (* A component in the path does not exist, so first try -+ * creating the parent directory, and then again the requested -+ * directory. *) -+ mkdir_p (Filename.dirname path) permissions; -+ Unix.mkdir path permissions -Index: libguestfs-1.26.10/mllib/common_utils.mli -=================================================================== ---- libguestfs-1.26.10.orig/mllib/common_utils.mli -+++ libguestfs-1.26.10/mllib/common_utils.mli -@@ -117,3 +117,6 @@ val is_block_device : string -> bool - val is_char_device : string -> bool - val is_directory : string -> bool - (** These don't throw exceptions, unlike the [Sys] functions. *) ++if [ -n "$SKIP_TEST_V2V_I_OVA_SUBFOLDERS_SH" ]; then ++ echo "$0: test skipped because environment variable is set" ++ exit 77 ++fi + -+val mkdir_p : string -> int -> unit -+(** Creates a directory, and its parents if missing. *) ++if [ "$(guestfish get-backend)" = "uml" ]; then ++ echo "$0: test skipped because UML backend does not support network" ++ exit 77 ++fi ++ ++export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools" ++ ++. $srcdir/../test-data/guestfs-hashsums.sh ++ ++d=test-v2v-i-ova-subfolders.d ++rm -rf $d ++mkdir -p $d/subfolder ++ ++cp test-v2v-i-ova-subfolders.ovf $d/subfolder/ ++ ++pushd $d/subfolder ++ ++truncate -s 10k disk1.vmdk ++sha=`do_sha1 disk1.vmdk` ++echo -e "SHA1(disk1.vmdk)=$sha\r" > disk1.mf ++ ++cd .. ++tar -cf test.ova subfolder ++popd ++ ++# Run virt-v2v but only as far as the --print-source stage, and ++# normalize the output. ++$VG virt-v2v --debug-gc --quiet \ ++ -i ova $d/test.ova \ ++ --print-source | ++sed 's,[^ \t]*\(subfolder/disk.*\.vmdk\),\1,' > $d/source ++ ++# Check the parsed source is what we expect. ++diff -u test-v2v-i-ova-subfolders.expected $d/source ++ ++rm -rf $d diff --git a/1000-force-virtio_blk-in-old-guest-kernel.patch b/1000-force-virtio_blk-in-old-guest-kernel.patch deleted file mode 100644 index 5503d30..0000000 --- a/1000-force-virtio_blk-in-old-guest-kernel.patch +++ /dev/null @@ -1,126 +0,0 @@ -From 91563687c1f1b3544c71f2f53c387c86d95b246c Mon Sep 17 00:00:00 2001 -From: Olaf Hering -Date: Mon, 3 Sep 2012 19:50:44 +0200 -Subject: force virtio_blk in old guest kernel - -Signed-off-by: Olaf Hering ---- - fish/options.c | 7 +++++-- - src/guestfs-internal.h | 1 + - src/handle.c | 16 ++++++++++++++++ - src/inspect-fs-unix.c | 4 ++-- - src/launch-direct.c | 2 ++ - test-tool/test-tool.c | 1 + - 6 files changed, 27 insertions(+), 4 deletions(-) - -diff --git a/fish/options.c b/fish/options.c -index 5e6eb73..2c1a48a 100644 ---- a/fish/options.c -+++ b/fish/options.c -@@ -101,7 +101,10 @@ add_drives_handle (guestfs_h *g, struct drv *drv, char next_drive) - { - int r; - struct guestfs_add_drive_opts_argv ad_optargs; -- -+ int use_virtio_blk = 0; -+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK -+ use_virtio_blk = 1; -+#endif - if (next_drive > 'z') { - fprintf (stderr, - _("%s: too many drives added on the command line\n"), -@@ -115,7 +118,7 @@ add_drives_handle (guestfs_h *g, struct drv *drv, char next_drive) - free (drv->device); - drv->device = NULL; - -- if (asprintf (&drv->device, "/dev/sd%c", next_drive) == -1) { -+ if (asprintf (&drv->device, "/dev/%s%c", use_virtio_blk ? "vd" : "sd", next_drive) == -1) { - perror ("asprintf"); - exit (EXIT_FAILURE); - } -diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h -index 648f005..fd99253 100644 ---- a/src/guestfs-internal.h -+++ b/src/guestfs-internal.h -@@ -501,6 +501,7 @@ struct guestfs_h - unsigned int nr_requested_credentials; - virConnectCredentialPtr requested_credentials; - #endif -+ int use_virtio_blk; - }; - - /* Per-filesystem data stored for inspect_os. */ -diff --git a/src/handle.c b/src/handle.c -index 393ac1e..1806570 100644 ---- a/src/handle.c -+++ b/src/handle.c -@@ -259,6 +259,22 @@ parse_environment (guestfs_h *g, - return -1; - } - -+/* -+ * Currently virtio_scsi is forced if qemu in the host supports this -+ * feature. This test does however not take the capabilities of the started -+ * guest into account. As a result no disks will be found if the guest -+ * kernel is older than 3.4. -+ */ -+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK -+ static const char env_string[] = "GUESTFS_QEMU_NO_VIRTIO_BLK"; -+ str = getenv(env_string); -+ g->use_virtio_blk = str == NULL; -+ if (str) -+ debug (g, "SuSE: %s in environment, preserving virtio-scsi setting.", env_string); -+ else -+ debug (g, "SuSE: %s not in environment, preventing virtio-scsi usage in old guest kernel.", env_string); -+#endif -+ - return 0; - } - -diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c -index 7221f24..9045f13 100644 ---- a/src/inspect-fs-unix.c -+++ b/src/inspect-fs-unix.c -@@ -1433,7 +1433,7 @@ resolve_fstab_device_diskbyid (guestfs_h *g, const char *part, - return 0; - - /* Make the partition name and check it exists. */ -- device = safe_asprintf (g, "/dev/sda%s", part); -+ device = safe_asprintf (g, "/dev/%sa%s", g->use_virtio_blk ? "vd" : "sd", part); - if (!is_partition (g, device)) { - free (device); - return 0; -@@ -1526,7 +1526,7 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map) - if (disk_i != -1 && disk_i <= 26 && - slice_i > 0 && slice_i <= 1 /* > 4 .. see comment above */ && - part_i >= 0 && part_i < 26) { -- device = safe_asprintf (g, "/dev/sd%c%d", disk_i + 'a', part_i + 5); -+ device = safe_asprintf (g, "/dev/%s%c%d", g->use_virtio_blk ? "vd" : "sd", disk_i + 'a', part_i + 5); - } - } - else if ((part = match1 (g, spec, re_diskbyid)) != NULL) { -diff --git a/src/launch-direct.c b/src/launch-direct.c -index eab3e89..ee286a5 100644 ---- a/src/launch-direct.c -+++ b/src/launch-direct.c -@@ -1184,6 +1184,8 @@ qemu_supports_virtio_scsi (guestfs_h *g, struct backend_direct_data *data) - data->virtio_scsi = 3; - } - } -+ if (g->use_virtio_blk) -+ data->virtio_scsi = 2; - - return data->virtio_scsi == 1; - } -diff --git a/test-tool/test-tool.c b/test-tool/test-tool.c -index 7e8d88e..8d5ae34 100644 ---- a/test-tool/test-tool.c -+++ b/test-tool/test-tool.c -@@ -187,6 +187,7 @@ main (int argc, char *argv[]) - exit (EXIT_FAILURE); - } - guestfs_set_verbose (g, 1); -+ guestfs_set_trace (g, 1); - - if (qemu) - set_qemu (g, qemu, qemu_use_wrapper); diff --git a/libguestfs-1.26.10.tar.xz b/libguestfs-1.26.10.tar.xz deleted file mode 100644 index 0ccdf26..0000000 --- a/libguestfs-1.26.10.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d9950647f8316ef0c397c2b82652dc268a8a82baa43046af393239800a05620 -size 5015800 diff --git a/libguestfs-1.32.4.tar.xz b/libguestfs-1.32.4.tar.xz new file mode 100644 index 0000000..09b714f --- /dev/null +++ b/libguestfs-1.32.4.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0cf71c773bb51d0a3dd992e931becc1791a40846818043d70bc94ccf32cc092 +size 7606468 diff --git a/libguestfs.changes b/libguestfs.changes index 8ea0b8e..7b66df3 100644 --- a/libguestfs.changes +++ b/libguestfs.changes @@ -1,3 +1,49 @@ +------------------------------------------------------------------- +Mon Mar 14 08:41:08 UTC 2016 - cbosdonnat@suse.com + +- Update to version 1.32.4 +- Backported commits (fate#316274): + * f5a9cdf: api: add mountable_device and mountable_subvolume + * 1c30c23: fish: fix btrfs subvolumes display in error case + * 1f24364: v2v: win <= 7: reduce registry patch + * f0dce24: v2v: win >= 8: reduce registry patch + * 9a441b0: v2v: win >= 8: simplify registry patching + * e07459d: v2v: win: factor out common bits in registry patching + * 47aa64a: v2v: add support for virtio-scsi + * bba9ea9: v2v: also search for windows virtio drivers in symlinks + * 3bf7d30: Update packagelist for SLES and openSUSE + * 89ae53e: appliance: skip /etc/mtab creation is already existing + * ee78c06: customize: add support for pvvxsvc + * 25848b5: v2v: document SUSE's Xen as a working input hypervisor + * e9082ea: v2v: rename RHEL 5 Xen input section into Xen in man + * 75fe93e: v2v: improve initrd search + * 536ef6f: customize: change windows firstboot path + * 07f7bfa: customize: fix windows firstboot script + * c466d4c: v2v: add support for SUSE VMDP drivers + * 9de9300: v2v: handle subfolders in ova files +- Removed patches: + * 1000-force-virtio_blk-in-old-guest-kernel.patch + * libguestfs.mkinitrd.1110.patch + * libguestfs.mkinitrd.1115.patch + * libguestfs.mkinitrd.1140.patch + * libguestfs.mkinitrd.1210.patch + * libguestfs.mkinitrd.1220.patch + * libguestfs.mkinitrd.1230.patch + * libguestfs.mkinitrd.1310.patch + * libguestfs.mkinitrd.boot-btrfs.sh + * libguestfs.mkinitrd.boot-dm.sh + * libguestfs.mkinitrd.boot-lvm2.sh + * libguestfs.mkinitrd.boot-md.sh + * libguestfs.mkinitrd.boot-nfs.sh + * libguestfs.mkinitrd.boot.sh + * libguestfs.mkinitrd.setup-btrfs.sh + * libguestfs.mkinitrd.setup-dm.sh + * libguestfs.mkinitrd.setup-lvm2.sh + * libguestfs.mkinitrd.setup-md.sh + * libguestfs.mkinitrd.setup-nfs.sh + * libguestfs.mkinitrd.setup.sh + * libguestfs.mkinitrd.tar.bz2 + ------------------------------------------------------------------- Thu Oct 1 12:09:22 UTC 2015 - cbosdonnat@suse.com diff --git a/libguestfs.mkinitrd.1110.patch b/libguestfs.mkinitrd.1110.patch deleted file mode 100644 index 5a812e7..0000000 --- a/libguestfs.mkinitrd.1110.patch +++ /dev/null @@ -1,385 +0,0 @@ ---- - mkinitrd/scripts/setup-ibft.sh | 2 - mkinitrd/scripts/setup-network.sh | 11 +++- - mkinitrd/scripts/setup-prepare.sh | 94 ++++++++++++++++++++++++++++------- - mkinitrd/scripts/setup-progs.sh | 4 - - mkinitrd/scripts/setup-scsi_dh.sh | 2 - mkinitrd/scripts/setup-sharedlibs.sh | 60 +++++++++++++--------- - 6 files changed, 126 insertions(+), 47 deletions(-) - -Index: 1110/mkinitrd/scripts/setup-ibft.sh -=================================================================== ---- 1110.orig/mkinitrd/scripts/setup-ibft.sh -+++ 1110/mkinitrd/scripts/setup-ibft.sh -@@ -21,22 +21,22 @@ ibft_set_iface() { - interface=$iface - drvlink=$(get_network_module $interface) - if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then - nettype=dhcp - read ibft_dhcp < $ibft_nic/dhcp - [ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static - else - nettype=static - fi - fi - } - - ibft_nic=/sys/firmware/ibft/ethernet0 --ibft_hostname=$(hostname) -+ibft_hostname=localhost - - if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then - ibft_available=1 - ibft_set_iface - fi - save_var ibft_available - save_var ibft_hostname - save_var ibft_nic -Index: 1110/mkinitrd/scripts/setup-network.sh -=================================================================== ---- 1110.orig/mkinitrd/scripts/setup-network.sh -+++ 1110/mkinitrd/scripts/setup-network.sh -@@ -291,27 +291,36 @@ if [ "$nettype" = "ifup" ] ; then - verbose "[NETWORK]\tifup: $interface" - fi - done - interface= - fi - - # Copy the /etc/resolv.conf when the IP is static - if test -n "$static_interfaces"; then - verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd" - cp /etc/resolv.conf $tmp_mnt/etc - fi - - # Copy netcfg files (bnc#468090, bnc#714945) --cp /etc/{hosts,protocols,services,netconfig} $tmp_mnt/etc -+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc -+cat > $tmp_mnt/etc/hosts <<_EOH_ -+127.0.0.1 localhost -+::1 localhost ipv6-localhost ipv6-loopback -+fe00::0 ipv6-localnet -+ff00::0 ipv6-mcastprefix -+ff02::1 ipv6-allnodes -+ff02::2 ipv6-allrouters -+ff02::3 ipv6-allhosts -+_EOH_ - - # Get static IP configuration if requested - for iface in $static_interfaces; do - static_ips="$static_ips $(get_ip_config $iface)" - done - - mkdir -p $tmp_mnt/var/lib/dhcpcd - mkdir -p $tmp_mnt/var/run - - cp_bin /lib/mkinitrd/bin/ipconfig.sh $tmp_mnt/bin/ipconfig - if [ -f /etc/udev/rules.d/70-persistent-net.rules ] ; then - cp /etc/udev/rules.d/70-persistent-net.rules $tmp_mnt/etc/udev/rules.d - fi -Index: 1110/mkinitrd/scripts/setup-prepare.sh -=================================================================== ---- 1110.orig/mkinitrd/scripts/setup-prepare.sh -+++ 1110/mkinitrd/scripts/setup-prepare.sh -@@ -13,43 +13,103 @@ - #%param_v: "Verbose mode." - #%param_L: "Disable logging." - #%param_h: "This help screen." - # - ###### Additional options - ## - ## Script inclusion may be overriden by - ## 1) creating a monster-initrd - ## 2) including the wanted module in the configuration option ADDITIONAL_FEATURES in /etc/sysconfig/initrd - ## 3) definition using the -f command line switch - ## - - # Install a binary file -+# cp_bin file target_filename -+# cp_bin file target_directory -+# cp_bin file file target_directory -+# file is either a regular file or a symlink. symlinks and all paths they point to will be copied -+# the "root" of target is $tmp_mnt, which is required to copy symlinks properly - cp_bin() { -- cp -a "$@" \ -- || exit_code=1 -- -- # Remember the binaries installed. We need the list for checking -- # for dynamic libraries. -- while [ $# -gt 1 ]; do -- initrd_bins[${#initrd_bins[@]}]=$1 -- shift -- done -- # file may print '^setuid ELF ...' -- # suid mount will fail if mkinitrd was called as user -- if [ -L "$1" ]; then -- : do nothing with symlinks -- elif [ -d "$1" -o -f "$1" ]; then -- find "$1" -type f -print0 | xargs -0 chmod 0755 -- fi -+ local -a files -+ local target -+ local target_dirname -+ local file -+ -+ # need at least two parameters, source and destination -+ if test $# -lt 2 -+ then -+ return 0 -+ fi -+ # store source filenames -+ until test $# -eq 1 -+ do -+ files=( ${files[@]} $1 ) -+ shift -+ done -+ # store target, either file or directory -+ target=$1 -+ # if more than two parameters, last entry must be a directory -+ if test ${#files[@]} -gt 1 -+ then -+ if ! test -d ${target} -+ then -+ return 0 -+ fi -+ target_dirname=${target} -+ else -+ # simplify symlink resolving for sinlge filename -+ target_dirname=${target%/*} -+ fi -+ -+ for file in ${files[@]} -+ do -+ local src dst -+ src=${file} -+ dst=${target} -+ # copy requested soure file as is to requested destination -+ cp -a -v --remove-destination ${src} ${dst} -+ # copy symlinks recursivly -+ while [ 1 ] -+ do -+ local tmp_src -+ if test -L ${src} -+ then -+ tmp_src=$(readlink ${src}) -+ if test "${tmp_src:0:1}" = "/" -+ then -+ src=${tmp_src} -+ else -+ # relative symlink -+ src=${src%/*}/${tmp_src} -+ fi -+ cp -a -v --remove-destination --parents ${src} $tmp_mnt -+ # if link target exists, proceed to next symlink target -+ if test -e "${src}" -+ then -+ continue -+ fi -+ fi -+ # exit loop in case of dead symlink or if target of symlink was reached -+ break -+ done -+ # if source file exists, add it to list of binaries -+ if test -e "${src}" -+ then -+ # file may print '^setuid ELF ...' -+ # suid mount will fail if mkinitrd was called as user -+ chmod -v 0755 $tmp_mnt/${src} -+ initrd_bins[${#initrd_bins[@]}]=${src} -+ fi -+ done - } - - # check if we should use script or feature $1 - use_script() { - local condition feature script file - - # always use when creating monster initrd - [ "$create_monster_initrd" ] && return 0 - - # Normalize to feature name - feature="${1##*/}" - feature="${feature#*-}" - feature="${feature%.sh}" -@@ -146,27 +206,27 @@ fi - for feature in $ADDITIONAL_FEATURES ; do - feature_exists "$feature" || echo "[WARNING] Feature \"$feature\" not found. A typo?" - done - - # create an empty initrd - if ! mkdir $tmp_mnt ; then - error 1 "could not create temporary directory" - fi - - # fill the initrd - cp $INITRD_PATH/bin/linuxrc $linuxrc - mkdir "$tmp_mnt/boot" - --mkdir -p $tmp_mnt/{sbin,bin,etc,dev,proc,sys,root,config} -+mkdir -p $tmp_mnt/{sbin,bin,etc,dev,proc,sys,root,config,usr/bin,usr/sbin} - - mkdir -p -m 4777 $tmp_mnt/tmp - - # Create a dummy /etc/mtab for mount/umount - echo -n > $tmp_mnt/etc/mtab - - # Add modprobe, modprobe.conf*, and a version of /bin/true: modprobe.conf - # might use it. - cp -r $root_dir/etc/modprobe.conf $root_dir/etc/modprobe.conf.local \ - $root_dir/etc/modprobe.d $tmp_mnt/etc - cat > $tmp_mnt/bin/true <<-EOF - #! /bin/sh - : -Index: 1110/mkinitrd/scripts/setup-progs.sh -=================================================================== ---- 1110.orig/mkinitrd/scripts/setup-progs.sh -+++ 1110/mkinitrd/scripts/setup-progs.sh -@@ -28,29 +28,29 @@ for script in $INITRD_PATH/boot/*.sh; do - echo "[ \"\$debug\" ] && echo running $file - source boot/$file - [ \"\$modules\" ] && load_modules" >> run_all.sh - [ "$condition" ] && echo "fi" >> run_all.sh - # and all programs it needs - for files in $(cat $script | grep '%programs: ' | sed 's/^#%programs: \(.*\)$/\1/'); do - for file in $(eval echo $files); do - if [ "${file:0:17}" = "/lib/mkinitrd/bin" ]; then - SOURCE=$file - DEST="./bin/" - elif [ "${file:0:1}" = "/" ]; then # absolute path files have to stay alive - SOURCE=$file - [ ! -e $file -a -e /usr$file ] && SOURCE="/usr$file" -- DEST=".$file" -+ DEST=".$SOURCE" - else - SOURCE=$(which "$file") -- DEST="./bin/" -+ DEST=".$SOURCE" - fi - cp_bin "$SOURCE" "$DEST" - done - done - fi - done - - echo -ne "Features: " - echo $features - - [ -e "bin/sh" ] || ln -s /bin/bash bin/sh - -Index: 1110/mkinitrd/scripts/setup-scsi_dh.sh -=================================================================== ---- 1110.orig/mkinitrd/scripts/setup-scsi_dh.sh -+++ 1110/mkinitrd/scripts/setup-scsi_dh.sh -@@ -1,13 +1,13 @@ - #!/bin/bash - # - #%stage: device - # - # Include all scsi_dh_* modules and load them on boot (bnc#727428 et al) - - scsi_dh_modules= --for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko"); do -+for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko" | sort); do - i=${i%.ko} - scsi_dh_modules="$scsi_dh_modules ${i##*/}" - done - - save_var scsi_dh_modules -Index: 1110/mkinitrd/scripts/setup-sharedlibs.sh -=================================================================== ---- 1110.orig/mkinitrd/scripts/setup-sharedlibs.sh -+++ 1110/mkinitrd/scripts/setup-sharedlibs.sh -@@ -54,58 +54,68 @@ shared_object_files() { - while [ -L "/$lib" ]; do - echo $lib - link="$(readlink "/$lib")" - if [ x"${link:0:1}" == x"/" ]; then - lib=${link#/} - else - lib="${lib%/*}/$link" - fi - done - echo $lib - done - } - --verbose -ne "Shared libs:\t" --# Copy all required shared libraries and the symlinks that --# refer to them. --lib_files=$(shared_object_files "${initrd_bins[@]}") --[ $? -eq 0 ] || return 1 --if [ -n "$lib_files" ]; then -- for lib in $lib_files; do -- [ -L $root_dir/$lib ] || verbose -n "$lib " -- ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt ) -- done -- lib_files= -+copy_shared_libs() { -+ local bins=( "$@" ) -+ local extra_lib_files lib_files lib i -+ -+ # First see what nss and other libs are required. This can be 64bit or 32bit, -+ # depending on the host and the already copied binaries. - case "$(uname -m)" in - alpha|ia64) -+ # this is a known location - mkdir -p $tmp_mnt/lib -- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`" -+ extra_lib_files="`echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`" - ;; - *) -- # no symlinks, most point into the running system -- for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev/,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u` -+ # Skip symlinks, they may point into the running system instead of $tmp_mnt -+ for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u` - do - case "$i" in - 32-bit) - mkdir -p $tmp_mnt/lib -- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`" -+ extra_lib_files="$extra_lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`" - ;; - 64-bit) - mkdir -p $tmp_mnt/lib64 -- lib_files="$lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`" -+ extra_lib_files="$extra_lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`" - ;; - esac - done - ;; - esac - -- for lib in $lib_files ; do -- if [ -f $lib ] ; then -- verbose -n "${lib##$root_dir/} " -- cp -dp --parents $lib $tmp_mnt -+ verbose -ne "Shared libs:\t" -+ -+ # Now collect a list of libraries on which the binaries and extra libs depend on -+ lib_files=$( shared_object_files ${bins[@]} $extra_lib_files ) -+ if [ $? -eq 0 ] -+ then -+ if [ -n "$lib_files" ] -+ then -+ # Finally copy dependencies and extra libs -+ for lib in $lib_files $extra_lib_files -+ do -+ [ -L $root_dir/$lib ] || verbose -n "$lib " -+ ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt ) -+ done -+ verbose -+ else -+ verbose "none" - fi -- done -- verbose --else -- verbose "none" --fi -+ else -+ return 1 -+ fi -+} - -+# Copy all required shared libraries and the symlinks that refer to them. -+copy_shared_libs "${initrd_bins[@]}" diff --git a/libguestfs.mkinitrd.1115.patch b/libguestfs.mkinitrd.1115.patch deleted file mode 100644 index d3bb399..0000000 --- a/libguestfs.mkinitrd.1115.patch +++ /dev/null @@ -1,356 +0,0 @@ ---- - mkinitrd/scripts/setup-ibft.sh | 2 - mkinitrd/scripts/setup-network.sh | 11 +++- - mkinitrd/scripts/setup-prepare.sh | 90 +++++++++++++++++++++++++++++------ - mkinitrd/scripts/setup-progs.sh | 4 - - mkinitrd/scripts/setup-scsi_dh.sh | 2 - mkinitrd/scripts/setup-sharedlibs.sh | 60 +++++++++++++---------- - 6 files changed, 124 insertions(+), 45 deletions(-) - -Index: 1115/mkinitrd/scripts/setup-ibft.sh -=================================================================== ---- 1115.orig/mkinitrd/scripts/setup-ibft.sh -+++ 1115/mkinitrd/scripts/setup-ibft.sh -@@ -22,23 +22,23 @@ ibft_set_iface() { - drvlink="$drvlink $(get_network_module $interface)" - if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then - nettype=dhcp - read ibft_dhcp < $ibft_nic/dhcp - [ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static - else - nettype=static - fi - fi - } - - ibft_nic=/sys/firmware/ibft/ethernet0 - ibft_nic2=/sys/firmware/ibft/ethernet1 --ibft_hostname=$(hostname) -+ibft_hostname=localhost - - if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then - ibft_available=1 - ibft_set_iface - fi - save_var ibft_available - save_var ibft_hostname - save_var ibft_nic - save_var ibft_nic2 -Index: 1115/mkinitrd/scripts/setup-network.sh -=================================================================== ---- 1115.orig/mkinitrd/scripts/setup-network.sh -+++ 1115/mkinitrd/scripts/setup-network.sh -@@ -287,27 +287,36 @@ if [ "$nettype" = "ifup" ] ; then - verbose "[NETWORK]\tifup: $interface" - fi - done - interface= - fi - - # Copy the /etc/resolv.conf when the IP is static - if test -n "$static_interfaces"; then - verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd" - cp /etc/resolv.conf $tmp_mnt/etc - fi - - # Copy netcfg files (bnc#468090, bnc#714945) --cp /etc/{hosts,protocols,services,netconfig} $tmp_mnt/etc -+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc -+cat > $tmp_mnt/etc/hosts <<_EOH_ -+127.0.0.1 localhost -+::1 localhost ipv6-localhost ipv6-loopback -+fe00::0 ipv6-localnet -+ff00::0 ipv6-mcastprefix -+ff02::1 ipv6-allnodes -+ff02::2 ipv6-allrouters -+ff02::3 ipv6-allhosts -+_EOH_ - - mkdir -p $tmp_mnt/var/lib/dhcpcd - mkdir -p $tmp_mnt/var/run - - cp_bin /lib/mkinitrd/bin/ipconfig.sh $tmp_mnt/bin/ipconfig - if [ -f /etc/udev/rules.d/70-persistent-net.rules ] ; then - cp /etc/udev/rules.d/70-persistent-net.rules $tmp_mnt/etc/udev/rules.d - fi - # XXX: This belongs to the if [ "$nettype" = "ifup" ] branch above, but we - # are being bug-compatible with previous versions of mkinitrd, which - # included these files unconditionally (bnc#891573). - if [ -f /etc/udev/rules.d/77-network.rules ] ; then - cp /etc/udev/rules.d/77-network.rules $tmp_mnt/etc/udev/rules.d -Index: 1115/mkinitrd/scripts/setup-prepare.sh -=================================================================== ---- 1115.orig/mkinitrd/scripts/setup-prepare.sh -+++ 1115/mkinitrd/scripts/setup-prepare.sh -@@ -13,43 +13,103 @@ - #%param_v: "Verbose mode." - #%param_L: "Disable logging." - #%param_h: "This help screen." - # - ###### Additional options - ## - ## Script inclusion may be overriden by - ## 1) creating a monster-initrd - ## 2) including the wanted module in the configuration option ADDITIONAL_FEATURES in /etc/sysconfig/initrd - ## 3) definition using the -f command line switch - ## - - # Install a binary file -+# cp_bin file target_filename -+# cp_bin file target_directory -+# cp_bin file file target_directory -+# file is either a regular file or a symlink. symlinks and all paths they point to will be copied -+# the "root" of target is $tmp_mnt, which is required to copy symlinks properly - cp_bin() { -- cp -a "$@" \ -- || exit_code=1 -+ local -a files -+ local target -+ local target_dirname -+ local file - -- # Remember the binaries installed. We need the list for checking -- # for dynamic libraries. -- while [ $# -gt 1 ]; do -- initrd_bins[${#initrd_bins[@]}]=$1 -- shift -- done -- # file may print '^setuid ELF ...' -- # suid mount will fail if mkinitrd was called as user -- if [ -L "$1" ]; then -- : do nothing with symlinks -- elif [ -d "$1" -o -f "$1" ]; then -- find "$1" -type f -print0 | xargs -0 chmod 0755 -- fi -+ # need at least two parameters, source and destination -+ if test $# -lt 2 -+ then -+ return 0 -+ fi -+ # store source filenames -+ until test $# -eq 1 -+ do -+ files=( ${files[@]} $1 ) -+ shift -+ done -+ # store target, either file or directory -+ target=$1 -+ # if more than two parameters, last entry must be a directory -+ if test ${#files[@]} -gt 1 -+ then -+ if ! test -d ${target} -+ then -+ return 0 -+ fi -+ target_dirname=${target} -+ else -+ # simplify symlink resolving for sinlge filename -+ target_dirname=${target%/*} -+ fi -+ -+ for file in ${files[@]} -+ do -+ local src dst -+ src=${file} -+ dst=${target} -+ # copy requested soure file as is to requested destination -+ cp -a -v --remove-destination ${src} ${dst} -+ # copy symlinks recursivly -+ while [ 1 ] -+ do -+ local tmp_src -+ if test -L ${src} -+ then -+ tmp_src=$(readlink ${src}) -+ if test "${tmp_src:0:1}" = "/" -+ then -+ src=${tmp_src} -+ else -+ # relative symlink -+ src=${src%/*}/${tmp_src} -+ fi -+ cp -a -v --remove-destination --parents ${src} $tmp_mnt -+ # if link target exists, proceed to next symlink target -+ if test -e "${src}" -+ then -+ continue -+ fi -+ fi -+ # exit loop in case of dead symlink or if target of symlink was reached -+ break -+ done -+ # if source file exists, add it to list of binaries -+ if test -e "${src}" -+ then -+ # file may print '^setuid ELF ...' -+ # suid mount will fail if mkinitrd was called as user -+ chmod -v 0755 $tmp_mnt/${src} -+ initrd_bins[${#initrd_bins[@]}]=${src} -+ fi -+ done - } - - # check if we should use script or feature $1 - use_script() { - local condition feature script file - - # always use when creating monster initrd - [ "$create_monster_initrd" ] && return 0 - - # Normalize to feature name - feature="${1##*/}" - feature="${feature#*-}" - feature="${feature%.sh}" -Index: 1115/mkinitrd/scripts/setup-progs.sh -=================================================================== ---- 1115.orig/mkinitrd/scripts/setup-progs.sh -+++ 1115/mkinitrd/scripts/setup-progs.sh -@@ -28,29 +28,29 @@ for script in $INITRD_PATH/boot/*.sh; do - echo "[ \"\$debug\" ] && echo running $file - source boot/$file - [ \"\$modules\" ] && load_modules" >> run_all.sh - [ "$condition" ] && echo "fi" >> run_all.sh - # and all programs it needs - for files in $(cat $script | grep '%programs: ' | sed 's/^#%programs: \(.*\)$/\1/'); do - for file in $(eval echo $files); do - if [ "${file:0:17}" = "/lib/mkinitrd/bin" ]; then - SOURCE=$file - DEST="./bin/" - elif [ "${file:0:1}" = "/" ]; then # absolute path files have to stay alive - SOURCE=$file - [ ! -e $file -a -e /usr$file ] && SOURCE="/usr$file" -- DEST=".$file" -+ DEST=".$SOURCE" - else - SOURCE=$(which "$file") -- DEST="./bin/" -+ DEST=".$SOURCE" - fi - cp_bin "$SOURCE" "$DEST" - done - done - fi - done - - echo -ne "Features: " - echo $features - - [ -e "bin/sh" ] || ln -s /bin/bash bin/sh - -Index: 1115/mkinitrd/scripts/setup-scsi_dh.sh -=================================================================== ---- 1115.orig/mkinitrd/scripts/setup-scsi_dh.sh -+++ 1115/mkinitrd/scripts/setup-scsi_dh.sh -@@ -1,13 +1,13 @@ - #!/bin/bash - # - #%stage: device - # - # Include all scsi_dh_* modules and load them on boot (bnc#727428 et al) - - scsi_dh_modules= --for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko"); do -+for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko" | sort); do - i=${i%.ko} - scsi_dh_modules="$scsi_dh_modules ${i##*/}" - done - - save_var scsi_dh_modules -Index: 1115/mkinitrd/scripts/setup-sharedlibs.sh -=================================================================== ---- 1115.orig/mkinitrd/scripts/setup-sharedlibs.sh -+++ 1115/mkinitrd/scripts/setup-sharedlibs.sh -@@ -54,58 +54,68 @@ shared_object_files() { - while [ -L "/$lib" ]; do - echo $lib - link="$(readlink "/$lib")" - if [ x"${link:0:1}" == x"/" ]; then - lib=${link#/} - else - lib="${lib%/*}/$link" - fi - done - echo $lib - done - } - --verbose -ne "Shared libs:\t" --# Copy all required shared libraries and the symlinks that --# refer to them. --lib_files=$(shared_object_files "${initrd_bins[@]}") --[ $? -eq 0 ] || return 1 --if [ -n "$lib_files" ]; then -- for lib in $lib_files; do -- [ -L $root_dir/$lib ] || verbose -n "$lib " -- ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt ) -- done -- lib_files= -+copy_shared_libs() { -+ local bins=( "$@" ) -+ local extra_lib_files lib_files lib i -+ -+ # First see what nss and other libs are required. This can be 64bit or 32bit, -+ # depending on the host and the already copied binaries. - case "$(uname -m)" in - alpha|ia64) -+ # this is a known location - mkdir -p $tmp_mnt/lib -- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`" -+ extra_lib_files="`echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`" - ;; - *) -- # no symlinks, most point into the running system -- for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev/,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u` -+ # Skip symlinks, they may point into the running system instead of $tmp_mnt -+ for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u` - do - case "$i" in - 32-bit) - mkdir -p $tmp_mnt/lib -- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`" -+ extra_lib_files="$extra_lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`" - ;; - 64-bit) - mkdir -p $tmp_mnt/lib64 -- lib_files="$lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`" -+ extra_lib_files="$extra_lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`" - ;; - esac - done - ;; - esac - -- for lib in $lib_files ; do -- if [ -f $lib ] ; then -- verbose -n "${lib##$root_dir/} " -- cp -dp --parents $lib $tmp_mnt -+ verbose -ne "Shared libs:\t" -+ -+ # Now collect a list of libraries on which the binaries and extra libs depend on -+ lib_files=$( shared_object_files ${bins[@]} $extra_lib_files ) -+ if [ $? -eq 0 ] -+ then -+ if [ -n "$lib_files" ] -+ then -+ # Finally copy dependencies and extra libs -+ for lib in $lib_files $extra_lib_files -+ do -+ [ -L $root_dir/$lib ] || verbose -n "$lib " -+ ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt ) -+ done -+ verbose -+ else -+ verbose "none" - fi -- done -- verbose --else -- verbose "none" --fi -+ else -+ return 1 -+ fi -+} - -+# Copy all required shared libraries and the symlinks that refer to them. -+copy_shared_libs "${initrd_bins[@]}" diff --git a/libguestfs.mkinitrd.1140.patch b/libguestfs.mkinitrd.1140.patch deleted file mode 100644 index 81f03d4..0000000 --- a/libguestfs.mkinitrd.1140.patch +++ /dev/null @@ -1,388 +0,0 @@ ---- - mkinitrd/scripts/setup-ibft.sh | 2 - mkinitrd/scripts/setup-network.sh | 14 ++++- - mkinitrd/scripts/setup-prepare.sh | 94 ++++++++++++++++++++++++++++------- - mkinitrd/scripts/setup-progs.sh | 17 +----- - mkinitrd/scripts/setup-sharedlibs.sh | 60 +++++++++++++--------- - 5 files changed, 127 insertions(+), 60 deletions(-) - -Index: 1140/mkinitrd/scripts/setup-ibft.sh -=================================================================== ---- 1140.orig/mkinitrd/scripts/setup-ibft.sh -+++ 1140/mkinitrd/scripts/setup-ibft.sh -@@ -9,22 +9,22 @@ ibft_set_iface() { - interface=$if - drvlink=$(get_network_module $interface) - if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then - nettype=dhcp - read ibft_dhcp < $ibft_nic/dhcp - [ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static - else - nettype=static - fi - } - } - - ibft_nic=/sys/firmware/ibft/ethernet0 --ibft_hostname=$(hostname) -+ibft_hostname=localhost - - if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then - ibft_available=1 - ibft_set_iface - fi - save_var ibft_available - save_var ibft_hostname - save_var ibft_nic -Index: 1140/mkinitrd/scripts/setup-network.sh -=================================================================== ---- 1140.orig/mkinitrd/scripts/setup-network.sh -+++ 1140/mkinitrd/scripts/setup-network.sh -@@ -231,29 +231,37 @@ if [ "$nettype" = "ifup" ] ; then - drvlink="$drvlink $mod" - verbose "[NETWORK]\t$interface ($nettype)" - fi - done - interface= - fi - - # Copy the /etc/resolv.conf when the IP is static - if [ "$interface" -a "$nettype" = "static" -a -f /etc/resolv.conf ] ; then - verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd" - cp /etc/resolv.conf $tmp_mnt/etc - fi - --# Copy /etc/hosts in any case to be able to resolve static host names in the --# initrd (bnc #468090) --cp /etc/hosts $tmp_mnt/etc -+# Copy netcfg files (bnc#468090, bnc#714945) -+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc -+cat > $tmp_mnt/etc/hosts <<_EOH_ -+127.0.0.1 localhost -+::1 localhost ipv6-localhost ipv6-loopback -+fe00::0 ipv6-localnet -+ff00::0 ipv6-mcastprefix -+ff02::1 ipv6-allnodes -+ff02::2 ipv6-allrouters -+ff02::3 ipv6-allhosts -+_EOH_ - - # Get static IP configuration if requested - if [ "$interface" -a "$nettype" = "static" ] ; then - ip=$(get_ip_config $interface) - fi - - mkdir -p $tmp_mnt/var/lib/dhcpcd - mkdir -p $tmp_mnt/var/run - - cp_bin /lib/mkinitrd/bin/ipconfig.sh $tmp_mnt/bin/ipconfig - if [ -f /etc/udev/rules.d/70-persistent-net.rules ] ; then - cp /etc/udev/rules.d/70-persistent-net.rules $tmp_mnt/etc/udev/rules.d - fi -Index: 1140/mkinitrd/scripts/setup-prepare.sh -=================================================================== ---- 1140.orig/mkinitrd/scripts/setup-prepare.sh -+++ 1140/mkinitrd/scripts/setup-prepare.sh -@@ -13,43 +13,103 @@ - #%param_R: "Print release (version)." - #%param_L: "Disable logging." - #%param_h: "This help screen." - # - ###### Additional options - ## - ## Script inclusion may be overriden by - ## 1) creating a monster-initrd - ## 2) including the wanted module in the configuration option ADDITIONAL_FEATURES in /etc/sysconfig/initrd - ## 3) definition using the -f command line switch - ## - - # Install a binary file -+# cp_bin file target_filename -+# cp_bin file target_directory -+# cp_bin file file target_directory -+# file is either a regular file or a symlink. symlinks and all paths they point to will be copied -+# the "root" of target is $tmp_mnt, which is required to copy symlinks properly - cp_bin() { -- cp -a "$@" \ -- || exit_code=1 -- -- # Remember the binaries installed. We need the list for checking -- # for dynamic libraries. -- while [ $# -gt 1 ]; do -- initrd_bins[${#initrd_bins[@]}]=$1 -- shift -- done -- # file may print '^setuid ELF ...' -- # suid mount will fail if mkinitrd was called as user -- if [ -L "$1" ]; then -- : do nothing with symlinks -- elif [ -d "$1" -o -f "$1" ]; then -- find "$1" -type f -print0 | xargs -0 chmod 0755 -- fi -+ local -a files -+ local target -+ local target_dirname -+ local file -+ -+ # need at least two parameters, source and destination -+ if test $# -lt 2 -+ then -+ return 0 -+ fi -+ # store source filenames -+ until test $# -eq 1 -+ do -+ files=( ${files[@]} $1 ) -+ shift -+ done -+ # store target, either file or directory -+ target=$1 -+ # if more than two parameters, last entry must be a directory -+ if test ${#files[@]} -gt 1 -+ then -+ if ! test -d ${target} -+ then -+ return 0 -+ fi -+ target_dirname=${target} -+ else -+ # simplify symlink resolving for sinlge filename -+ target_dirname=${target%/*} -+ fi -+ -+ for file in ${files[@]} -+ do -+ local src dst -+ src=${file} -+ dst=${target} -+ # copy requested soure file as is to requested destination -+ cp -a -v --remove-destination ${src} ${dst} -+ # copy symlinks recursivly -+ while [ 1 ] -+ do -+ local tmp_src -+ if test -L ${src} -+ then -+ tmp_src=$(readlink ${src}) -+ if test "${tmp_src:0:1}" = "/" -+ then -+ src=${tmp_src} -+ else -+ # relative symlink -+ src=${src%/*}/${tmp_src} -+ fi -+ cp -a -v --remove-destination --parents ${src} $tmp_mnt -+ # if link target exists, proceed to next symlink target -+ if test -e "${src}" -+ then -+ continue -+ fi -+ fi -+ # exit loop in case of dead symlink or if target of symlink was reached -+ break -+ done -+ # if source file exists, add it to list of binaries -+ if test -e "${src}" -+ then -+ # file may print '^setuid ELF ...' -+ # suid mount will fail if mkinitrd was called as user -+ chmod -v 0755 $tmp_mnt/${src} -+ initrd_bins[${#initrd_bins[@]}]=${src} -+ fi -+ done - } - - # check if we should use script or feature $1 - use_script() { - local condition feature script file - - # always use when creating monster initrd - [ "$create_monster_initrd" ] && return 0 - - # Normalize to feature name - feature="${1##*/}" - feature="${feature#*-}" - feature="${feature%.sh}" -@@ -143,27 +203,27 @@ fi - for feature in $ADDITIONAL_FEATURES ; do - feature_exists "$feature" || echo "[WARNING] Feature \"$feature\" not found. A typo?" - done - - # create an empty initrd - if ! mkdir $tmp_mnt ; then - error 1 "could not create temporary directory" - fi - - # fill the initrd - cp $INITRD_PATH/bin/linuxrc $linuxrc - mkdir "$tmp_mnt/boot" - --mkdir -p $tmp_mnt/{sbin,bin,etc,dev,proc,sys,root,config} -+mkdir -p $tmp_mnt/{sbin,bin,etc,dev,proc,sys,root,config,usr/bin,usr/sbin} - - mkdir -p -m 4777 $tmp_mnt/tmp - - # Create a dummy /etc/mtab for mount/umount - echo -n > $tmp_mnt/etc/mtab - - # Add modprobe, modprobe.conf*, and a version of /bin/true: modprobe.conf - # might use it. - for mod in $root_dir/etc/modprobe.conf $root_dir/etc/modprobe.conf.local \ - $root_dir/etc/modprobe.d ; do - test -e $mod && cp -r $mod $tmp_mnt/etc - done - cat > $tmp_mnt/bin/true <<-EOF -Index: 1140/mkinitrd/scripts/setup-progs.sh -=================================================================== ---- 1140.orig/mkinitrd/scripts/setup-progs.sh -+++ 1140/mkinitrd/scripts/setup-progs.sh -@@ -24,48 +24,37 @@ for script in $INITRD_PATH/boot/*.sh; do - condition="$(sed -rn 's/^#[[:blank:]]*%if:[[:blank:]]*(.*)$/if [ \1 ]; then/p' < "$script")" - echo "$condition" >> run_all.sh - # -- remember dependent modules - sed -rn 's/^#[[:blank:]]*%modules:[[:blank:]]*(.*)$/modules="\1"/p' < $script >> run_all.sh - echo "[ \"\$debug\" ] && echo running $file - source boot/$file - [ \"\$modules\" ] && load_modules" >> run_all.sh - [ "$condition" ] && echo "fi" >> run_all.sh - # and all programs it needs - for files in $(sed -rn 's/^#[[:blank:]]*%programs:[[:blank:]]*(.*)$/\1/p' < "$script"); do - for file in $(eval echo $files); do - if [ "${file:0:17}" = "/lib/mkinitrd/bin" ]; then - SOURCE=$file -- DEST="./bin/" -+ DEST="${tmp_mnt}/bin/" - elif [ "${file:0:1}" = "/" ]; then # absolute path files have to stay alive - SOURCE=$file - [ ! -e $file -a -e /usr$file ] && SOURCE="/usr$file" -- DEST=".$file" -+ DEST="${tmp_mnt}$SOURCE" - else - case "$(type -t "$file")" in - builtin) continue - esac - SOURCE=$(type -p "$file") -- DEST="./bin/" -+ DEST="${tmp_mnt}$SOURCE" - fi - - cp_bin "$SOURCE" "$DEST" -- -- # if we're given a symlink, always copy the linked file too -- if [ -L "$SOURCE" ]; then -- LINK=$(readlink -e "$SOURCE") -- if [ -e "$LINK" ]; then -- mkdir -p .$(dirname "$LINK") -- cp_bin "$LINK" ."$LINK" -- else -- echo 2>&1 "WARNING: $LINK is a dangling symlink" -- fi -- fi - done - done - fi - done - - echo -ne "Features: " - echo $features - - [ -e "bin/sh" ] || ln -s /bin/bash bin/sh - -Index: 1140/mkinitrd/scripts/setup-sharedlibs.sh -=================================================================== ---- 1140.orig/mkinitrd/scripts/setup-sharedlibs.sh -+++ 1140/mkinitrd/scripts/setup-sharedlibs.sh -@@ -54,58 +54,68 @@ shared_object_files() { - while [ -L "/$lib" ]; do - echo $lib - link="$(readlink "/$lib")" - if [ x"${link:0:1}" == x"/" ]; then - lib=${link#/} - else - lib="${lib%/*}/$link" - fi - done - echo $lib - done - } - --verbose -ne "Shared libs:\t" --# Copy all required shared libraries and the symlinks that --# refer to them. --lib_files=$(shared_object_files "${initrd_bins[@]}") --[ $? -eq 0 ] || return 1 --if [ -n "$lib_files" ]; then -- for lib in $lib_files; do -- [ -L $root_dir/$lib ] || verbose -n "$lib " -- ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt ) -- done -- lib_files= -+copy_shared_libs() { -+ local bins=( "$@" ) -+ local extra_lib_files lib_files lib i -+ -+ # First see what nss and other libs are required. This can be 64bit or 32bit, -+ # depending on the host and the already copied binaries. - case "$(uname -m)" in - ia64) -+ # this is a known location - mkdir -p $tmp_mnt/lib -- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`" -+ extra_lib_files="`echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`" - ;; - *) -- # no symlinks, most point into the running system -- for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev/,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u` -+ # Skip symlinks, they may point into the running system instead of $tmp_mnt -+ for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u` - do - case "$i" in - 32-bit) - mkdir -p $tmp_mnt/lib -- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`" -+ extra_lib_files="$extra_lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`" - ;; - 64-bit) - mkdir -p $tmp_mnt/lib64 -- lib_files="$lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`" -+ extra_lib_files="$extra_lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`" - ;; - esac - done - ;; - esac - -- for lib in $lib_files ; do -- if [ -f $lib ] ; then -- verbose -n "${lib##$root_dir/} " -- cp -dp --parents $lib $tmp_mnt -+ verbose -ne "Shared libs:\t" -+ -+ # Now collect a list of libraries on which the binaries and extra libs depend on -+ lib_files=$( shared_object_files ${bins[@]} $extra_lib_files ) -+ if [ $? -eq 0 ] -+ then -+ if [ -n "$lib_files" ] -+ then -+ # Finally copy dependencies and extra libs -+ for lib in $lib_files $extra_lib_files -+ do -+ [ -L $root_dir/$lib ] || verbose -n "$lib " -+ ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt ) -+ done -+ verbose -+ else -+ verbose "none" - fi -- done -- verbose --else -- verbose "none" --fi -+ else -+ return 1 -+ fi -+} - -+# Copy all required shared libraries and the symlinks that refer to them. -+copy_shared_libs "${initrd_bins[@]}" diff --git a/libguestfs.mkinitrd.1210.patch b/libguestfs.mkinitrd.1210.patch deleted file mode 100644 index 073f34a..0000000 --- a/libguestfs.mkinitrd.1210.patch +++ /dev/null @@ -1,385 +0,0 @@ ---- - mkinitrd/scripts/setup-ibft.sh | 2 - mkinitrd/scripts/setup-network.sh | 11 +++- - mkinitrd/scripts/setup-prepare.sh | 94 ++++++++++++++++++++++++++++------- - mkinitrd/scripts/setup-progs.sh | 17 +----- - mkinitrd/scripts/setup-sharedlibs.sh | 60 +++++++++++++--------- - 5 files changed, 126 insertions(+), 58 deletions(-) - -Index: 1210/mkinitrd/scripts/setup-ibft.sh -=================================================================== ---- 1210.orig/mkinitrd/scripts/setup-ibft.sh -+++ 1210/mkinitrd/scripts/setup-ibft.sh -@@ -9,22 +9,22 @@ ibft_set_iface() { - interface=$if - drvlink=$(get_network_module $interface) - if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then - nettype=dhcp - read ibft_dhcp < $ibft_nic/dhcp - [ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static - else - nettype=static - fi - } - } - - ibft_nic=/sys/firmware/ibft/ethernet0 --ibft_hostname=$(hostname) -+ibft_hostname=localhost - - if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then - ibft_available=1 - ibft_set_iface - fi - save_var ibft_available - save_var ibft_hostname - save_var ibft_nic -Index: 1210/mkinitrd/scripts/setup-network.sh -=================================================================== ---- 1210.orig/mkinitrd/scripts/setup-network.sh -+++ 1210/mkinitrd/scripts/setup-network.sh -@@ -277,27 +277,36 @@ if [ "$nettype" = "ifup" ] ; then - verbose "[NETWORK]\tifup: $interface" - fi - done - interface= - fi - - # Copy the /etc/resolv.conf when the IP is static - if test -n "$static_interfaces"; then - verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd" - cp /etc/resolv.conf $tmp_mnt/etc - fi - - # Copy netcfg files (bnc#468090, bnc#714945) --cp /etc/{hosts,protocols,services,netconfig} $tmp_mnt/etc -+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc -+cat > $tmp_mnt/etc/hosts <<_EOH_ -+127.0.0.1 localhost -+::1 localhost ipv6-localhost ipv6-loopback -+fe00::0 ipv6-localnet -+ff00::0 ipv6-mcastprefix -+ff02::1 ipv6-allnodes -+ff02::2 ipv6-allrouters -+ff02::3 ipv6-allhosts -+_EOH_ - - # Get static IP configuration if requested - for iface in $static_interfaces; do - static_ips="$static_ips $(get_ip_config $iface)" - done - - mkdir -p $tmp_mnt/var/lib/dhcpcd - mkdir -p $tmp_mnt/var/run - - cp_bin /lib/mkinitrd/bin/ipconfig.sh $tmp_mnt/bin/ipconfig - if [ -f /etc/udev/rules.d/70-persistent-net.rules ] ; then - cp /etc/udev/rules.d/70-persistent-net.rules $tmp_mnt/etc/udev/rules.d - fi -Index: 1210/mkinitrd/scripts/setup-prepare.sh -=================================================================== ---- 1210.orig/mkinitrd/scripts/setup-prepare.sh -+++ 1210/mkinitrd/scripts/setup-prepare.sh -@@ -13,43 +13,103 @@ - #%param_R: "Print release (version)." - #%param_L: "Disable logging." - #%param_h: "This help screen." - # - ###### Additional options - ## - ## Script inclusion may be overriden by - ## 1) creating a monster-initrd - ## 2) including the wanted module in the configuration option ADDITIONAL_FEATURES in /etc/sysconfig/initrd - ## 3) definition using the -f command line switch - ## - - # Install a binary file -+# cp_bin file target_filename -+# cp_bin file target_directory -+# cp_bin file file target_directory -+# file is either a regular file or a symlink. symlinks and all paths they point to will be copied -+# the "root" of target is $tmp_mnt, which is required to copy symlinks properly - cp_bin() { -- cp -a "$@" \ -- || exit_code=1 -- -- # Remember the binaries installed. We need the list for checking -- # for dynamic libraries. -- while [ $# -gt 1 ]; do -- initrd_bins[${#initrd_bins[@]}]=$1 -- shift -- done -- # file may print '^setuid ELF ...' -- # suid mount will fail if mkinitrd was called as user -- if [ -L "$1" ]; then -- : do nothing with symlinks -- elif [ -d "$1" -o -f "$1" ]; then -- find "$1" -type f -print0 | xargs -0 chmod 0755 -- fi -+ local -a files -+ local target -+ local target_dirname -+ local file -+ -+ # need at least two parameters, source and destination -+ if test $# -lt 2 -+ then -+ return 0 -+ fi -+ # store source filenames -+ until test $# -eq 1 -+ do -+ files=( ${files[@]} $1 ) -+ shift -+ done -+ # store target, either file or directory -+ target=$1 -+ # if more than two parameters, last entry must be a directory -+ if test ${#files[@]} -gt 1 -+ then -+ if ! test -d ${target} -+ then -+ return 0 -+ fi -+ target_dirname=${target} -+ else -+ # simplify symlink resolving for sinlge filename -+ target_dirname=${target%/*} -+ fi -+ -+ for file in ${files[@]} -+ do -+ local src dst -+ src=${file} -+ dst=${target} -+ # copy requested soure file as is to requested destination -+ cp -a -v --remove-destination ${src} ${dst} -+ # copy symlinks recursivly -+ while [ 1 ] -+ do -+ local tmp_src -+ if test -L ${src} -+ then -+ tmp_src=$(readlink ${src}) -+ if test "${tmp_src:0:1}" = "/" -+ then -+ src=${tmp_src} -+ else -+ # relative symlink -+ src=${src%/*}/${tmp_src} -+ fi -+ cp -a -v --remove-destination --parents ${src} $tmp_mnt -+ # if link target exists, proceed to next symlink target -+ if test -e "${src}" -+ then -+ continue -+ fi -+ fi -+ # exit loop in case of dead symlink or if target of symlink was reached -+ break -+ done -+ # if source file exists, add it to list of binaries -+ if test -e "${src}" -+ then -+ # file may print '^setuid ELF ...' -+ # suid mount will fail if mkinitrd was called as user -+ chmod -v 0755 $tmp_mnt/${src} -+ initrd_bins[${#initrd_bins[@]}]=${src} -+ fi -+ done - } - - # check if we should use script or feature $1 - use_script() { - local condition feature script file - - # always use when creating monster initrd - [ "$create_monster_initrd" ] && return 0 - - # Normalize to feature name - feature="${1##*/}" - feature="${feature#*-}" - feature="${feature%.sh}" -@@ -143,27 +203,27 @@ fi - for feature in $ADDITIONAL_FEATURES ; do - feature_exists "$feature" || echo "[WARNING] Feature \"$feature\" not found. A typo?" - done - - # create an empty initrd - if ! mkdir $tmp_mnt ; then - error 1 "could not create temporary directory" - fi - - # fill the initrd - cp $INITRD_PATH/bin/linuxrc $linuxrc - mkdir "$tmp_mnt/boot" - --mkdir -p $tmp_mnt/{sbin,bin,etc,dev,proc,sys,root,config} -+mkdir -p $tmp_mnt/{sbin,bin,etc,dev,proc,sys,root,config,usr/bin,usr/sbin} - - mkdir -p -m 4777 $tmp_mnt/tmp - - # Create a dummy /etc/mtab for mount/umount - echo -n > $tmp_mnt/etc/mtab - - # Add modprobe, modprobe.conf*, and a version of /bin/true: modprobe.conf - # might use it. - for mod in $root_dir/etc/modprobe.conf $root_dir/etc/modprobe.conf.local \ - $root_dir/etc/modprobe.d ; do - test -e $mod && cp -r $mod $tmp_mnt/etc - done - cat > $tmp_mnt/bin/true <<-EOF -Index: 1210/mkinitrd/scripts/setup-progs.sh -=================================================================== ---- 1210.orig/mkinitrd/scripts/setup-progs.sh -+++ 1210/mkinitrd/scripts/setup-progs.sh -@@ -24,48 +24,37 @@ for script in $INITRD_PATH/boot/*.sh; do - condition="$(sed -rn 's/^#[[:blank:]]*%if:[[:blank:]]*(.*)$/if [ \1 ]; then/p' < "$script")" - echo "$condition" >> run_all.sh - # -- remember dependent modules - sed -rn 's/^#[[:blank:]]*%modules:[[:blank:]]*(.*)$/modules="\1"/p' < $script >> run_all.sh - echo "[ \"\$debug\" ] && echo running $file - source boot/$file - [ \"\$modules\" ] && load_modules" >> run_all.sh - [ "$condition" ] && echo "fi" >> run_all.sh - # and all programs it needs - for files in $(sed -rn 's/^#[[:blank:]]*%programs:[[:blank:]]*(.*)$/\1/p' < "$script"); do - for file in $(eval echo $files); do - if [ "${file:0:17}" = "/lib/mkinitrd/bin" ]; then - SOURCE=$file -- DEST="./bin/" -+ DEST="${tmp_mnt}/bin/" - elif [ "${file:0:1}" = "/" ]; then # absolute path files have to stay alive - SOURCE=$file - [ ! -e $file -a -e /usr$file ] && SOURCE="/usr$file" -- DEST=".$file" -+ DEST="${tmp_mnt}$SOURCE" - else - case "$(type -t "$file")" in - builtin) continue - esac - SOURCE=$(type -p "$file") -- DEST="./bin/" -+ DEST="${tmp_mnt}$SOURCE" - fi - - cp_bin "$SOURCE" "$DEST" -- -- # if we're given a symlink, always copy the linked file too -- if [ -L "$SOURCE" ]; then -- LINK=$(readlink -e "$SOURCE") -- if [ -e "$LINK" ]; then -- mkdir -p .$(dirname "$LINK") -- cp_bin "$LINK" ."$LINK" -- else -- echo 2>&1 "WARNING: $LINK is a dangling symlink" -- fi -- fi - done - done - fi - done - - echo -ne "Features: " - echo $features - - [ -e "bin/sh" ] || ln -s /bin/bash bin/sh - -Index: 1210/mkinitrd/scripts/setup-sharedlibs.sh -=================================================================== ---- 1210.orig/mkinitrd/scripts/setup-sharedlibs.sh -+++ 1210/mkinitrd/scripts/setup-sharedlibs.sh -@@ -54,58 +54,68 @@ shared_object_files() { - while [ -L "/$lib" ]; do - echo $lib - link="$(readlink "/$lib")" - if [ x"${link:0:1}" == x"/" ]; then - lib=${link#/} - else - lib="${lib%/*}/$link" - fi - done - echo $lib - done - } - --verbose -ne "Shared libs:\t" --# Copy all required shared libraries and the symlinks that --# refer to them. --lib_files=$(shared_object_files "${initrd_bins[@]}") --[ $? -eq 0 ] || return 1 --if [ -n "$lib_files" ]; then -- for lib in $lib_files; do -- [ -L $root_dir/$lib ] || verbose -n "$lib " -- ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt ) -- done -- lib_files= -+copy_shared_libs() { -+ local bins=( "$@" ) -+ local extra_lib_files lib_files lib i -+ -+ # First see what nss and other libs are required. This can be 64bit or 32bit, -+ # depending on the host and the already copied binaries. - case "$(uname -m)" in - ia64) -+ # this is a known location - mkdir -p $tmp_mnt/lib -- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`" -+ extra_lib_files="`echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`" - ;; - *) -- # no symlinks, most point into the running system -- for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev/,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u` -+ # Skip symlinks, they may point into the running system instead of $tmp_mnt -+ for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u` - do - case "$i" in - 32-bit) - mkdir -p $tmp_mnt/lib -- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`" -+ extra_lib_files="$extra_lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`" - ;; - 64-bit) - mkdir -p $tmp_mnt/lib64 -- lib_files="$lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`" -+ extra_lib_files="$extra_lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`" - ;; - esac - done - ;; - esac - -- for lib in $lib_files ; do -- if [ -f $lib ] ; then -- verbose -n "${lib##$root_dir/} " -- cp -dp --parents $lib $tmp_mnt -+ verbose -ne "Shared libs:\t" -+ -+ # Now collect a list of libraries on which the binaries and extra libs depend on -+ lib_files=$( shared_object_files ${bins[@]} $extra_lib_files ) -+ if [ $? -eq 0 ] -+ then -+ if [ -n "$lib_files" ] -+ then -+ # Finally copy dependencies and extra libs -+ for lib in $lib_files $extra_lib_files -+ do -+ [ -L $root_dir/$lib ] || verbose -n "$lib " -+ ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt ) -+ done -+ verbose -+ else -+ verbose "none" - fi -- done -- verbose --else -- verbose "none" --fi -+ else -+ return 1 -+ fi -+} - -+# Copy all required shared libraries and the symlinks that refer to them. -+copy_shared_libs "${initrd_bins[@]}" diff --git a/libguestfs.mkinitrd.1220.patch b/libguestfs.mkinitrd.1220.patch deleted file mode 100644 index 03464f0..0000000 --- a/libguestfs.mkinitrd.1220.patch +++ /dev/null @@ -1,410 +0,0 @@ ---- - mkinitrd/scripts/setup-ibft.sh | 2 - mkinitrd/scripts/setup-network.sh | 11 ++- - mkinitrd/scripts/setup-prepare.sh | 126 +++++++++++++++++++++-------------- - mkinitrd/scripts/setup-progs.sh | 17 ---- - mkinitrd/scripts/setup-scsi_dh.sh | 2 - mkinitrd/scripts/setup-sharedlibs.sh | 60 +++++++++------- - 6 files changed, 126 insertions(+), 92 deletions(-) - -Index: 1220/mkinitrd/scripts/setup-ibft.sh -=================================================================== ---- 1220.orig/mkinitrd/scripts/setup-ibft.sh -+++ 1220/mkinitrd/scripts/setup-ibft.sh -@@ -21,22 +21,22 @@ ibft_set_iface() { - interface=$iface - drvlink=$(get_network_module $interface) - if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then - nettype=dhcp - read ibft_dhcp < $ibft_nic/dhcp - [ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static - else - nettype=static - fi - fi - } - - ibft_nic=/sys/firmware/ibft/ethernet0 --ibft_hostname=$(hostname) -+ibft_hostname=localhost - - if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then - ibft_available=1 - ibft_set_iface - fi - save_var ibft_available - save_var ibft_hostname - save_var ibft_nic -Index: 1220/mkinitrd/scripts/setup-network.sh -=================================================================== ---- 1220.orig/mkinitrd/scripts/setup-network.sh -+++ 1220/mkinitrd/scripts/setup-network.sh -@@ -278,27 +278,36 @@ if [ "$nettype" = "ifup" ] ; then - verbose "[NETWORK]\tifup: $interface" - fi - done - interface= - fi - - # Copy the /etc/resolv.conf when the IP is static - if test -n "$static_interfaces"; then - verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd" - cp /etc/resolv.conf $tmp_mnt/etc - fi - - # Copy netcfg files (bnc#468090, bnc#714945) --cp /etc/{hosts,protocols,services,netconfig} $tmp_mnt/etc -+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc -+cat > $tmp_mnt/etc/hosts <<_EOH_ -+127.0.0.1 localhost -+::1 localhost ipv6-localhost ipv6-loopback -+fe00::0 ipv6-localnet -+ff00::0 ipv6-mcastprefix -+ff02::1 ipv6-allnodes -+ff02::2 ipv6-allrouters -+ff02::3 ipv6-allhosts -+_EOH_ - - # Get static IP configuration if requested - for iface in $static_interfaces; do - static_ips="$static_ips $(get_ip_config $iface)" - done - - mkdir -p $tmp_mnt/var/lib/dhcpcd - mkdir -p $tmp_mnt/var/run - - cp_bin /lib/mkinitrd/bin/ipconfig.sh $tmp_mnt/bin/ipconfig - if [ -f /etc/udev/rules.d/70-persistent-net.rules ] ; then - cp /etc/udev/rules.d/70-persistent-net.rules $tmp_mnt/etc/udev/rules.d - fi -Index: 1220/mkinitrd/scripts/setup-prepare.sh -=================================================================== ---- 1220.orig/mkinitrd/scripts/setup-prepare.sh -+++ 1220/mkinitrd/scripts/setup-prepare.sh -@@ -13,77 +13,103 @@ - #%param_R: "Print release (version)." - #%param_L: "Disable logging." - #%param_h: "This help screen." - # - ###### Additional options - ## - ## Script inclusion may be overriden by - ## 1) creating a monster-initrd - ## 2) including the wanted module in the configuration option ADDITIONAL_FEATURES in /etc/sysconfig/initrd - ## 3) definition using the -f command line switch - ## - - # Install a binary file --cp_link() { -- # Copy the target of the given link $1 to the destination $2 -- # spaces and special characters in file names will break things -- if [ -h "$1" ]; then -- lnkTarget=$(readlink $1) -- if [ -e $lnkTarget ];then -- cp -a $lnkTarget $2/$lnkTarget -- else -- # This link points to something in the same directory -- lnkSrc="$1" -- # Get the base bath of the link origin -- lnkSrcBase=${lnkSrc%/*} -- cp -a $lnkSrcBase/$lnkTarget $2/$lnkSrcBase/$lnkTarget -- fi -- return 1 -- fi -- return 0 --} -- -+# cp_bin file target_filename -+# cp_bin file target_directory -+# cp_bin file file target_directory -+# file is either a regular file or a symlink. symlinks and all paths they point to will be copied -+# the "root" of target is $tmp_mnt, which is required to copy symlinks properly - cp_bin() { -- cp -a "$@" \ -- || exit_code=1 -- -- if [ -h "$1" ]; then -- lnkTarget=$1 -- # Determine the base bath of the target -- targetPath="$2" -- targetBase=${targetPath%$1*} -- while [ 1 ]; do -- cp_link $lnkTarget $targetBase -- lnkCopied=$? -- if [ $lnkCopied = 0 ]; then -- if [ -e $lnkTarget ]; then -- initrd_bins[${#initrd_bins[@]}]=$lnkTarget -- fi -- break -- fi -- done -- else -- # Remember the binaries installed. We need the list for checking -- # for dynamic libraries. -- while [ $# -gt 1 ]; do -- initrd_bins[${#initrd_bins[@]}]=$1 -- shift -- done -- # file may print '^setuid ELF ...' -- # suid mount will fail if mkinitrd was called as user -- if [ -d "$1" -o -f "$1" ]; then -- find "$1" -type f -print0 | xargs -0 chmod 0755 -- fi -- fi -+ local -a files -+ local target -+ local target_dirname -+ local file -+ -+ # need at least two parameters, source and destination -+ if test $# -lt 2 -+ then -+ return 0 -+ fi -+ # store source filenames -+ until test $# -eq 1 -+ do -+ files=( ${files[@]} $1 ) -+ shift -+ done -+ # store target, either file or directory -+ target=$1 -+ # if more than two parameters, last entry must be a directory -+ if test ${#files[@]} -gt 1 -+ then -+ if ! test -d ${target} -+ then -+ return 0 -+ fi -+ target_dirname=${target} -+ else -+ # simplify symlink resolving for sinlge filename -+ target_dirname=${target%/*} -+ fi -+ -+ for file in ${files[@]} -+ do -+ local src dst -+ src=${file} -+ dst=${target} -+ # copy requested soure file as is to requested destination -+ cp -a -v --remove-destination ${src} ${dst} -+ # copy symlinks recursivly -+ while [ 1 ] -+ do -+ local tmp_src -+ if test -L ${src} -+ then -+ tmp_src=$(readlink ${src}) -+ if test "${tmp_src:0:1}" = "/" -+ then -+ src=${tmp_src} -+ else -+ # relative symlink -+ src=${src%/*}/${tmp_src} -+ fi -+ cp -a -v --remove-destination --parents ${src} $tmp_mnt -+ # if link target exists, proceed to next symlink target -+ if test -e "${src}" -+ then -+ continue -+ fi -+ fi -+ # exit loop in case of dead symlink or if target of symlink was reached -+ break -+ done -+ # if source file exists, add it to list of binaries -+ if test -e "${src}" -+ then -+ # file may print '^setuid ELF ...' -+ # suid mount will fail if mkinitrd was called as user -+ chmod -v 0755 $tmp_mnt/${src} -+ initrd_bins[${#initrd_bins[@]}]=${src} -+ fi -+ done - } - - # check if we should use script or feature $1 - use_script() { - local condition feature script file - - # always use when creating monster initrd - [ "$create_monster_initrd" ] && return 0 - - # Normalize to feature name - feature="${1##*/}" - feature="${feature#*-}" - feature="${feature%.sh}" -Index: 1220/mkinitrd/scripts/setup-progs.sh -=================================================================== ---- 1220.orig/mkinitrd/scripts/setup-progs.sh -+++ 1220/mkinitrd/scripts/setup-progs.sh -@@ -24,48 +24,37 @@ for script in $INITRD_PATH/boot/*.sh; do - condition="$(sed -rn 's/^#[[:blank:]]*%if:[[:blank:]]*(.*)$/if [ \1 ]; then/p' < "$script")" - echo "$condition" >> run_all.sh - # -- remember dependent modules - sed -rn 's/^#[[:blank:]]*%modules:[[:blank:]]*(.*)$/modules="\1"/p' < $script >> run_all.sh - echo "[ \"\$debug\" ] && echo running $file - source boot/$file - [ \"\$modules\" ] && load_modules" >> run_all.sh - [ "$condition" ] && echo "fi" >> run_all.sh - # and all programs it needs - for files in $(sed -rn 's/^#[[:blank:]]*%programs:[[:blank:]]*(.*)$/\1/p' < "$script"); do - for file in $(eval echo $files); do - if [ "${file:0:17}" = "/lib/mkinitrd/bin" ]; then - SOURCE=$file -- DEST="./bin/" -+ DEST="${tmp_mnt}/bin/" - elif [ "${file:0:1}" = "/" ]; then # absolute path files have to stay alive - SOURCE=$file - [ ! -e $file -a -e /usr$file ] && SOURCE="/usr$file" -- DEST=".$file" -+ DEST="${tmp_mnt}$SOURCE" - else - case "$(type -t "$file")" in - builtin) continue - esac - SOURCE=$(type -p "$file") -- DEST="./bin/" -+ DEST="${tmp_mnt}$SOURCE" - fi - - cp_bin "$SOURCE" "$DEST" -- -- # if we're given a symlink, always copy the linked file too -- if [ -L "$SOURCE" ]; then -- LINK=$(readlink -e "$SOURCE") -- if [ -e "$LINK" ]; then -- mkdir -p .$(dirname "$LINK") -- cp_bin "$LINK" ."$LINK" -- else -- echo 2>&1 "WARNING: $LINK is a dangling symlink" -- fi -- fi - done - done - fi - done - - echo -ne "Features: " - echo $features - - [ -e "bin/sh" ] || ln -s /bin/bash bin/sh - -Index: 1220/mkinitrd/scripts/setup-scsi_dh.sh -=================================================================== ---- 1220.orig/mkinitrd/scripts/setup-scsi_dh.sh -+++ 1220/mkinitrd/scripts/setup-scsi_dh.sh -@@ -1,13 +1,13 @@ - #!/bin/bash - # - #%stage: device - # - # Include all scsi_dh_* modules and load them on boot (bnc#727428 et al) - - scsi_dh_modules= --for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko"); do -+for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko"| sort); do - i=${i%.ko} - scsi_dh_modules="$scsi_dh_modules ${i##*/}" - done - - save_var scsi_dh_modules -Index: 1220/mkinitrd/scripts/setup-sharedlibs.sh -=================================================================== ---- 1220.orig/mkinitrd/scripts/setup-sharedlibs.sh -+++ 1220/mkinitrd/scripts/setup-sharedlibs.sh -@@ -54,58 +54,68 @@ shared_object_files() { - while [ -L "/$lib" ]; do - echo $lib - link="$(readlink "/$lib")" - if [ x"${link:0:1}" == x"/" ]; then - lib=${link#/} - else - lib="${lib%/*}/$link" - fi - done - echo $lib - done - } - --verbose -ne "Shared libs:\t" --# Copy all required shared libraries and the symlinks that --# refer to them. --lib_files=$(shared_object_files "${initrd_bins[@]}") --[ $? -eq 0 ] || return 1 --if [ -n "$lib_files" ]; then -- for lib in $lib_files; do -- [ -L $root_dir/$lib ] || verbose -n "$lib " -- ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt ) -- done -- lib_files= -+copy_shared_libs() { -+ local bins=( "$@" ) -+ local extra_lib_files lib_files lib i -+ -+ # First see what nss and other libs are required. This can be 64bit or 32bit, -+ # depending on the host and the already copied binaries. - case "$(uname -m)" in - ia64) -+ # this is a known location - mkdir -p $tmp_mnt/lib -- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`" -+ extra_lib_files="`echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`" - ;; - *) -- # no symlinks, most point into the running system -- for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev/,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u` -+ # Skip symlinks, they may point into the running system instead of $tmp_mnt -+ for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u` - do - case "$i" in - 32-bit) - mkdir -p $tmp_mnt/lib -- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`" -+ extra_lib_files="$extra_lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`" - ;; - 64-bit) - mkdir -p $tmp_mnt/lib64 -- lib_files="$lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`" -+ extra_lib_files="$extra_lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`" - ;; - esac - done - ;; - esac - -- for lib in $lib_files ; do -- if [ -f $lib ] ; then -- verbose -n "${lib##$root_dir/} " -- cp -dp --parents $lib $tmp_mnt -+ verbose -ne "Shared libs:\t" -+ -+ # Now collect a list of libraries on which the binaries and extra libs depend on -+ lib_files=$( shared_object_files ${bins[@]} $extra_lib_files ) -+ if [ $? -eq 0 ] -+ then -+ if [ -n "$lib_files" ] -+ then -+ # Finally copy dependencies and extra libs -+ for lib in $lib_files $extra_lib_files -+ do -+ [ -L $root_dir/$lib ] || verbose -n "$lib " -+ ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt ) -+ done -+ verbose -+ else -+ verbose "none" - fi -- done -- verbose --else -- verbose "none" --fi -+ else -+ return 1 -+ fi -+} - -+# Copy all required shared libraries and the symlinks that refer to them. -+copy_shared_libs "${initrd_bins[@]}" diff --git a/libguestfs.mkinitrd.1230.patch b/libguestfs.mkinitrd.1230.patch deleted file mode 100644 index cb12a7b..0000000 --- a/libguestfs.mkinitrd.1230.patch +++ /dev/null @@ -1,95 +0,0 @@ ---- - mkinitrd/scripts/setup-ibft.sh | 2 +- - mkinitrd/scripts/setup-network.sh | 11 ++++++++++- - mkinitrd/scripts/setup-scsi_dh.sh | 2 +- - 3 files changed, 12 insertions(+), 3 deletions(-) - -Index: 1230/mkinitrd/scripts/setup-ibft.sh -=================================================================== ---- 1230.orig/mkinitrd/scripts/setup-ibft.sh -+++ 1230/mkinitrd/scripts/setup-ibft.sh -@@ -21,22 +21,22 @@ ibft_set_iface() { - interface=$iface - drvlink=$(get_network_module $interface) - if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then - nettype=dhcp - read ibft_dhcp < $ibft_nic/dhcp - [ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static - else - nettype=static - fi - fi - } - - ibft_nic=/sys/firmware/ibft/ethernet0 --ibft_hostname=$(hostname) -+ibft_hostname=localhost - - if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then - ibft_available=1 - ibft_set_iface - fi - save_var ibft_available - save_var ibft_hostname - save_var ibft_nic -Index: 1230/mkinitrd/scripts/setup-network.sh -=================================================================== ---- 1230.orig/mkinitrd/scripts/setup-network.sh -+++ 1230/mkinitrd/scripts/setup-network.sh -@@ -278,27 +278,36 @@ if [ "$nettype" = "ifup" ] ; then - verbose "[NETWORK]\tifup: $interface" - fi - done - interface= - fi - - # Copy the /etc/resolv.conf when the IP is static - if test -n "$static_interfaces"; then - verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd" - cp /etc/resolv.conf $tmp_mnt/etc - fi - - # Copy netcfg files (bnc#468090, bnc#714945) --cp /etc/{hosts,protocols,services,netconfig} $tmp_mnt/etc -+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc -+cat > $tmp_mnt/etc/hosts <<_EOH_ -+127.0.0.1 localhost -+::1 localhost ipv6-localhost ipv6-loopback -+fe00::0 ipv6-localnet -+ff00::0 ipv6-mcastprefix -+ff02::1 ipv6-allnodes -+ff02::2 ipv6-allrouters -+ff02::3 ipv6-allhosts -+_EOH_ - - # Get static IP configuration if requested - for iface in $static_interfaces; do - static_ips="$static_ips $(get_ip_config $iface)" - done - - mkdir -p $tmp_mnt/var/lib/dhcpcd - mkdir -p $tmp_mnt/var/run - - cp_bin /lib/mkinitrd/bin/ipconfig $tmp_mnt/bin/ipconfig - if [ -f /etc/udev/rules.d/70-persistent-net.rules ] ; then - cp /etc/udev/rules.d/70-persistent-net.rules $tmp_mnt/etc/udev/rules.d - fi -Index: 1230/mkinitrd/scripts/setup-scsi_dh.sh -=================================================================== ---- 1230.orig/mkinitrd/scripts/setup-scsi_dh.sh -+++ 1230/mkinitrd/scripts/setup-scsi_dh.sh -@@ -1,13 +1,13 @@ - #!/bin/bash - # - #%stage: device - # - # Include all scsi_dh_* modules and load them on boot (bnc#727428 et al) - - scsi_dh_modules= --for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko"); do -+for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko"| sort); do - i=${i%.ko} - scsi_dh_modules="$scsi_dh_modules ${i##*/}" - done - - save_var scsi_dh_modules diff --git a/libguestfs.mkinitrd.1310.patch b/libguestfs.mkinitrd.1310.patch deleted file mode 100644 index a92014d..0000000 --- a/libguestfs.mkinitrd.1310.patch +++ /dev/null @@ -1,99 +0,0 @@ ---- - mkinitrd/scripts/setup-ibft.sh | 2 +- - mkinitrd/scripts/setup-network.sh | 11 ++++++++++- - mkinitrd/scripts/setup-scsi_dh.sh | 2 +- - 3 files changed, 12 insertions(+), 3 deletions(-) - -Index: 1310/mkinitrd/scripts/setup-ibft.sh -=================================================================== ---- 1310.orig/mkinitrd/scripts/setup-ibft.sh -+++ 1310/mkinitrd/scripts/setup-ibft.sh -@@ -22,22 +22,22 @@ ibft_set_iface() { - drvlink="$drvlink $(get_network_module $interface)" - if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then - nettype=dhcp - read ibft_dhcp < $ibft_nic/dhcp - [ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static - else - nettype=static - fi - fi - } - - ibft_nic=/sys/firmware/ibft/ethernet0 - ibft_nic2=/sys/firmware/ibft/ethernet1 --ibft_hostname=$(hostname) -+ibft_hostname=localhost - - if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then - ibft_available=1 - ibft_set_iface - fi - save_var ibft_available - save_var ibft_hostname - save_var ibft_nic -Index: 1310/mkinitrd/scripts/setup-network.sh -=================================================================== ---- 1310.orig/mkinitrd/scripts/setup-network.sh -+++ 1310/mkinitrd/scripts/setup-network.sh -@@ -278,27 +278,36 @@ if [ "$nettype" = "ifup" ] ; then - verbose "[NETWORK]\tifup: $interface" - fi - done - interface= - fi - - # Copy the /etc/resolv.conf when the IP is static - if test -n "$static_interfaces"; then - verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd" - cp /etc/resolv.conf $tmp_mnt/etc - fi - - # Copy netcfg files (bnc#468090, bnc#714945) --cp /etc/{hosts,protocols,services,netconfig} $tmp_mnt/etc -+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc -+cat > $tmp_mnt/etc/hosts <<_EOH_ -+127.0.0.1 localhost -+::1 localhost ipv6-localhost ipv6-loopback -+fe00::0 ipv6-localnet -+ff00::0 ipv6-mcastprefix -+ff02::1 ipv6-allnodes -+ff02::2 ipv6-allrouters -+ff02::3 ipv6-allhosts -+_EOH_ - - # Get static IP configuration if requested - for iface in $static_interfaces; do - static_ips="$static_ips $(get_ip_config $iface)" - done - - mkdir -p $tmp_mnt/var/lib/dhcpcd - mkdir -p $tmp_mnt/var/run - - cp_bin /lib/mkinitrd/bin/ipconfig $tmp_mnt/bin/ipconfig - if [ -f /etc/udev/rules.d/70-persistent-net.rules ] ; then - cp /etc/udev/rules.d/70-persistent-net.rules $tmp_mnt/etc/udev/rules.d - fi -Index: 1310/mkinitrd/scripts/setup-scsi_dh.sh -=================================================================== ---- 1310.orig/mkinitrd/scripts/setup-scsi_dh.sh -+++ 1310/mkinitrd/scripts/setup-scsi_dh.sh -@@ -1,17 +1,17 @@ - #!/bin/bash - # - #%stage: device - # - # Include all scsi_dh_* modules and load them on boot (bnc#727428 et al) - - scsi_dh_modules= - if test -d $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler - then -- for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko") -+ for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko" | sort) - do - i=${i%.ko} - scsi_dh_modules="$scsi_dh_modules ${i##*/}" - done - fi - - save_var scsi_dh_modules diff --git a/libguestfs.mkinitrd.boot-btrfs.sh b/libguestfs.mkinitrd.boot-btrfs.sh deleted file mode 100644 index 9c59ee6..0000000 --- a/libguestfs.mkinitrd.boot-btrfs.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -e -#%stage: filesystem -#%depends: dm dmraid lvm2 udev md luks -#%programs: btrfs -#%programs: btrfs-convert -#%programs: btrfs-debug-tree -#%programs: btrfs-dump-super -#%programs: btrfs-find-root -#%programs: btrfs-image -#%programs: btrfs-select-super -#%programs: btrfs-zero-log -#%programs: btrfsck -#%programs: btrfstune -# for fsck(8): listed twice so that a copy really ends up in /sbin -#%programs: /sbin/fsck.btrfs -#%programs: fsck.btrfs -#%programs: mkfs.btrfs -#%modules: btrfs - -modprobe btrfs - -btrfs dev scan >& /dev/null diff --git a/libguestfs.mkinitrd.boot-dm.sh b/libguestfs.mkinitrd.boot-dm.sh deleted file mode 100644 index 4286fe6..0000000 --- a/libguestfs.mkinitrd.boot-dm.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -#%stage: boot -#%depends: start -#%modules: $dm_modules dm-mod dm-snapshot -#%programs: /sbin/dmsetup /sbin/blockdev -# dm-crypt dm-zero dm-mirror -#%if: -n "$root_dm" -# -##### Device Mapper -## -## If the root device uses device mapper, this initializes and waits for the control file -## -## Command line parameters -## ----------------------- -## -## root_dm=1 use device mapper -## - -load_modules - -# because we run before udev we need to create the device node manually -mkdir -p /dev/mapper -if [ ! -c /dev/mapper/control ] ; then - mknod /dev/mapper/control c 10 63 -fi diff --git a/libguestfs.mkinitrd.boot-lvm2.sh b/libguestfs.mkinitrd.boot-lvm2.sh deleted file mode 100644 index c1e11ef..0000000 --- a/libguestfs.mkinitrd.boot-lvm2.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash -#%stage: volumemanager -#%depends: evms -#%programs: vgscan vgchange lvm -#%programs: sed -#%modules: linear -#%if: -n "$root_lvm2" -# -##### LVM (Logical Volume Management) -## -## This activates and waits for an LVM. -## -## Command line parameters -## ----------------------- -## -## root_lvm2=1 use LVM -## root=/dev/mapper/... use this device as Volume Group -## vg_roots use this group as Volume Group -## - -lvm2_get_vg() { - local param=$1 - local vg_root vg_name - local sysdev - - case $param in - /dev/disk/by-*/*) - vg_root= - ;; - /dev/mapper/*) - vg_name=${o##root=/dev/mapper/} - vg_root=${vg_name%%-*} - ;; - /dev/*) - set -- $(IFS=/ ; echo $param) - if [ "$#" = "3" ] ; then - # Check sysfs. If there are subdirectories - # matching this name it's a block device - for d in /sys/block/$2\!* ; do - if [ -d $d ] ; then - sysdev=$d - fi - done - # Not found in sysfs, looks like a VG then - if [ -z "$sysdev" ] ; then - vg_root=$2 - fi - fi - ;; - esac - - echo $vg_root -} - -# load the necessary module before we initialize the raid system -load_modules - -if [ -n "$root_lvm2" ] ; then - o=$(get_param root) - # Fallback if 'root=' is not specified - [ -z "$o" ] && o=$rootdev - vg_root=$(lvm2_get_vg $o) - if [ "$vg_root" ] ; then - # We are waiting for a device-mapper device - root_major=$(sed -n 's/\(.*\) device-mapper/\1/p' /proc/devices) - fi - o=$(get_param resume) - vg_resume=$(lvm2_get_vg $o) - if [ "$vg_resume" ] ; then - resume_major=$(sed -n 's/\(.*\) device-mapper/\1/p' /proc/devices) - fi -fi - -# initialize remebered and parameterized devices -for vgr in $vg_root $vg_resume $vg_roots; do - vgchange -a y $vgr -done - -unset lvm2_get_vg diff --git a/libguestfs.mkinitrd.boot-md.sh b/libguestfs.mkinitrd.boot-md.sh deleted file mode 100644 index b9e9d66..0000000 --- a/libguestfs.mkinitrd.boot-md.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -#%stage: boot -#%depends: start -#%programs: /sbin/mdadm /sbin/mdmon -#%modules: raid0 raid1 raid10 raid456 -#%if: -n "$need_mdadm" -# -##### MD (Software-)Raid -## -## This only sets the 'start_ro' module parameter to ensure -## arrays don't start resync until after the first write. -## All array assembly is performed by udev -> "mdadm -I" -## -## Command line parameters -## ----------------------- -## -## need_mdadm=1 use MD raid -## - -# load the necessary module before we initialize the raid system -load_modules - -#check_for_device uses $md_major -#we depend on 'start' to ensure /proc/devices exists -md_major=$(sed -ne 's/\s*\([0-9]\+\)\s*md$/\1/p' /proc/devices) - -# Always start md devices read/only. They will get set to rw as soon -# as the first write occurs. This way we can guarantee that no -# restore occurs before resume. -if [ -f /sys/module/md_mod/parameters/start_ro ]; then - echo 1 > /sys/module/md_mod/parameters/start_ro -fi diff --git a/libguestfs.mkinitrd.boot-nfs.sh b/libguestfs.mkinitrd.boot-nfs.sh deleted file mode 100644 index 145f928..0000000 --- a/libguestfs.mkinitrd.boot-nfs.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash -#%stage: block -#%modules: nfs nfsv2 nfsv3 nfsv4 -#%programs: mount.nfs mount.nfs4 -#%if: "$rootfstype" = "nfs" -o "$need_nfs" -# -##### Network FileSystem -## -## This is where NFS gets mounted. -## If no root= option was given, the root device will be taken from the DHCP-server. -## -## Command line parameters -## ----------------------- -## -## root=:/ the nfs root path -## - -# Prefer NFS root setting via DHCP the fallback provided in config/*. -# So at first, consider the command line (that's why we check for "$cmd_root" -# being empty here. Then consider the DHCP setting. And finally consider the -# fallback via config/*. - -if [ -n "$ROOTPATH" -a -z "$cmd_root" ] ; then - case "$ROOTPATH" in - iscsi:*) - ;; - *:*) - rootfstype="nfs" - rootdev="$ROOTPATH" ;; - *) - if [ -n "$DHCPSIADDR" ]; then - rootdev="$DHCPSIADDR:$ROOTPATH" - rootfstype="nfs" - elif [ -n "$DHCPSNAME" ]; then - rootdev="$DHCPSNAME:$ROOTPATH" - rootfstype="nfs" - fi ;; - esac - - if [ -n "$rootdev" ] ; then - echo >&2 "Using root device ($rootdev) provided via DHCP" - fi -fi - -if [ "$rootfstype" = "nfs" ]; then - # load the nfs module before using it - load_modules - - if [ -z "$rootdev" ]; then - echo "no local root= kernel option given and no root server set by the dhcp server." - echo "exiting to /bin/sh" - cd / - PATH=$PATH PS1='$ ' /bin/sh -i - fi - - rootfsmod= - if [ -n "$rootflags" ] ; then - rootflags="${rootflags},nolock" - else - rootflags="nolock" - fi - # tell boot.rootfsck to skip warning - ROOTFS_FSCK=0 - export ROOTFS_FSCK -else - dont_load_modules -fi - -# Absolutely required for networking to function -ip link set dev lo up diff --git a/libguestfs.mkinitrd.boot.sh b/libguestfs.mkinitrd.boot.sh deleted file mode 100644 index 32accda..0000000 --- a/libguestfs.mkinitrd.boot.sh +++ /dev/null @@ -1,361 +0,0 @@ -#!/bin/bash -#%stage: block -# -#%modules: dm-mod -# -#%udevmodules: virtio_blk -#%udevmodules: virtio_console -#%udevmodules: virtio_net -#%udevmodules: virtio_pci -#%udevmodules: virtio_scsi -#%udevmodules: sg -#%udevmodules: sd_mod -#%udevmodules: sr_mod -#%udevmodules: -#%udevmodules: loop -#%udevmodules: -#%udevmodules: 9p -#%udevmodules: btrfs -#%udevmodules: cramfs -#%udevmodules: cuse -#%udevmodules: ext2 -#%udevmodules: ext3 -#%udevmodules: ext4 -#%udevmodules: fat -#%udevmodules: fuse -#%udevmodules: hfs -#%udevmodules: hfsplus -#%udevmodules: isofs -#%udevmodules: jfs -#%udevmodules: minix -#%udevmodules: nfs -#%udevmodules: quota -#%udevmodules: reiserfs -#%udevmodules: squashfs -#%udevmodules: squashfs3 -#%udevmodules: udf -#%udevmodules: ufs -#%udevmodules: xfs -#%udevmodules: -#%udevmodules: mac-celtic -#%udevmodules: mac-centeuro -#%udevmodules: mac-croatian -#%udevmodules: mac-cyrillic -#%udevmodules: mac-gaelic -#%udevmodules: mac-greek -#%udevmodules: mac-iceland -#%udevmodules: mac-inuit -#%udevmodules: mac-roman -#%udevmodules: mac-romanian -#%udevmodules: mac-turkish -#%udevmodules: nls_ascii -#%udevmodules: nls_cp1250 -#%udevmodules: nls_cp1251 -#%udevmodules: nls_cp1255 -#%udevmodules: nls_cp437 -#%udevmodules: nls_cp737 -#%udevmodules: nls_cp775 -#%udevmodules: nls_cp850 -#%udevmodules: nls_cp852 -#%udevmodules: nls_cp855 -#%udevmodules: nls_cp857 -#%udevmodules: nls_cp860 -#%udevmodules: nls_cp861 -#%udevmodules: nls_cp862 -#%udevmodules: nls_cp863 -#%udevmodules: nls_cp864 -#%udevmodules: nls_cp865 -#%udevmodules: nls_cp866 -#%udevmodules: nls_cp869 -#%udevmodules: nls_cp874 -#%udevmodules: nls_cp932 -#%udevmodules: nls_cp936 -#%udevmodules: nls_cp949 -#%udevmodules: nls_cp950 -#%udevmodules: nls_euc-jp -#%udevmodules: nls_iso8859-1 -#%udevmodules: nls_iso8859-13 -#%udevmodules: nls_iso8859-14 -#%udevmodules: nls_iso8859-15 -#%udevmodules: nls_iso8859-2 -#%udevmodules: nls_iso8859-3 -#%udevmodules: nls_iso8859-4 -#%udevmodules: nls_iso8859-5 -#%udevmodules: nls_iso8859-6 -#%udevmodules: nls_iso8859-7 -#%udevmodules: nls_iso8859-9 -#%udevmodules: nls_koi8-r -#%udevmodules: nls_koi8-ru -#%udevmodules: nls_koi8ru -#%udevmodules: nls_koi8-u -#%udevmodules: nls_utf8 -#%udevmodules: -#%udevmodules: af_packet -#%udevmodules: nfs -#%udevmodules: nfsv2 -#%udevmodules: nfsv3 -#%udevmodules: nfsv4 -# -#%udevmodules: dm-crypt -# -#%udevmodules: ablk_helper -#%udevmodules: aes-i586 -#%udevmodules: aes-x86_64 -#%udevmodules: aes_s390 -#%udevmodules: aesni-intel -#%udevmodules: af_alg -#%udevmodules: algif_hash -#%udevmodules: algif_skcipher -#%udevmodules: ansi_cprng -#%udevmodules: anubis -#%udevmodules: arc4 -#%udevmodules: asymmetric_keys -#%udevmodules: async_memcpy -#%udevmodules: async_pq -#%udevmodules: async_raid6_recov -#%udevmodules: async_tx -#%udevmodules: async_xor -#%udevmodules: authenc -#%udevmodules: authencesn -#%udevmodules: blowfish-x86_64 -#%udevmodules: blowfish_common -#%udevmodules: blowfish_generic -#%udevmodules: camellia-aesni-avx-x86_64 -#%udevmodules: camellia-x86_64 -#%udevmodules: camellia_generic -#%udevmodules: cast5-avx-x86_64 -#%udevmodules: cast5_generic -#%udevmodules: cast6-avx-x86_64 -#%udevmodules: cast6_generic -#%udevmodules: cast_common -#%udevmodules: cbc -#%udevmodules: ccm -#%udevmodules: cmac -#%udevmodules: crc32 -#%udevmodules: crc32-pclmul -#%udevmodules: crc32c-intel -#%udevmodules: cryptd -#%udevmodules: crypto_null -#%udevmodules: crypto_user -#%udevmodules: ctr -#%udevmodules: cts -#%udevmodules: deflate -#%udevmodules: des_generic -#%udevmodules: des_s390 -#%udevmodules: ecb -#%udevmodules: fcrypt -#%udevmodules: gcm -#%udevmodules: geode-aes -#%udevmodules: gf128mul -#%udevmodules: ghash-clmulni-intel -#%udevmodules: ghash-generic -#%udevmodules: glue_helper -#%udevmodules: hifn_795x -#%udevmodules: khazad -#%udevmodules: lrw -#%udevmodules: lz4 -#%udevmodules: lz4hc -#%udevmodules: md4 -#%udevmodules: md5 -#%udevmodules: michael_mic -#%udevmodules: padlock-aes -#%udevmodules: padlock-sha -#%udevmodules: pcbc -#%udevmodules: pcrypt -#%udevmodules: prng -#%udevmodules: public_key -#%udevmodules: raid6test -#%udevmodules: rmd128 -#%udevmodules: rmd160 -#%udevmodules: rmd256 -#%udevmodules: rmd320 -#%udevmodules: rsa -#%udevmodules: salsa20-i586 -#%udevmodules: salsa20-x86_64 -#%udevmodules: salsa20_generic -#%udevmodules: seed -#%udevmodules: seqiv -#%udevmodules: serpent-avx-x86_64 -#%udevmodules: serpent-sse2-i586 -#%udevmodules: serpent-sse2-x86_64 -#%udevmodules: serpent_generic -#%udevmodules: sha1-ssse3 -#%udevmodules: sha1_generic -#%udevmodules: sha1_s390 -#%udevmodules: sha256-ssse3 -#%udevmodules: sha256_generic -#%udevmodules: sha256_s390 -#%udevmodules: sha512-ssse3 -#%udevmodules: sha512_generic -#%udevmodules: sha512_s390 -#%udevmodules: sha_common -#%udevmodules: tea -#%udevmodules: tgr192 -#%udevmodules: twofish-avx-x86_64 -#%udevmodules: twofish-i586 -#%udevmodules: twofish-x86_64 -#%udevmodules: twofish-x86_64-3way -#%udevmodules: twofish_common -#%udevmodules: vmac -#%udevmodules: wp512 -#%udevmodules: x509_key_parser -#%udevmodules: xcbc -#%udevmodules: xor -#%udevmodules: xts -#%udevmodules: zlib -# -#%programs: mdadm -#%programs: modprobe -#%programs: lvm -#%programs: grep -#%programs: ln -#%programs: ls -#%programs: head -#%programs: cat -#%programs: ip -#%programs: date -#%programs: valgrind -#%programs: find -#%programs: xargs -#%programs: setctsid -# mount-rootfs-and-do-chroot.sh -#%programs: mkdir -#%programs: stat -#%programs: mount -#%programs: chroot -#%programs: umount -# -#%programs: bc -#%programs: fdisk -# -# Generated at build time: -#@GUESTFS_EXT_CMDS@ -# -missing_commands="@GUESTFS_MISSING_CMDS@" - -# Make the modules available now -# run_all.sh will load them after this script is sourced -load_modules - -# load various modules for cryptsetup -for i in 512 384 256 224 1 -do - modprobe -v sha$i -done - -ln -sfbn ../proc/self/mounts /etc/mtab - -# from libguestfs-1.19.34/appliance/init: - -# Disk optimizations. -# Increase the SCSI timeout so we can read remote images. -for f in /sys/block/sd*/device/timeout; do if test -w $f ; then echo 300 > $f; fi; done -# https://access.redhat.com/site/solutions/5427 -for f in /sys/block/{h,s,ub,v}d*/queue/scheduler; do if test -w $f ; then echo noop > $f; fi; done - -# Disable ipv6 because host names resolve to ipv4 and ipv6 -# Resolver may prefer ipv6 and qemu usernet does only ipv4 -for f in /proc/sys/net/ipv6/conf/*/disable_ipv6 -do - if test -w $f - then - echo 1 > $f - fi -done - -# Set up the network. -ip addr add 127.0.0.1/8 brd + dev lo scope host -ip link set dev lo up - -ip addr add 169.254.2.10/16 brd + dev eth0 scope global -ip link set dev eth0 up - -ip route add default via 169.254.2.2 - -echo nameserver 169.254.2.3 >> /etc/resolv.conf - -# Scan for MDs. -mdadm -As --auto=yes --run - -# Scan for LVM. -mkdir -p /etc/lvm -echo -n >> /etc/lvm/lvm.conf -lvm vgscan --ignorelockingfailure -lvm vgchange -ay --ignorelockingfailure - -# These are useful when debugging. -if grep -sq guestfs_verbose=1 /proc/cmdline; then - ls -lR /dev - head -n 1234 \ - /etc/resolv.conf \ - /proc/mounts \ - /proc/modules \ - /proc/cpuinfo \ - /proc/uptime \ - /proc/version \ - /proc/partitions - for i in pvs vgs lvs - do - echo "# lvm $i:" - lvm $i - done - ip a - ip r - date - echo -n "clocksource: " - cat /sys/devices/system/clocksource/clocksource0/current_clocksource - echo "These commands might be called by guestfsd, but they were not available at buildtime:" - echo "missing commands: $missing_commands" - echo -fi - -if ! grep -sq guestfs_rescue=1 /proc/cmdline; then - # Run the daemon under valgrind if ./configure --enable-valgrind-daemon - vg_channel=/dev/virtio-ports/org.libguestfs.valgrind - if [ -w $vg_channel ]; then - if [ -r /etc/guestfsd.suppressions ]; then - suppressions="--suppressions=/etc/guestfsd.suppressions" - fi - exec 3>$vg_channel - vg="valgrind --leak-check=full --log-fd=3 --error-exitcode=119 --max-stackframe=8388608 --child-silent-after-fork=yes $suppressions" - echo "enabling valgrind: $vg" - fi - - # The host will kill qemu abruptly if guestfsd shuts down normally - $vg guestfsd - - # Otherwise we try to clean up gracefully. For example, this ensures that a - # core dump generated by the guest daemon will be written to disk. -else - # Use appliance in rescue mode, also used by the virt-rescue command. - eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline) - PS1='> ' - console_kname=ttyS0 - if test -f /proc/consoles - then - console_major_minor="`sed 's@^.* @@;p;Q' < /proc/consoles `" - console_dev="`find /sys/ -name dev -type f -print0 | xargs -0 --no-run-if-empty grep -m 1 -l ${console_major_minor}`" - console_kname=${console_dev%/dev} - console_kname=${console_kname##*/} - fi - export TERM PS1 - echo - echo "------------------------------------------------------------" - echo - echo "Welcome to virt-rescue, the libguestfs rescue shell." - echo - echo "Note: The contents of / are the rescue appliance." - echo "You have to mount the guest's partitions under /sysroot" - echo "before you can examine them. A helper script for that exists:" - echo "mount-rootfs-and-do-chroot.sh /dev/sda2" - echo - setctsid "/dev/${console_kname}" bash -i - echo - echo "virt-rescue: Syncing the disk now before exiting ..." - echo -fi - -echo "Leaving." -echo s > /proc/sysrq-trigger -echo b > /proc/sysrq-trigger -exit 0 diff --git a/libguestfs.mkinitrd.setup-btrfs.sh b/libguestfs.mkinitrd.setup-btrfs.sh deleted file mode 100644 index 8cbe45c..0000000 --- a/libguestfs.mkinitrd.setup-btrfs.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# -#%stage: filesystem - -mkdir -p $tmp_mnt/etc/udev/rules.d -cp /usr/lib/udev/rules.d/64-btrfs.rules $tmp_mnt/etc/udev/rules.d diff --git a/libguestfs.mkinitrd.setup-dm.sh b/libguestfs.mkinitrd.setup-dm.sh deleted file mode 100644 index b26c12f..0000000 --- a/libguestfs.mkinitrd.setup-dm.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# -#%stage: devicemapper -#%depends: dmroot -# - -# no dmsetup -> no dm -if [ -x "$(type -p dmsetup)" ]; then - dm_blockdev= - - # if any device before was on dm we have to activate it - [ "$tmp_root_dm" ] && root_dm=1 - - blockdev="$(dm_resolvedeps_recursive $blockdev)" - [ "$?" = 0 ] && root_dm=1 - # include dm when using dm based block devs - [ "$DM_BLOCK" ] && root_dm=1 - - # include modules - if [ -n "$root_dm" ] ; then - # Add all dm modules - dm_modules= - for table in $(dmsetup table | cut -f 4 -d ' ' | sort | uniq); do - if [ "$table" = "thin" ]; then table="thin-pool"; fi - if [ "$table" ] && [ "$table" != "linear" ] && [ "$table" != "striped" ] ; then - dm_modules="$dm_modules dm-$table" - fi - done - dm_modules="$dm_modules dm-mirror" - fi - - # include dm block var from sysconfig - mkdir -p $tmp_mnt/etc/sysconfig - grep DM_BLOCK /etc/sysconfig/kernel > $tmp_mnt/etc/sysconfig/kernel - mkdir -p $tmp_mnt/usr/lib/udev/rules.d - cp /usr/lib/udev/rules.d/10-dm.rules $tmp_mnt/usr/lib/udev/rules.d/ - cp /usr/lib/udev/rules.d/13-dm-disk.rules $tmp_mnt/usr/lib/udev/rules.d - cp /usr/lib/udev/rules.d/95-dm-notify.rules $tmp_mnt/usr/lib/udev/rules.d - save_var root_dm - save_var dm_modules -fi diff --git a/libguestfs.mkinitrd.setup-lvm2.sh b/libguestfs.mkinitrd.setup-lvm2.sh deleted file mode 100644 index 9df4880..0000000 --- a/libguestfs.mkinitrd.setup-lvm2.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# -#%stage: volumemanager -#%depends: evms -# -# get information about the current blockdev -update_blockdev - -# Check whether we are using LVM2 (only available when not using EVMS) -if [ -z "$root_evms" ] && [ -x "$(type -p lvdisplay)" ] ; then - lvm_blockdev= - - for bd in $blockdev; do - update_blockdev $bd - - vg_name=$(lvdisplay -c 2> /dev/null | sed -n "/:${blockmajor}:${blockminor}$/p") - vg_dev=${vg_name%%:*} - vg_name=${vg_name#*:} - vg_root=${vg_name%%:*} - if [ "$vg_root" ] ; then - local vg_blockdev - root_lvm2=1 - realrootdev=${vg_dev## } - vg_blockdev=$(vgs --noheadings --options pv_name $vg_root 2> /dev/null | sed "s@,@\n@g" | sed "s@([0-9]*)@@g;s@ @@g" | sort | uniq) - lvm_blockdev="$lvm_blockdev $vg_blockdev" - [ $? -eq 0 ] || return 1 - vg_roots="$vg_roots $vg_root" - else - lvm_blockdev="$lvm_blockdev $bd" - fi - done - blockdev="$lvm_blockdev" -fi - -if use_script lvm2; then - tmp_root_dm=1 # lvm needs dm - mkdir -p $tmp_mnt/etc/lvm - mkdir -p $tmp_mnt/var/lock/lvm - cp -a /etc/lvm/lvm.conf $tmp_mnt/etc/lvm/ -# udev rule for lvm2 - mkdir -p $tmp_mnt/usr/lib/udev/rules.d - cp /usr/lib/udev/rules.d/11-dm-lvm.rules $tmp_mnt/usr/lib/udev/rules.d/ -fi - -save_var root_lvm2 -save_var vg_roots - diff --git a/libguestfs.mkinitrd.setup-md.sh b/libguestfs.mkinitrd.setup-md.sh deleted file mode 100644 index 68e3d71..0000000 --- a/libguestfs.mkinitrd.setup-md.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/bash -# -#%stage: softraid -# -mdblockdev= - -# Full mdadm.conf generated by mdadm. -# Contains all created MD RAIDs -mdadm_conf= - -cont_list= -md_devs= - -declare -A md_conf -# blockdev contains real devices (/dev/X) for root, resume, journal, dumb -for bd in $blockdev ; do - is_part_dev=false - case $bd in - /dev/md[_0-9]*p[0-9]* ) - # Partitionable MD RAID. This is partition on RAID. Get the RAID - bd=${bd%%p[0-9]*} - is_part_dev=true - ;; - /dev/md[0-9_]*) - ;; - *) - mdblockdev="$mdblockdev $bd" - continue - ;; - esac - # Check if this device is already added (possible for partitionable). - md_dev=`mdadm -D --export $bd | sed -n -e 's/^MD_DEVNAME=//p'` - if [ -z "$md_dev" ]; then - md_dev=${bd##/dev/} - else - bd="/dev/md/$md_dev" - fi - dup_found=false - for dup in $md_devs; do - if [ x"$dup" = x"$md_dev" ]; then - dup_found=true - break - fi - done - if $dup_found; then - if ! $is_part_dev; then - echo "setup-md.sh: $md_dev found multiple times" >&2 - fi - continue - fi - mdconf=$(mdadm -Db "$bd") - if test -z "$mdconf"; then - mdblockdev="$mdblockdev $bd" - continue - fi - md_tmpblockdev=$(mdadm -Dbv $bd | sed -n "1D;s/,/ /g;s/^ *devices=//p") - mdblockdev="$mdblockdev $md_tmpblockdev" - md_devs="$md_devs $md_dev" - container=$(echo "$mdconf" | sed -rn 's/.* container=([^ ]*) .*/\1/p') - for cnt in $cont_list; do - if [ x"$container" = x"$cnt" ]; then - container= - break - fi - done - case "$container" in - "") - ;; - /dev/*) - mdconf="$(mdadm -Db "$container")\\n$mdconf" - cont_list="$cont_list $container" - ;; - [0-9a-f]*[0-9a-f]) - if test -z "$mdadm_conf"; then - mdadm_conf=$(mdadm --examine --brief --scan) - fi - mdconf="$(echo "$mdadm_conf" | grep "UUID=$container")\\n$mdconf" - cont_list="$cont_list $container" - ;; - *) - echo "unrecognized container for $md_dev: $container" - ;; - esac - # If /etc/mdadm.conf contains a different name for this - # array, then use that. - md_uuid=`echo $mdconf | sed -n -e 's/.* UUID=\([0-9a-f:]*\).*/\1/p'` - if [ -f /etc/mdadm.conf -a -n "$md_uuid" ]; then - md_devname=`sed -n -e 's,^ARRAY */dev/\([^ ]*\) .*[Uu][Uu][Ii][Dd]='$md_uuid'.*,\1,p' /etc/mdadm.conf` - if [ -n "$md_devname" ]; then - mdconf=`echo $mdconf | sed -e 's,^ARRAY /dev/\([^ ]*\),ARRAY /dev/'$md_devname','` - fi - fi - md_conf["$md_dev"]="$mdconf" - root_md=1 -done - -# Any 'md' device is replaced by it's component disks. -blockdev="$mdblockdev" - -if [ -n "$root_md" ] ; then - need_mdadm=1 - echo "AUTO -all" > $tmp_mnt/etc/mdadm.conf - for md in $md_devs; do - echo -e "${md_conf["$md"]}" >> $tmp_mnt/etc/mdadm.conf - done -fi - -if [ "x$need_mdadm" = "x1" ] ; then - for rule in \ - 63-md-raid-arrays.rules \ - 64-md-raid-assembly.rules; do - if [ -f /usr/lib/udev/rules.d/$rule ]; then - cp /usr/lib/udev/rules.d/$rule $tmp_mnt/usr/lib/udev/rules.d - elif [ -f /lib/udev/rules.d/$rule ]; then - cp /lib/udev/rules.d/$rule $tmp_mnt/lib/udev/rules.d - fi - done -fi - -save_var need_mdadm diff --git a/libguestfs.mkinitrd.setup-nfs.sh b/libguestfs.mkinitrd.setup-nfs.sh deleted file mode 100644 index f496e6e..0000000 --- a/libguestfs.mkinitrd.setup-nfs.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# -#%stage: device -# - -if [ "$rootfstype" = "nfs" ]; then - interface=${interface:-default} - save_var rootfstype -fi diff --git a/libguestfs.mkinitrd.setup.sh b/libguestfs.mkinitrd.setup.sh deleted file mode 100644 index ba04c46..0000000 --- a/libguestfs.mkinitrd.setup.sh +++ /dev/null @@ -1,162 +0,0 @@ -#!/bin/bash -#%stage: block -# - -fdupes_s() { - local _target="" - local _file= - fdupes --quiet --noempty --recurse "$@" | - while read _file - do - if test -z "$_target" - then - _target="$_file" - else - if test -z "$_file" - then - _target="" - continue - fi - echo ln -fv "${_target##*/}" "$_file" - fi - done -} - -# copy daemon manually because it is located in RPM_BUILD_ROOT -mkdir -vp $tmp_mnt/usr/sbin -cp_bin $(type -p guestfsd) $tmp_mnt/usr/sbin -# required for mount.nfs inside the appliance -for i in /etc/netconfig /etc/protocols /etc/rpc /etc/services -do - cp $i $tmp_mnt$i -done - -# Disable ipv6 because host names resolve to ipv4 and ipv6 -# Resolver may prefer ipv6 and qemu usernet does only ipv4 -echo install ipv6 /bin/true >> $tmp_mnt/etc/modprobe.conf.local - -# many guestfish commands need a mount point -# in guestfsd the mount point defaults to /sysroot -mkdir -vp $tmp_mnt/sysroot - -# guestfsd tries to bind mount this directory -mkdir -vp $tmp_mnt/selinux - -for f in /etc/magic /usr/share/misc/magic* -do - if test -e $f - then - cp -av --parents $f $tmp_mnt/ - fi -done -for d in /usr/share/*augeas* -do - if test -e $d - then - cp -av --parents $d $tmp_mnt/ - fi -done - -mkdir -p $tmp_mnt/usr/share/guestfs -if test -n "$LIBGUESTFS_SRC_APPLIANCE_DIR" -then - for f in $LIBGUESTFS_SRC_APPLIANCE_DIR/*.aug - do - if test -e $f - then - cp -Lavt $tmp_mnt/usr/share/guestfs $f - fi - done -fi -for d in /usr/lib*/gconv -do - if test -e $d - then - cp -avL --parents $d $tmp_mnt/ - fdupes_s $tmp_mnt$d - fi -done - -for t in \ - screen \ - vt100 \ - vt102 \ - linux -do - ti="`echo /usr/share/terminfo/*/${t}`" - for f in $ti - do - if test -f "${f}" - then - cp -av --parents $f $tmp_mnt - fi - done -done - -# copy needed rules -for rule in \ - 95-dm-notify.rules \ - ; do - if [ -f /lib/udev/rules.d/$rule ]; then - cp /lib/udev/rules.d/$rule $tmp_mnt/lib/udev/rules.d - elif [ -f /etc/udev/rules.d/$rule ]; then - cp /etc/udev/rules.d/$rule $tmp_mnt/etc/udev/rules.d - fi -done - -# Need to create the modprobe.conf file to force read-write mode -if modinfo -k $kernel_version ext4 | grep -E '^parm:[[:blank:]]+rw:' -then - mkdir -vp "${tmp_mnt}/etc/modprobe.d" - echo "options ext4 rw=1" >> "${tmp_mnt}/etc/modprobe.d/ext4-kmp-rw.conf" -fi - -# Bug 674684 - mount-rootfs-and-do-chroot.sh -cat > $tmp_mnt/bin/mount-rootfs-and-do-chroot.sh <<'__EOF__' -#!/bin/bash -# Usage: $0 /dev/sda5 -rootfs=$1 -mnt=/sysroot -mounts= - -if test -b "${rootfs}" -then - - mkdir -v -p "${mnt}" - - if mount -v "${rootfs}" "${mnt}" - then - - for i in dev dev/pts proc sys selinux - do - if test -d /${i} && test -d "${mnt}/${i}" && test "`stat -c %D /`" != "`stat -c %D ${i}`" - then - mount -v --bind /${i} "${mnt}/${i}" - fi - done - - chroot "${mnt}" su - - - while read b m rest - do - case "${m}" in - ${mnt}*) - mounts="${m} ${mounts}" - ;; - esac - done <<-EOF -` -cat < /proc/mounts -` -EOF - - for i in ${mounts} - do - umount -v "${i}" - done - - fi - -fi -__EOF__ - diff --git a/libguestfs.mkinitrd.tar.bz2 b/libguestfs.mkinitrd.tar.bz2 deleted file mode 100644 index 9e52137..0000000 --- a/libguestfs.mkinitrd.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dc4d1703ee39e5e79ede0e22049cdbbd02e1c9f652a5786572bb8521994a4df0 -size 88226 diff --git a/libguestfs.rpmlintrc b/libguestfs.rpmlintrc index 9f44a0c..bc1e0ca 100644 --- a/libguestfs.rpmlintrc +++ b/libguestfs.rpmlintrc @@ -1 +1,4 @@ -addFilter("binaryinfo-readelf-failed") +addFilter("shlib-policy-nonversioned-dir") +addFilter("shlib-policy-missing-lib") +# This script is supposed to be run from within the appliance only +addFilter("non-executable-script /usr/share/virt-p2v/launch-virt-p2v") diff --git a/libguestfs.spec b/libguestfs.spec index 0e90ab0..6f84a75 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -1,7 +1,7 @@ # # spec file for package libguestfs # -# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2011 Michal Hrusecky # # All modifications and additions to the file contributed by third parties @@ -15,9 +15,10 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # +# needsbinariesforbuild -Version: 1.26.10 +Version: 1.32.4 Release: 0 %define opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) @@ -47,6 +48,7 @@ Release: 0 %bcond_without zerofree %bcond_with ext4_writeable %endif +%define with_p2v 0 %bcond_without fuse @@ -120,7 +122,7 @@ Release: 0 # Name: libguestfs %if "%{?_ignore_exclusive_arch}" == "" -ExclusiveArch: x86_64 ppc64 ppc64le s390x +ExclusiveArch: x86_64 ppc64 ppc64le s390x aarch64 %endif BuildRequires: aaa_base BuildRequires: attr-devel @@ -129,8 +131,12 @@ BuildRequires: autoconf BuildRequires: automake %if %{with bash_completion} BuildRequires: bash-completion >= 2.0 +%if 0%{?suse_version} >= 1330 +BuildRequires: bash-completion-devel >= 2.0 +%endif %endif BuildRequires: bison +BuildRequires: fdupes BuildRequires: file-devel BuildRequires: flex BuildRequires: gcc @@ -146,17 +152,26 @@ BuildRequires: libvirt-devel >= 0.10.2 BuildRequires: libxml2-devel BuildRequires: ncurses-devel %if %{with perl_bindings} +BuildRequires: perl(Module::Build) %if %suse_version < 1140 BuildRequires: perl-macros %endif %endif +BuildRequires: createrepo +BuildRequires: db48-utils +BuildRequires: dhcp-client BuildRequires: pcre-devel BuildRequires: pkg-config +BuildRequires: qemu-tools BuildRequires: readline-devel -%if %{with ocaml_bindings} +BuildRequires: supermin >= 5.1.6 # Required to build tools, its independent from bindings +BuildRequires: glib2-devel BuildRequires: ocaml BuildRequires: ocaml-findlib + +# +%if %{with ocaml_bindings} %define _configure_ocaml --enable-ocaml %endif # @@ -167,41 +182,24 @@ BuildRequires: fuse-devel # %if %{with hivex} BuildRequires: glibc-locale +BuildRequires: hivex BuildRequires: hivex-devel %endif # +%if %{with_p2v} +BuildRequires: gtk2-devel +%endif +# Url: http://libguestfs.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build Summary: Compatibility package for guestfs-tools License: GPL-2.0 Group: System/Filesystems Patch0: 0000-hotfix.patch -Patch1000: 1000-force-virtio_blk-in-old-guest-kernel.patch + Source0: %{name}-%{version}.tar.xz Source1: libguestfs.rpmlintrc -Source42: libguestfs.mkinitrd.tar.bz2 Source789653: Pod-Simple-3.23.tar.xz -Source10: libguestfs.mkinitrd.boot.sh -Source11: libguestfs.mkinitrd.setup.sh -# -Source12: libguestfs.mkinitrd.boot-dm.sh -Source13: libguestfs.mkinitrd.setup-dm.sh -Source14: libguestfs.mkinitrd.boot-lvm2.sh -Source15: libguestfs.mkinitrd.setup-lvm2.sh -Source16: libguestfs.mkinitrd.boot-md.sh -Source17: libguestfs.mkinitrd.setup-md.sh -Source18: libguestfs.mkinitrd.boot-nfs.sh -Source19: libguestfs.mkinitrd.setup-nfs.sh -Source20: libguestfs.mkinitrd.boot-btrfs.sh -Source21: libguestfs.mkinitrd.setup-btrfs.sh -# -Source1310: libguestfs.mkinitrd.1310.patch -Source1230: libguestfs.mkinitrd.1230.patch -Source1220: libguestfs.mkinitrd.1220.patch -Source1210: libguestfs.mkinitrd.1210.patch -Source1140: libguestfs.mkinitrd.1140.patch -Source1115: libguestfs.mkinitrd.1115.patch -Source1110: libguestfs.mkinitrd.1110.patch # Source10001: libguestfs.test.simple.run-libugestfs-test-tool.sh Source10002: libguestfs.test.simple.create-opensuse-guest.sh @@ -211,6 +209,7 @@ Source10005: libguestfs.test.simple.create-sles12-guest-crypt-on-lvm.sh # Requires: guestfs-tools +Requires: virt-v2v %description libguestfs is a set of tools for accessing and modifying virtual machine (VM) @@ -234,8 +233,7 @@ License: GPL-2.0 Group: System/Filesystems Provides: %{name} = %{version} Obsoletes: %{name} < %{version} -Requires: %{kvm_binary} -Requires: qemu >= 2.0 +Requires: python-evtx %if %{with bash_completion} Recommends: bash-completion >= 2.0 %endif @@ -409,7 +407,6 @@ BuildRequires: e2fsprogs %if %{with ext4_writeable} BuildRequires: ext4-writeable-kmp-default %endif -BuildRequires: fdupes BuildRequires: file BuildRequires: findutils BuildRequires: gawk @@ -429,21 +426,34 @@ BuildRequires: mdadm BuildRequires: mkinitrd %endif BuildRequires: module-init-tools +BuildRequires: ncurses-utils BuildRequires: nfs-client BuildRequires: ntfs-3g BuildRequires: ntfsprogs +BuildRequires: pam-config BuildRequires: parted +BuildRequires: pciutils +BuildRequires: pciutils-ids BuildRequires: psmisc BuildRequires: reiserfs BuildRequires: rsync +BuildRequires: sg3_utils BuildRequires: strace %ifarch %ix86 x86_64 BuildRequires: syslinux %endif +%if %suse_version >= 1210 +BuildRequires: systemd +BuildRequires: systemd-sysvinit +%else +BuildRequires: sysvinit +%endif BuildRequires: tar BuildRequires: terminfo-base +BuildRequires: tunctl BuildRequires: udev BuildRequires: util-linux +BuildRequires: util-linux-lang BuildRequires: xfsprogs BuildRequires: xz %if %{with zerofree} @@ -488,6 +498,9 @@ virtual machines. Summary: Runtime library of libguestfs License: LGPL-2.1 Group: System/Filesystems +Requires: %{kvm_binary} +Requires: qemu >= 2.0 +Requires: supermin >= 5.1.6 %description -n libguestfs0 Library for libguestfs. @@ -508,14 +521,25 @@ guestfish, or use virt-rescue to get a rescue shell for fixing unbootable virtual machines. +%package -n virt-v2v +Summary: Convert a virtual machine to run on KVM +License: GPL-2.0 +Group: System/Management +Requires: libguestfs0 = %{version} +Requires: qemu-block-ssh + +%description -n virt-v2v +virt-v2v is a tool for converting and importing virtual machines to +libvirt-managed KVM, or Red Hat Enterprise Virtualization. It can import a +variety of guest operating systems from libvirt-managed hosts and VMware ESX. %prep : _ignore_exclusive_arch '%{?_ignore_exclusive_arch}' -%setup -q -a 789653 -a 42 +%setup -q -a 789653 %patch0 -p1 -%patch1000 -p1 %build +bison --version # [Bug 789653] sles11 perl obsoletes perl-Pod-Simple unconditionally export PERLLIB=`echo $PWD/Pod-Simple-*/lib` # disable qemu test. @@ -566,7 +590,7 @@ fi --enable-install-daemon \ --with-qemu=$QEMU \ --without-java \ - --disable-appliance \ + --with-supermin-packager-config="$PWD/zypper.priv.conf --use-installed --verbose" \ --disable-haskell \ --disable-php \ %{_configure_fuse} \ @@ -577,6 +601,8 @@ fi %{_configure_ruby} \ --disable-rpath \ --disable-static +#Workaround an autotools bug +make -j1 -C builder index-parse.c # 'INSTALLDIRS' ensures that perl libs are installed in the vendor dir instead of the site dir make \ INSTALLDIRS=vendor \ @@ -589,9 +615,9 @@ make \ # strip kills the bytecode part of ELF binaries export NO_BRP_STRIP_DEBUG=true %endif -%makeinstall udevrulesdir=%{udevrulesdir} -rm -rfv $RPM_BUILD_ROOT%{_libdir}/guestfs/supermin.d -# +%makeinstall \ + INSTALLDIRS=vendor \ + udevrulesdir=%{udevrulesdir} mkdir -p $RPM_BUILD_ROOT%{_datadir}/guestfs cp -avLt $RPM_BUILD_ROOT%{_datadir}/guestfs \ %{S:10005} \ @@ -613,8 +639,6 @@ find $RPM_BUILD_ROOT -type f \( \ %if %{with perl_bindings} # Delete empty perl bootstrap files find $RPM_BUILD_ROOT -name "*.bs" -size 0c -print -delete -# Delete unused perl script without executable permissions -find $RPM_BUILD_ROOT%perl_vendorarch/ -name bindtests.pl -print -delete %perl_process_packlist %perl_gen_filelist # the macro above packages everything, here only the perl files are desrired @@ -627,178 +651,19 @@ rm -fv $RPM_BUILD_ROOT/%{_libdir}/*.a # touch %{name}.lang %find_lang %{name} -# -ext_cmds="` -objcopy -j .guestfsd_ext_cmds -O binary $RPM_BUILD_ROOT/usr/sbin/guestfsd /dev/stdout | -tr '\0' '\n' | -sort -u -`" -test -n "$ext_cmds" -# -> ext_cmds.txt -> missing_cmds.txt -# guestfs may call mkfs, but it cant tell in advance which filesystems -# it must support. Collect a manual list of possible filesystems so that -# the commands get included in the initrd. -ext_cmds="$ext_cmds -sparsify -strace -` for fs in \ - ext2 \ - ext3 \ - ext4 \ - fuse \ - ntfs \ - ntfs-3g \ - reiserfs \ - jfs \ - gfs \ - gfs2 \ - vfat \ - msdos \ - ufs \ -; do - if test -x /sbin/mount.$fs || test -x /usr/sbin/mount.$fs - then - echo mount.$fs - fi - echo mkfs.$fs - echo fsck.$fs -done -` " -# -for cmd in ls $ext_cmds -do - if test -n "` PATH=$PATH:/sbin:/usr/sbin type -p $cmd `" - then - echo "#%%programs: $cmd" >> ext_cmds.txt - else - echo "# missing: $cmd" >> ext_cmds.txt - echo "$cmd" >> missing_cmds.txt - fi -done -head -n 1234 ext_cmds.txt missing_cmds.txt -%if %{use_included_mkinitrd} -ln -sfvbn mkinitrd-2.8.1 mkinitrd -ln -sfvbn mkinitrd/sbin/mkinitrd_setup mkinitrd_setup.sh -ln -sfvbn mkinitrd/sbin/mkinitrd mkinitrd.sh -cp -avL %{S:12} mkinitrd/scripts/boot-dm.sh -cp -avL %{S:13} mkinitrd/scripts/setup-dm.sh -cp -avL %{S:14} mkinitrd/scripts/boot-lvm2.sh -cp -avL %{S:15} mkinitrd/scripts/setup-lvm2.sh -cp -avL %{S:16} mkinitrd/scripts/boot-md.sh -cp -avL %{S:17} mkinitrd/scripts/setup-md.sh -cp -avL %{S:18} mkinitrd/scripts/boot-nfs.sh -cp -avL %{S:19} mkinitrd/scripts/setup-nfs.sh -cp -avL %{S:20} mkinitrd/scripts/setup-btrfs.sh -cp -avL %{S:21} mkinitrd/scripts/setup-btrfs.sh -for i in /lib/mkinitrd/scripts/* -do - if test -f "$i" - then - cp -avbt mkinitrd/scripts "$i" - fi -done -mkdir -vp mkinitrd/setup mkinitrd/boot -ln -sfvbn lib/mkinitrd/bin mkinitrd/bin -sed -i~ "s@^INITRD_PATH=/lib/mkinitrd@INITRD_PATH=$PWD/mkinitrd@" mkinitrd/sbin/mkinitrd -%else -rm -rf mkinitrd -cp -av /lib/mkinitrd . -ln -sfvbn /sbin/mkinitrd_setup mkinitrd_setup.sh -ln -sfvbn /sbin/mkinitrd mkinitrd.sh -%endif -for bad in \ - setup-storage.sh \ - boot-storage.sh \ - ; -do - rm mkinitrd/scripts/${bad} -done -cp -avL %{S:10} mkinitrd/scripts/boot-guestfs.sh -cp -avL %{S:11} mkinitrd/scripts/setup-guestfs.sh -chmod 755 mkinitrd/scripts/*guestfs.sh -sed -i~ ' -/^#@GUESTFS_EXT_CMDS@/ { -s@^.*@@ -r ext_cmds.txt -} -/@GUESTFS_MISSING_CMDS@/ { -s@^.*@missing_commands="@ -r missing_cmds.txt -a \ -" -} -' mkinitrd/scripts/boot-guestfs.sh -diff -u mkinitrd/scripts/boot-guestfs.sh~ mkinitrd/scripts/boot-guestfs.sh || : -# -pushd mkinitrd -patched= -for p in \ - %{S:1310} \ - %{S:1230} \ - %{S:1220} \ - %{S:1210} \ - %{S:1140} \ - %{S:1115} \ - %{S:1110} \ - ; -do - if patch --dry-run -p2 < $p - then - patch -p2 < $p - patched=$p - break - elif patch --dry-run -R -p2 < $p - then - patched=$p - break - fi -done -popd -test -n "$patched" +%fdupes -s $RPM_BUILD_ROOT -./mkinitrd_setup.sh \ - -s $PWD/mkinitrd/scripts \ - -i $PWD/mkinitrd -mkdir mkinitrd/boot_tmp -kver=`env PATH=/sbin:/usr/sbin:$PATH get_kernel_version '%{kernel_binary}'` -test -n "${kver}" -arch=`arch` -%ifarch %ix86 -arch=i586 +# SLES has a different way to provide ntfs-3g feature. +%if %suse_version == 1315 +mkdir -p $RPM_BUILD_ROOT/tmp/etc/alternatives +pushd $RPM_BUILD_ROOT/tmp/etc/alternatives +ln -s /sbin/mount.ntfs-3g mount.ntfs +popd +pushd $RPM_BUILD_ROOT/tmp +tar czf $RPM_BUILD_ROOT/%{_libdir}/guestfs/supermin.d/zz-ntfs-symlink.tar.gz etc +popd +rm -rf $RPM_BUILD_ROOT/tmp %endif -cp -avL '%{kernel_binary}' mkinitrd/boot_tmp/vmlinuz.${arch} -cp -avL /boot/System.map-${kver} mkinitrd/boot_tmp -%if 0 -# [Bug 778149] mkinitrd does not copy links correctly -mkdir mkinitrd/bin_tmp -for cmd in ` awk '/^#%%programs:/ { print $2 }' mkinitrd/scripts/boot-guestfs.sh | sort -u ` -do - cp -v ` PATH=${RPM_BUILD_ROOT}/usr/bin:${RPM_BUILD_ROOT}/usr/sbin:${PATH}:/sbin:/usr/sbin type -p $cmd ` mkinitrd/bin_tmp/ || : -done -chmod -v 755 mkinitrd/bin_tmp/* -%endif -# -additional_modules=" -" -env PATH=${RPM_BUILD_ROOT}/usr/bin:${RPM_BUILD_ROOT}/usr/sbin:${PATH} \ -LIBGUESTFS_SRC_APPLIANCE_DIR=`cd $PWD/appliance ; pwd -P` \ -bash -x \ -./mkinitrd.sh \ - -l $PWD/mkinitrd \ - -k vmlinuz.${arch} \ - -i initramfs.${arch}.img \ - -b $PWD/mkinitrd/boot_tmp \ - -m "$additional_modules" \ - -f "lvm2 dm md network nfs btrfs usb" \ - -B -# -mkdir -vp $RPM_BUILD_ROOT%{_libdir}/guestfs -cp -avLt $RPM_BUILD_ROOT%{_libdir}/guestfs/ \ - mkinitrd/boot_tmp/initramfs.${arch}.img \ - mkinitrd/boot_tmp/vmlinuz.${arch} -chmod 644 $RPM_BUILD_ROOT%{_libdir}/guestfs/initramfs.${arch}.img %clean rm -rf $RPM_BUILD_ROOT @@ -813,6 +678,7 @@ rm -rf $RPM_BUILD_ROOT %files -n guestfs-data %defattr(-,root,root) %{_libdir}/guestfs +%exclude %{_libdir}/guestfs/supermin.d/zz-packages-* %if %{with ocaml_bindings} %files -n ocaml-libguestfs @@ -873,28 +739,44 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/*.so %{_libdir}/pkgconfig/* %{_includedir}/guestfs.h +%{_includedir}/guestfs-gobject +%{_includedir}/guestfs-gobject.h +%{_datadir}/gtk-doc/html/guestfs %{_mandir}/man3/* %files -n guestfsd %defattr(-,root,root) +%{udevrulesdir} %{_sbindir}/guestfsd %{_mandir}/man8/* %files -n guestfs-tools -f %{name}.lang %defattr(-,root,root) %doc COPYING +%{_sbindir}/libguestfs-make-fixed-appliance %{_bindir}/* +%exclude %{_bindir}/virt-v2v %config(noreplace) /etc/libguestfs-tools.conf -%if %{with ocaml_bindings} /etc/virt-builder %dir /etc/xdg/virt-builder %dir /etc/xdg/virt-builder/repos.d %config /etc/xdg/virt-builder/repos.d/* -%endif %if %{with bash_completion} %{_datadir}/bash-completion +%exclude %{_datadir}/bash-completion/*/virt-v2v %endif %{_mandir}/man1/* +%exclude %{_mandir}/man1/virt-v2v.* %{_mandir}/man5/* +%files -n virt-v2v +%defattr(-,root,root) +%{_bindir}/virt-v2v +%{_datadir}/bash-completion/*/virt-v2v +%{_mandir}/man1/virt-v2v.* +%if %{with_p2v} +%{_prefix}/lib/virt-p2v +%{_datadir}/virt-p2v +%endif + %changelog