[Pkg-libvirt-commits] [libguestfs] 70/179: v2v: Add 'exit' choice to --root ask.

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 31 19:08:25 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 88a482dd9f6f1b842350edd0437dfe621ebcf510
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Mon Oct 13 13:07:43 2014 +0200

    v2v: Add 'exit' choice to --root ask.
    
    If the user does ^C then this leaves temporary overlay files around
    (possibly a bug?).  Offer an 'exit' choice to the user which exits
    cleanly.
    
    The new message looks like this:
    
      Dual- or multi-boot operating system detected.  Choose the root filesystem
      that contains the main operating system from the list below:
    
       [1] /dev/sda3 (Fedora release 20 (Heisenbug))
       [2] /dev/sdb3
    
      Enter a number between 1 and 2, or 'exit': exit
---
 v2v/v2v.ml | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index fdb5735..7b10990 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -417,7 +417,7 @@ and inspect_source g root_choice =
       | `Ask ->
         (* List out the roots and ask the user to choose. *)
         printf "\n***\n";
-        printf (f_"dual- or multi-boot operating system detected. Choose the root filesystem\nthat contains the main operating system from the list below:\n");
+        printf (f_"Dual- or multi-boot operating system detected.  Choose the root filesystem\nthat contains the main operating system from the list below:\n");
         printf "\n";
         iteri (
           fun i root ->
@@ -430,11 +430,15 @@ and inspect_source g root_choice =
         let i = ref 0 in
         let n = List.length roots in
         while !i < 1 || !i > n do
-          printf (f_"Enter number between 1 and %d: ") n;
-          (try i := int_of_string (read_line ())
-           with
-           | End_of_file -> error (f_"connection closed")
-           | Failure "int_of_string" -> ()
+          printf (f_"Enter a number between 1 and %d, or 'exit': ") n;
+          let input = read_line () in
+          if input = "exit" || input = "q" || input = "quit" then
+            exit 0
+          else (
+            try i := int_of_string input
+            with
+            | End_of_file -> error (f_"connection closed")
+            | Failure "int_of_string" -> ()
           )
         done;
         List.nth roots (!i - 1)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list