[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH] appliance: init: properly set PS1 and TERM for virt-rescue (RHBZ#812970).



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
 
   echo
   echo "------------------------------------------------------------"
-- 
1.9.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]