diff options
-rw-r--r-- | meta/recipes-core/base-files/base-files/profile | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile index 9e4283e0c7..cc37e1ba77 100644 --- a/meta/recipes-core/base-files/base-files/profile +++ b/meta/recipes-core/base-files/base-files/profile | |||
@@ -2,7 +2,6 @@ | |||
2 | # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). | 2 | # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). |
3 | 3 | ||
4 | PATH="/usr/local/bin:/usr/bin:/bin" | 4 | PATH="/usr/local/bin:/usr/bin:/bin" |
5 | EDITOR="vi" # needed for packages like cron, git-commit | ||
6 | [ "$TERM" ] || TERM="vt100" # Basic terminal capab. For screen etc. | 5 | [ "$TERM" ] || TERM="vt100" # Basic terminal capab. For screen etc. |
7 | 6 | ||
8 | # Add /sbin & co to $PATH for the root user | 7 | # Add /sbin & co to $PATH for the root user |
@@ -20,13 +19,48 @@ if [ -d /etc/profile.d ]; then | |||
20 | unset i | 19 | unset i |
21 | fi | 20 | fi |
22 | 21 | ||
23 | # Make sure we are on a serial console (i.e. the device used starts with | 22 | if [ -t 0 -a $# -eq 0 ]; then |
24 | # /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher which tries do | 23 | if [ ! -x @BINDIR@/resize ] ; then |
25 | # use ssh | 24 | if [ -n "$BASH_VERSION" ] ; then |
26 | case $(tty 2>/dev/null) in | 25 | # Optimized resize funciton for bash |
27 | /dev/tty[A-z]*) [ -x @BINDIR@/resize ] && @BINDIR@/resize >/dev/null;; | 26 | resize() { |
28 | esac | 27 | local x y |
28 | IFS='[;' read -t 2 -p $(printf '\e7\e[r\e[999;999H\e[6n\e8') -sd R _ y x _ | ||
29 | [ -n "$y" ] && \ | ||
30 | echo -e "COLUMNS=$x;\nLINES=$y;\nexport COLUMNS LINES;" && \ | ||
31 | stty cols $x rows $y | ||
32 | } | ||
33 | else | ||
34 | # Portable resize function for ash/bash/dash/ksh | ||
35 | # with subshell to avoid local variables | ||
36 | resize() { | ||
37 | (o=$(stty -g) | ||
38 | stty -echo raw min 0 time 2 | ||
39 | printf '\0337\033[r\033[999;999H\033[6n\0338' | ||
40 | if echo R | read -d R x 2> /dev/null; then | ||
41 | IFS='[;R' read -t 2 -d R -r z y x _ | ||
42 | else | ||
43 | IFS='[;R' read -r _ y x _ | ||
44 | fi | ||
45 | stty "$o" | ||
46 | [ -z "$y" ] && y=${z##*[}&&x=${y##*;}&&y=${y%%;*} | ||
47 | [ -n "$y" ] && \ | ||
48 | echo "COLUMNS=$x;"&&echo "LINES=$y;"&&echo "export COLUMNS LINES;"&& \ | ||
49 | stty cols $x rows $y) | ||
50 | } | ||
51 | fi | ||
52 | fi | ||
53 | # Use the EDITOR not being set as a trigger to call resize | ||
54 | # and only do this for /dev/tty[A-z] which are typically | ||
55 | # serial ports | ||
56 | if [ -z "$EDITOR" -a "$SHLVL" = 1 ] ; then | ||
57 | case $(tty 2>/dev/null) in | ||
58 | /dev/tty[A-z]*) resize >/dev/null;; | ||
59 | esac | ||
60 | fi | ||
61 | fi | ||
29 | 62 | ||
63 | EDITOR="vi" # needed for packages like cron, git-commit | ||
30 | export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM | 64 | export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM |
31 | 65 | ||
32 | umask 022 | 66 | umask 022 |