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

[ -e ~/.umask ] && . ~/.umask

if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games"
  
  if [ -z "$sd" ]; then
    echo
    echo
    echo
    echo "Welcome to `hostname -s | perl -pe 's/(.)/uc($1)/e'`!"
    echo
    if [ -e ~/.run_setup ]; then
      echo "running \`setup\`..."
      echo
      setup
    elif [ \! -e ~/.no_fortune ]; then
      if [ $[ $RANDOM % 3 ] = 0 ]; then
        if [ $[ $RANDOM % 4 ] = 0 ]; then
          sl -l
        else
          < /usr/local/share/dict/non_off fortune.b | figlet | cowsay -n | tee ~/.fortune
        fi
      else
        /bin/true
        /usr/games/fortune | tee ~/.fortune
      fi
    fi
    echo
  fi
fi

if [ "$PS1" ]; then
  if [ "$BASH" ]; then
    PS1='\u@\h:\w\$ '
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

export PATH

umask 022
export MAIL=${HOME}/Maildir/
export MAILDIR=${HOME}/Maildir
export VISUAL=nano
export EDITOR=nano
