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:57 +0100 |
commit | 13ac9ece3bab29bd876c4f38a313c7af6ad8260a (patch) | |
tree | 8b4a3b803432cf976b63915b615fac7727a46d62 /meta/recipes-core | |
parent | 708d11b23c15015ee4d0b721f3c8d255d4b5c305 (diff) | |
download | poky-13ac9ece3bab29bd876c4f38a313c7af6ad8260a.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.
(From OE-Core rev: dcdb30c83eb77fb2d5ea04f9b7fd7371da633a34)
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-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" | |||
10 | # Set the prompt for bash and ash (no other shells known to be in use here) | 10 | # Set the prompt for bash and ash (no other shells known to be in use here) |
11 | [ -z "$PS1" ] || PS1='\u@\h:\w\$ ' | 11 | [ -z "$PS1" ] || PS1='\u@\h:\w\$ ' |
12 | 12 | ||
13 | # Use the EDITOR not being set as a trigger to call resize later on | ||
14 | FIRSTTIMESETUP=0 | ||
15 | if [ -z "$EDITOR" ] ; then | ||
16 | FIRSTTIMESETUP=1 | ||
17 | fi | ||
18 | |||
13 | if [ -d /etc/profile.d ]; then | 19 | if [ -d /etc/profile.d ]; then |
14 | for i in /etc/profile.d/*.sh; do | 20 | for i in /etc/profile.d/*.sh; do |
15 | if [ -f $i -a -r $i ]; then | 21 | if [ -f $i -a -r $i ]; then |
@@ -50,17 +56,19 @@ resize() { | |||
50 | } | 56 | } |
51 | fi | 57 | fi |
52 | fi | 58 | fi |
53 | # Use the EDITOR not being set as a trigger to call resize | 59 | # only do this for /dev/tty[A-z] which are typically |
54 | # and only do this for /dev/tty[A-z] which are typically | ||
55 | # serial ports | 60 | # serial ports |
56 | if [ -z "$EDITOR" -a "$SHLVL" = 1 ] ; then | 61 | if [ $FIRSTTIMESETUP -eq 1 -a $SHLVL -eq 1 ] ; then |
57 | case $(tty 2>/dev/null) in | 62 | case $(tty 2>/dev/null) in |
58 | /dev/tty[A-z]*) resize >/dev/null;; | 63 | /dev/tty[A-z]*) resize >/dev/null;; |
59 | esac | 64 | esac |
60 | fi | 65 | fi |
61 | fi | 66 | fi |
62 | 67 | ||
63 | EDITOR="vi" # needed for packages like cron, git-commit | 68 | if [ -z "$EDITOR" ]; then |
69 | EDITOR="vi" # needed for packages like cron, git-commit | ||
70 | fi | ||
71 | |||
64 | export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM | 72 | export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM |
65 | 73 | ||
66 | umask 022 | 74 | umask 022 |