SHA256
1
0
forked from pool/libguestfs

- Update to version 1.19.44

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=113
This commit is contained in:
Olaf Hering 2012-09-25 05:24:51 +00:00 committed by Git OBS Bridge
parent 79c7e76398
commit 7dbf8f0873
7 changed files with 9 additions and 219 deletions

View File

@ -1,25 +0,0 @@
From 09c372ea250e8241d62e9fde70eabe7bdca83050 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 22 Sep 2012 10:47:11 +0100
Subject: [PATCH 1/3] test-launch-race: Add comment.
---
tests/protocol/test-launch-race.pl | 2 +-
1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)
diff --git a/tests/protocol/test-launch-race.pl b/tests/protocol/test-launch-race.pl
index 7a1e836..f933bfe 100755
--- a/tests/protocol/test-launch-race.pl
+++ b/tests/protocol/test-launch-race.pl
@@ -39,7 +39,7 @@ if ($pid == 0) {
my $g = Sys::Guestfs->new ();
$g->add_drive ("/dev/null");
$g->launch ();
- _exit (0);
+ _exit (0); # So the tmpdir is not removed.
}
my $g = Sys::Guestfs->new ();
--
1.7.12

View File

@ -1,151 +0,0 @@
From 55fef0e4e607b1d447a0a0804acd69481f7613e4 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 21 Sep 2012 20:00:34 +0200
Subject: [PATCH 2/3] sysprep: handle distro specific sysv scripts
Currently firstboot would only work on redhat-based images.
Handle redhat-based, suse-based and debian guests, error out in case of an
unknown distro.
Update firstboot.sh:
- make sure scripts exists and can be executed
- add LSB header to avoid insserv warnings later on
- run script only if called with "start"
Update functions, pass only required options.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
sysprep/firstboot.ml | 81 +++++++++++++++++++++++++++++++++++++++++++++-------
1 Datei geändert, 70 Zeilen hinzugefügt(+), 11 Zeilen entfernt(-)
diff --git a/sysprep/firstboot.ml b/sysprep/firstboot.ml
index 97cd8a9..1b92d74 100644
--- a/sysprep/firstboot.ml
+++ b/sysprep/firstboot.ml
@@ -28,14 +28,35 @@ let firstboot_dir = "/usr/lib/virt-sysprep"
let firstboot_sh = sprintf "\
#!/bin/sh -
+### BEGIN INIT INFO
+# Provides: virt-sysprep
+# Required-Start: $null
+# Should-Start: $all
+# Required-Stop: $null
+# Should-Stop: $all
+# Default-Start: 2 3 5
+# Default-Stop: 0 1 6
+# Short-Description: Start scripts to run once at next boot
+# Description: Start scripts to run once at next boot
+# These scripts run the first time the guest boots,
+# and then are deleted. Output or errors from the scripts
+# are written to ~root/virt-sysprep-firstboot.log.
+### END INIT INFO
+
d=%s/scripts
logfile=~root/virt-sysprep-firstboot.log
-for f in $d/* ; do
- echo '=== Running' $f '===' >>$logfile
- $f >>$logfile 2>&1
- rm $f
-done
+if test \"$1\" = \"start\"
+then
+ for f in $d/* ; do
+ if test -x \"$f\"
+ then
+ echo '=== Running' $f '===' >>$logfile
+ $f >>$logfile 2>&1
+ rm -f $f
+ fi
+ done
+fi
" firstboot_dir
let firstboot_service = sprintf "\
@@ -56,7 +77,7 @@ WantedBy=default.target
let failed fs =
ksprintf (fun msg -> failwith (s_"firstboot: failed: " ^ msg)) fs
-let rec install_service g root =
+let rec install_service g distro =
g#mkdir_p firstboot_dir;
g#mkdir_p (sprintf "%s/scripts" firstboot_dir);
g#write (sprintf "%s/firstboot.sh" firstboot_dir) firstboot_sh;
@@ -64,18 +85,28 @@ let rec install_service g root =
(* systemd, else assume sysvinit *)
if g#is_dir "/etc/systemd" then
- install_systemd_service g root
+ install_systemd_service g
else
- install_sysvinit_service g root
+ install_sysvinit_service g distro
(* Install the systemd firstboot service, if not installed already. *)
-and install_systemd_service g root =
+and install_systemd_service g =
g#write (sprintf "%s/firstboot.service" firstboot_dir) firstboot_service;
g#mkdir_p "/etc/systemd/system/default.target.wants";
g#ln_sf (sprintf "%s/firstboot.service" firstboot_dir)
"/etc/systemd/system/default.target.wants"
-and install_sysvinit_service g root =
+and install_sysvinit_service g = function
+ | "fedora"|"rhel"|"centos"|"scientificlinux"|"redhat-based" ->
+ install_sysvinit_redhat g
+ | "opensuse"|"sles"|"suse-based" ->
+ install_sysvinit_suse g
+ | "debian" ->
+ install_sysvinit_debian g
+ | distro ->
+ failed "guest type %s is not supported" distro
+
+and install_sysvinit_redhat g =
g#mkdir_p "/etc/rc.d/rc2.d";
g#mkdir_p "/etc/rc.d/rc3.d";
g#mkdir_p "/etc/rc.d/rc5.d";
@@ -86,12 +117,40 @@ and install_sysvinit_service g root =
g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
"/etc/rc.d/rc5.d/99virt-sysprep-firstboot"
+(* Make firstboot.sh look like a runlevel script to avoid insserv warnings. *)
+and install_sysvinit_suse g =
+ g#mkdir_p "/etc/init.d/rc2.d";
+ g#mkdir_p "/etc/init.d/rc3.d";
+ g#mkdir_p "/etc/init.d/rc5.d";
+ g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
+ "/etc/init.d/virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc2.d/S99virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc3.d/S99virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc5.d/S99virt-sysprep-firstboot"
+
+and install_sysvinit_debian g =
+ g#mkdir_p "/etc/init.d";
+ g#mkdir_p "/etc/rc2.d";
+ g#mkdir_p "/etc/rc3.d";
+ g#mkdir_p "/etc/rc5.d";
+ g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
+ "/etc/init.d/virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc2.d/S99virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc3.d/S99virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc5.d/S99virt-sysprep-firstboot"
+
let add_firstboot_script g root id content =
let typ = g#inspect_get_type root in
let distro = g#inspect_get_distro root in
match typ, distro with
| "linux", _ ->
- install_service g root;
+ install_service g distro;
let t = Int64.of_float (Unix.time ()) in
let r = string_random8 () in
let filename = sprintf "%s/scripts/%Ld-%s-%s" firstboot_dir t r id in
--
1.7.12

View File

@ -1,33 +0,0 @@
From 1949016e899b2737525fdc9b6dda451ad9ecbd66 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 21 Sep 2012 21:04:43 +0200
Subject: [PATCH 3/3] sysprep: handle at jobs in cron-spool operation
cron-spool claims to remove at jobs, but it has no code to actually do
that. Add patterns to remove files in known at spool locations.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
sysprep/sysprep_operation_cron_spool.ml | 6 ++++++
1 Datei geändert, 6 Zeilen hinzugefügt(+)
diff --git a/sysprep/sysprep_operation_cron_spool.ml b/sysprep/sysprep_operation_cron_spool.ml
index 5284660..e96832c 100644
--- a/sysprep/sysprep_operation_cron_spool.ml
+++ b/sysprep/sysprep_operation_cron_spool.ml
@@ -23,6 +23,12 @@ module G = Guestfs
let cron_spool_perform g root =
Array.iter g#rm_rf (g#glob_expand "/var/spool/cron/*");
+ Array.iter g#rm (g#glob_expand "/var/spool/atjobs/*");
+ Array.iter g#rm (g#glob_expand "/var/spool/atjobs/.SEQ");
+ Array.iter g#rm (g#glob_expand "/var/spool/atspool/*");
+ Array.iter g#rm (g#glob_expand "/var/spool/at/*");
+ Array.iter g#rm (g#glob_expand "/var/spool/at/.SEQ");
+ Array.iter g#rm (g#glob_expand "/var/spool/at/spool/*");
[]
let cron_spool_op = {
--
1.7.12

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a2f00208be03e64a37e6cf0c8583a114b9b288cc13758eabfedc3506190a7137
size 8375089

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b2a0a31ffa02cf2ed029904b37092b48da3bece440fe4cbefcbd469d4ad66c40
size 8424657

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Sep 25 07:23:54 CEST 2012 - ohering@suse.de
- Update to version 1.19.44
-------------------------------------------------------------------
Mon Sep 24 14:55:51 CEST 2012 - ohering@suse.de

View File

@ -67,11 +67,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
Summary: Compatibility package for guestfs-tools
License: LGPL-2.1
Group: System/Filesystems
Version: 1.19.43
Version: 1.19.44
Release: 0
Patch0001: 0001-test-launch-race-Add-comment.patch
Patch0002: 0002-sysprep-handle-distro-specific-sysv-scripts.patch
Patch0003: 0003-sysprep-handle-at-jobs-in-cron-spool-operation.patch
Patch5: libguestfs-1.13.14-ruby.patch
Patch1000: 1000-force-virtio_blk-in-old-guest-kernel.patch
Source0: %{name}-%{version}.tar.gz
@ -341,9 +338,6 @@ virtual machines.
%prep
%setup -q
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch5 -p1
%patch1000 -p1