[Libguestfs] [PATCH] appliance: init: properly set PS1 and TERM for virt-rescue (RHBZ#812970).
Richard W.M. Jones
rjones at redhat.com
Tue Jun 10 18:09:20 UTC 2014
On Tue, Jun 10, 2014 at 03:18:38PM +0200, Pino Toscano wrote:
> Setting environment variables such as PS1 for bash before starting it
> might not be effective when the startup scripts provided by the
> distribution unconditionally change it.
> Hence, set PS1 and TERM in a ~/.bashrc, which will be source'd last and
> thus be able to set them the way we want.
> ---
> appliance/init | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/appliance/init b/appliance/init
> index 8d13f2c..b407bf9 100755
> --- a/appliance/init
> +++ b/appliance/init
> @@ -142,9 +142,10 @@ else
> # Remove LD_PRELOAD=libSegFault set above.
> unset LD_PRELOAD
>
> - eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline)
> - PS1='><rescue> '
> - export TERM PS1
> + :> $HOME/.bashrc
> + grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline >> $HOME/.bashrc
> + echo "PS1='><rescue> '" >> $HOME/.bashrc
> + echo "export TERM PS1" >> $HOME/.bashrc
$HOME is /root I guess?
Anyway, yes, ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
More information about the Libguestfs
mailing list