summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xappliance/init2
-rw-r--r--src/guestfs.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/appliance/init b/appliance/init
index a3f47840..f3999160 100755
--- a/appliance/init
+++ b/appliance/init
@@ -78,7 +78,7 @@ if ! grep -sq guestfs_rescue=1 /proc/cmdline; then
fi
# Use appliance in rescue mode, also used by the virt-rescue command.
-TERM=linux ;# XXX library should pass this from library's environment
+eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline)
PS1='><rescue> '
export TERM PS1
echo
diff --git a/src/guestfs.c b/src/guestfs.c
index e6fcb0ea..e235fdcd 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -1257,10 +1257,12 @@ guestfs__launch (guestfs_h *g)
"%s " /* (selinux) */
"%s " /* (vmchannel) */
"%s " /* (verbose) */
+ "TERM=%s " /* (TERM environment variable) */
"%s", /* (append) */
g->selinux ? "selinux=1 enforcing=0" : "selinux=0",
vmchannel ? vmchannel : "",
g->verbose ? "guestfs_verbose=1" : "",
+ getenv ("TERM") ? : "linux",
g->append ? g->append : "");
add_cmdline (g, "-kernel");