
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Wednesday 2008-07-23 at 14:03 +0200, Michal Marek wrote:
Add the "export PS1" command to /etc/bash.bashrc.local in your factory installation ;-) (create the file if it doesn't exist already)
Ah, that would be better than on on root's home as I was thinking of doing. However, I don't want to see that prompt on the occasions that I do boot my real factory partition, so the copy-paste approach may have to do for the moment :-)
You could try something like # stat -c '%d/%i' / /proc/1/root/ which should print two identical device/inode pairs a real root and two different in a chroot :-).
Cute! :-) I wrote "/etc/bash.bashrc.local": UNO=`stat -c '%d/%i' /` DOS=`stat -c '%d/%i' /proc/1/root/` if test $UNO != $DOS ; then export PS1=$'\[\E[1m\E[31m\](chroot)_\h:\w # \[\E(B\E[m\]' fi But it still need refinements; It works fine for root: NOT_nimrodel:/etc # su - (chroot)_nimrodel:~ # but not for a user (aside from the PS1 needing to be different): NOT_nimrodel:/etc # su - cer stat: cannot stat `/proc/1/root/': Permission denied - -bash: test: 5710/2: unary operator expected cer@nimrodel:~> I'd might add the stat command to sudoers, with no password. But it is getting complicated, even if I do I also need to detect if it is a user or root and change the PS1 differently. So, for the moment, I can leave it as: if test $UID = 0 ; then UNO=`stat -c '%d/%i' /` DOS=`stat -c '%d/%i' /proc/1/root/` if test $UNO != $DOS ; then export PS1=$'\[\E[1m\E[31m\](chroot)_\h:\w # \[\E(B\E[m\]' fi fi As normally I will not be using that chroot as a user. Still... - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) iD8DBQFIiEoTtTMYHG2NR9URAo7jAJwL93NJ6tfsn1oDfjg8ic8whhn+JwCdEv4B ViNGNBEOnU0Zx+RGUsTwcHs= =c7Ng -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-factory+help@opensuse.org