diff options
author | Johannes Schneider <johannes.schneider@leica-geosystems.com> | 2023-10-13 10:27:34 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-10-19 13:38:54 +0100 |
commit | dcdb30c83eb77fb2d5ea04f9b7fd7371da633a34 (patch) | |
tree | 8afe8377d324dc7b54f29f8610babfcc0e7cd34e /meta/recipes-core/base-files | |
parent | 0151bba91387559852c27e044d6e58c3a53d26d5 (diff) | |
download | openembedded-core-dcdb30c83eb77fb2d5ea04f9b7fd7371da633a34.tar.gz |
base-files: profile: allow profile.d to set EDITOR
With a profile.d configuration in place that sets the EDITOR variable,
the automatic terminal 'resize' logic would not trigger. Which then
would possibly lead to a 80x24 fallback on the debug serial console.
This can simply be avoided by setting a flag variable when the shell
is first opened, then processing all profile.d includes, trigger the
'resize' depending on the flag and shell-level and finally only set
EDITOR to some default if it is still unset.
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Diffstat (limited to 'meta/recipes-core/base-files')
-rw-r--r-- | meta/recipes-core/base-files/base-files/profile | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile index cc37e1ba77..bded3757cc 100644 --- a/meta/recipes-core/base-files/base-files/profile +++ b/meta/recipes-core/base-files/base-files/profile @@ -10,6 +10,12 @@ PATH="/usr/local/bin:/usr/bin:/bin" # Set the prompt for bash and ash (no other shells known to be in use here) [ -z "$PS1" ] || PS1='\u@\h:\w\$ ' +# Use the EDITOR not being set as a trigger to call resize later on +FIRSTTIMESETUP=0 +if [ -z "$EDITOR" ] ; then + FIRSTTIMESETUP=1 +fi + if [ -d /etc/profile.d ]; then for i in /etc/profile.d/*.sh; do if [ -f $i -a -r $i ]; then @@ -50,17 +56,19 @@ resize() { } fi fi - # Use the EDITOR not being set as a trigger to call resize - # and only do this for /dev/tty[A-z] which are typically + # only do this for /dev/tty[A-z] which are typically # serial ports - if [ -z "$EDITOR" -a "$SHLVL" = 1 ] ; then + if [ $FIRSTTIMESETUP -eq 1 -a $SHLVL -eq 1 ] ; then case $(tty 2>/dev/null) in /dev/tty[A-z]*) resize >/dev/null;; esac fi fi -EDITOR="vi" # needed for packages like cron, git-commit +if [ -z "$EDITOR" ]; then + EDITOR="vi" # needed for packages like cron, git-commit +fi + export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM umask 022 |