mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone
Blob Blame History Raw
From f1f0123903cb2cfa66832284ca25424e903883f2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 24 Mar 2016 10:48:03 +0000
Subject: [PATCH] rescue: Print chroot suggestion for Linux guests.

(cherry picked from commit a5507a16c68b6ee56258d44087b4e4529290934a)
---
 rescue/rescue.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/rescue/rescue.c b/rescue/rescue.c
index 16028a7..982f3c4 100644
--- a/rescue/rescue.c
+++ b/rescue/rescue.c
@@ -459,11 +459,14 @@ do_suggestion (struct drv *drvs)
     for (j = 0; mps[j] != NULL; j += 2)
       printf ("mount %s /sysroot%s\n", mps[j+1], mps[j]);
 
-    /* If it's Linux, print the bind-mounts. */
+    /* If it's Linux, print the bind-mounts and a chroot command. */
     if (type && STREQ (type, "linux")) {
       printf ("mount --rbind /dev /sysroot/dev\n");
       printf ("mount --rbind /proc /sysroot/proc\n");
       printf ("mount --rbind /sys /sysroot/sys\n");
+      printf ("\n");
+      printf ("cd /sysroot\n");
+      printf ("chroot /sysroot\n");
     }
 
     printf ("\n");
-- 
1.8.3.1