/etc/zsh/zshenv: make sure /usr/bin/id is available
[grml-etc-core.git] / etc / zsh / zshenv
1 # Filename:      zshenv
2 # Purpose:       system-wide .zshenv file for zsh(1)
3 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
4 # Bug-Reports:   see http://grml.org/bugs/
5 # License:       This file is licensed under the GPL v2.
6 # Latest change: Mit Jul 25 15:02:01 CEST 2007 [mika]
7 ################################################################################
8 # This file is sourced on all invocations of the shell.
9 # It is the 1st file zsh reads; it's read for every shell,
10 # even if started with -f (setopt NO_RCS), all other
11 # initialization files are skipped.
12 #
13 # This file should contain commands to set the command
14 # search path, plus other important environment variables.
15 # This file should not contain commands that produce
16 # output or assume the shell is attached to a tty.
17 #
18 # Notice: .zshenv is the same, execpt that it's not read
19 # if zsh is started with -f
20 #
21 # Global Order: zshenv, zprofile, zshrc, zlogin
22 ################################################################################
23
24 # language settings (read in /etc/environment before /etc/default/locale as
25 # the latter one is the default on Debian nowadays)
26   [ -r /etc/environment    ] && source /etc/environment
27
28 # set environment variables (important for autologin on tty)
29   [ -z "$HOSTNAME" ]      && export HOSTNAME=$(hostname)
30   # make sure /usr/bin/id is available
31   if [ -x /usr/bin/id ] ; then
32      [ -z "$USER" ]          && export USER=$(/usr/bin/id -un)
33      [[ $LOGNAME == LOGIN ]] && LOGNAME=$(/usr/bin/id -un)
34   fi
35
36 # workaround for live-cd mode as $HOME is not set via rungetty
37   if [ -f /etc/grml_cd ] ; then
38     if (( EUID == 0 )); then
39        export HOME=/root
40     else
41        export HOME=/home/$USER
42     fi
43   fi
44
45 # set $PATH
46 # gentoo users have to source /etc/profile.env
47   if [ -r /etc/gentoo-release ] ; then
48      [ -r /etc/profile.env ] && source /etc/profile.env
49        if (( EUID != 0 )); then
50           PATH="$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/games:/usr/NX/bin:$PATH"
51        else
52           PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/NX/bin:$PATH"
53        fi
54   else
55     # support extra software in special directory outside of squashfs environment in live-cd mode
56     if [ -f /etc/grml_cd ] ; then
57        [ -d /cdrom/addons/ ] && ADDONS=':/cdrom/addons/'
58     fi
59     if (( EUID != 0 )); then
60       PATH="$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/games:/usr/NX/bin$ADDONS"
61     else
62       PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/NX/bin$ADDONS"
63     fi
64   fi
65
66   # Solaris 
67   # case $(uname 2>/dev/null) in
68   #   SunOS)
69   #      PATH="/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/sfw/bin:/opt/sfw/bin:/opt/bin:/usr/local/bin:/usr/openwin/bin:/usr/dt/bin:/usr/ucb:/usr/proc/bin:~/bin"
70   #      # LD_LIBRARY_PATH="/opt/csw/lib:/opt/sfw/lib:/usr/lib:/usr/local/lib:/usr/ccs/lib:/usr/openwin/lib:/usr/ucb/lib"
71   #      # MANPATH="$MANPATH:/opt/csw/man:/usr/man:/usr/share/man:/usr/local/man:/opt/sfw/man"
72   #esac
73
74 # less (:=pager) options:
75 #  export LESS=C
76   if [ -x /usr/bin/lesspipe ] ; then
77      export LESSOPEN="|lesspipe %s"
78   elif [ -x /usr/bin/lesspipe.sh ] ; then
79      export LESSOPEN="|lesspipe.sh %s"
80   fi
81   export READNULLCMD=${PAGER:-/usr/bin/pager}
82
83 # support termcap colors when using PAGER=less:
84   export LESS_TERMCAP_mb=$'\E[01;31m'
85   export LESS_TERMCAP_md=$'\E[01;31m'
86   export LESS_TERMCAP_me=$'\E[0m'
87   export LESS_TERMCAP_se=$'\E[0m'
88   export LESS_TERMCAP_so=$'\E[01;44;33m'
89   export LESS_TERMCAP_ue=$'\E[0m'
90   export LESS_TERMCAP_us=$'\E[01;32m'
91
92 # allow zeroconf for distcc
93   export DISTCC_HOSTS="+zeroconf"
94
95 # MAKEDEV should be usable on udev as well by default:
96   export WRITE_ON_UDEV=yes
97
98 ## END OF FILE #################################################################