summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/base-files/base-files/profile
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/base-files/base-files/profile')
-rw-r--r--meta/recipes-core/base-files/base-files/profile48
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
4PATH="/usr/local/bin:/usr/bin:/bin" 4PATH="/usr/local/bin:/usr/bin:/bin"
5EDITOR="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
21fi 20fi
22 21
23# Make sure we are on a serial console (i.e. the device used starts with 22if [ -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
26case $(tty 2>/dev/null) in 25# Optimized resize funciton for bash
27 /dev/tty[A-z]*) [ -x @BINDIR@/resize ] && @BINDIR@/resize >/dev/null;; 26resize() {
28esac 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
36resize() {
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
61fi
29 62
63EDITOR="vi" # needed for packages like cron, git-commit
30export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM 64export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM
31 65
32umask 022 66umask 022