zshenv: extend and update $ADDONS handling
[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: Sat Mar 22 00:37:25 CET 2008 [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 # no xsource() here because it's only created in zshrc! (which is good)
27 [[ -r /etc/environment ]] && source /etc/environment
28
29 # set environment variables (important for autologin on tty)
30 export HOSTNAME=${HOSTNAME:-$(hostname)}
31
32 # make sure /usr/bin/id is available
33 if [[ -x /usr/bin/id ]] ; then
34     [[ -z "$USER" ]]          && export USER=$(/usr/bin/id -un)
35     [[ $LOGNAME == LOGIN ]] && LOGNAME=$(/usr/bin/id -un)
36 fi
37
38 # workaround for live-cd mode as $HOME is not set via rungetty
39 if [[ -f /etc/grml_cd ]] ; then
40     if (( EUID == 0 )); then
41         export HOME=/root
42     else
43         export HOME=/home/$USER
44     fi
45 fi
46
47 # set $PATH
48 # gentoo users have to source /etc/profile.env
49 if [[ -r /etc/gentoo-release ]] ; then
50
51     [[ -r /etc/profile.env ]] && source /etc/profile.env
52
53     if (( EUID != 0 )); then
54         PATH="$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/games:/usr/NX/bin:$PATH"
55     else
56         PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/NX/bin:$PATH"
57     fi
58 else
59 # support extra software in special directory outside of squashfs environment in live-cd mode
60     if [[ -f /etc/grml_cd ]] ; then
61        [[ -r /cdrom/addons ]]      && ADDONS=':/cdrom/addons'
62        [[ -r /live/image/addons ]] && ADDONS=':/live/image/addons'
63        [[ -r /etc/grml/my_path ]]  && ADDONS=":$(cat /etc/grml/my_path)"
64     fi
65
66     if (( EUID != 0 )); then
67         PATH="$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/games:/usr/NX/bin$ADDONS"
68     else
69         PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/NX/bin$ADDONS"
70     fi
71 fi
72
73 # Solaris 
74 # case $(uname 2>/dev/null) in
75 #   SunOS)
76 #      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"
77 #      # LD_LIBRARY_PATH="/opt/csw/lib:/opt/sfw/lib:/usr/lib:/usr/local/lib:/usr/ccs/lib:/usr/openwin/lib:/usr/ucb/lib"
78 #      # MANPATH="$MANPATH:/opt/csw/man:/usr/man:/usr/share/man:/usr/local/man:/opt/sfw/man"
79 #esac
80
81 # less (:=pager) options:
82 #  export LESS=C
83 if [[ -x /usr/bin/lesspipe.sh ]] ; then
84     export LESSOPEN="|lesspipe.sh %s"
85 elif [[ -x /usr/bin/lesspipe ]] ; then
86     export LESSOPEN="|lesspipe %s"
87 fi
88 export READNULLCMD=${PAGER:-/usr/bin/pager}
89
90 # support termcap colors when using PAGER=less:
91 # TODO: move these to zshrc, they are only relevant in interactive shells
92 export LESS_TERMCAP_mb=$'\E[01;31m'
93 export LESS_TERMCAP_md=$'\E[01;31m'
94 export LESS_TERMCAP_me=$'\E[0m'
95 export LESS_TERMCAP_se=$'\E[0m'
96 export LESS_TERMCAP_so=$'\E[01;44;33m'
97 export LESS_TERMCAP_ue=$'\E[0m'
98 export LESS_TERMCAP_us=$'\E[01;32m'
99
100 # allow zeroconf for distcc
101 export DISTCC_HOSTS="+zeroconf"
102
103 # MAKEDEV should be usable on udev as well by default:
104 export WRITE_ON_UDEV=yes
105
106 ## END OF FILE #################################################################
107 # vim:filetype=zsh foldmethod=marker autoindent expandtab shiftwidth=4