bf6c81900a7c8682b0c9e8fd187515d3b76404e9
[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 ################################################################################
7 # This file is sourced on all invocations of the shell.
8 # It is the 1st file zsh reads; it's read for every shell,
9 # even if started with -f (setopt NO_RCS), all other
10 # initialization files are skipped.
11 #
12 # This file should contain commands to set the command
13 # search path, plus other important environment variables.
14 # This file should not contain commands that produce
15 # output or assume the shell is attached to a tty.
16 #
17 # Notice: .zshenv is the same, execpt that it's not read
18 # if zsh is started with -f
19 #
20 # Global Order: zshenv, zprofile, zshrc, zlogin
21 ################################################################################
22
23 # language settings (read in /etc/environment before /etc/default/locale as
24 # the latter one is the default on Debian nowadays)
25 # no xsource() here because it's only created in zshrc! (which is good)
26 [[ -r /etc/environment ]] && source /etc/environment
27
28 # set environment variables (important for autologin on tty)
29 export HOSTNAME=${HOSTNAME:-$(hostname)}
30
31 # make sure /usr/bin/id is available
32 if [[ -x /usr/bin/id ]] ; then
33     [[ -z "$USER" ]]          && export USER=$(/usr/bin/id -un)
34     [[ $LOGNAME == LOGIN ]] && LOGNAME=$(/usr/bin/id -un)
35 fi
36
37 # workaround for live-cd mode as $HOME is not set via rungetty
38 if [[ -f /etc/grml_cd ]] ; then
39     if (( EUID == 0 )); then
40         export HOME=/root
41     else
42         export HOME=/home/$USER
43     fi
44 fi
45
46 # set $PATH
47 # gentoo users have to source /etc/profile.env
48 if [[ -r /etc/gentoo-release ]] ; then
49
50     [[ -r /etc/profile.env ]] && source /etc/profile.env
51
52     if (( EUID != 0 )); then
53         PATH="$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/games:/usr/NX/bin:$PATH"
54     else
55         PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/NX/bin:$PATH"
56     fi
57 else
58 # support extra software in special directory outside of squashfs environment in live-cd mode
59     if [[ -f /etc/grml_cd ]] ; then
60        [[ -r /cdrom/addons ]]      && ADDONS=':/cdrom/addons'
61        [[ -r /live/image/addons ]] && ADDONS=':/live/image/addons'
62        [[ -r /etc/grml/my_path ]]  && ADDONS=":$(cat /etc/grml/my_path)"
63     fi
64
65     if (( EUID != 0 )); then
66         PATH="$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/games:/usr/NX/bin$ADDONS"
67     else
68         PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/NX/bin$ADDONS"
69     fi
70 fi
71
72 # Solaris
73 case $(uname 2>/dev/null) in
74   SunOS)
75      PATH="/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/SUNWspro/bin:/usr/ucb:/usr/sfw/bin:/usr/gnu/bin:/usr/openwin/bin:/opt/csw/bin:/opt/swf/bin:/sbin:/usr/sbin:~/bin"
76      # LD_LIBRARY_PATH="/opt/csw/lib:/opt/sfw/lib:/usr/lib:/usr/local/lib:/usr/ccs/lib:/usr/openwin/lib:/usr/ucb/lib"
77      # MANPATH="$MANPATH:/opt/csw/man:/usr/man:/usr/share/man:/usr/local/man:/opt/sfw/man"
78 esac
79
80 # less (:=pager) options:
81 #  export LESS=C
82 typeset -a lp; lp=( ${^path}/lesspipe(N) )
83 if (( $#lp > 0 )) && [[ -x $lp[1] ]] ; then
84     export LESSOPEN="|lesspipe %s"
85 elif [[ -x /usr/bin/lesspipe.sh ]] ; then
86     export LESSOPEN="|lesspipe.sh %s"
87 fi
88 unset lp
89
90 export READNULLCMD=${PAGER:-/usr/bin/pager}
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 #################################################################
99 # vim:filetype=zsh foldmethod=marker autoindent expandtab shiftwidth=4