# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
EDITOR="/bin/vi-tiny"			# needed for packages like cron
TERM="linux"

if [ "$PS1" ]; then

   if [ $UID = '0' ]
   then
       PS1='\[\e[00;31m\]\u\[\e[00;37m\]@\[\e[0m\e[01;30m\]\h\[\e[01;24;37m\]:\[\e[01;34m\]\w\[\e[01;37m\] \$\[\e[0m\] '
   else
       PS1='\[\e[00;32m\]\u\[\e[00;37m\]@\[\e[0m\e[01;30m\]\h\[\e[01;24;37m\]:\[\e[01;34m\]\w\[\e[01;37m\] \$\[\e[0m\] '
   fi

fi

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh ; do
    . $i
  done
  unset i
fi

export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM LINES COLUMNS

umask 022

TERMINAL=$(tty)
if [ ${TERMINAL:5:3} == pts ]
then
        cat /etc/issue.net      
fi

if [ ${TERMINAL:5:4} == ttyS ] || [ ${TERMINAL:5:4} == ttyO ] || [ ${TERMINAL:5:6} == ttymxc ]
then
    if [ -x /usr/bin/resize ];
    then
        resize > /dev/null;
    fi
fi

alias minicom='minicom -con'

if [[ ! ${TERMINAL:8:1} == [1-9] ]]
then
	alias nano='TERM=vt102 nano'
	alias rnano='TERM=vt102 rnano'
	alias htop='TERM=xterm htop'
	alias vi='TERM=xterm vi-tiny'
	alias vim='TERM=xterm vim'
	alias vim.tiny='TERM=xterm vim.tiny'
fi
