All hosts with base role recently started to display PROD/STG text in shell prompt by setting PS1.
Attached patch improves the way PS1 is set:
Generic \$ is used, which displays $ for non-root users and # for root
path is separated from host name with space, just like in default Fedora prompt
problems with line editing are fixed by using [ and ]
for portability tput is used instead of hardcoding ANSI escape codes
attachment 0001-Improve-scripts-for-setting-PS1.patch
I went ahead and applied this. :)
Sadly, this isn't ideal either...
kevin@sheelba ~ % ssh batcave01 tmtput: No value for $TERM and no -T specified tput: No value for $TERM and no -T specified Last login: Wed Apr 13 23:05:57 2016 from bastion01.phx2.fedoraproject.org
And bunches of cron jobs are sending:
tput: No value for $TERM and no -T specified tput: No value for $TERM and no -T specified
So, I think we need to drop the tput here?
bummer - but yeah the tput sets the color. I can expirement with tput today to see if there is a better way.
Only setting PS1 for interactive shells might be all that's needed here (e.g. [[ $- =~ i ]] && PS1=...).
[[ $- =~ i ]] && PS1=...
I'll attach a patch if anyone wants to test it. I ran into this while doing a git fetch from pkgs.fpo.
base: only set PS1 for prod/stage for interactive sessions 0001-base-only-set-PS1-for-prod-stage-for-interactive-ses.patch
I went ahead and applied this.
The thing I was seeing eariler was due to my proxying via bastion... so it was there that was showing the tputs. ;)
Any other improvements we could make here?
ok. I guess for now, lets close this and if we see something else we want to change go with a new ticket.
Login to comment on this ticket.