-
Notifications
You must be signed in to change notification settings - Fork 0
/
env
338 lines (277 loc) · 7.25 KB
/
env
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
#
# - set up shell environment
# - only sourced for interactive shells
# - may assume $HOME, $LOGNAME, $USER set (see 'init.d/identity')
# - assumes setenv() et al are available (see './setenv')
#
# TODO: should we also be sourced for non-interactive?
# TODO: factor some/all of this out into ~/.bash/env.d/
#
export LINES
export COLUMNS
unset MAIL MAILPATH MAILCHECK
# this gets week numbers correct, such as with 'ncal' output
# NOTE: $LANG set in 'rc' (needs to be set prior to most things)
# TODO: consider using LANG=C.UTF-8 but this has sorting implications
#
export LC_TIME=C
esetenv HOSTFILE ~/var/bash/hostfile
esetenv PROMPT_COMMAND 'prompt_command $?'
# TODO: this is really just a readlink of /proc/self/fd/0
# (but that only works on linux), maybe we want this in OS-specific
#
esetenv TERMINAL $(tty)
# TODO: why does gpg2 not simply use ttyname(STDIN_FILENO)?
#
esetenv GPG_TTY $TERMINAL
# this can occur in a chroot with different kinds of bind mounts
# in which case it can be /any/path/leading/to/dev/ttyfoo
#
esetenv TERMINAL ${TERMINAL##*/dev/}
###
psetenv shell_init_path_generic \
/usr/local/bin \
/usr/local/sbin \
/bin \
/sbin \
/usr/bin \
/usr/sbin \
;
psetenv LD_LIBRARY_PATH \
$HOME/lib \
/usr/local/lib \
;
psetenv GOPATH \
$HOME/go \
;
# XXX TODO: hack for macports, not sure why it installs like this
# XXX UPDATE: now getting segfaults *with* it, removing for now
#
#psetenv PERLLIB \
# /opt/local/lib/perl5/vendor_perl/5.16.1/darwin-thread-multi-2level \
# /opt/local/lib/perl5/vendor_perl \
# /opt/local/lib/perl5/vendor_perl/5.16.1 \
# /usr/local/lib/perl5/site_perl/5.8.8 \
# /usr/local/lib/perl5/vendor_perl/5.8.8 \
# /usr/local/lib/perl5/vendor_perl/5.8.8 \
#;
# XXX UPDATE: adding some back for linux/omnius
#
esetenv PERLLIB \
/usr/local/lib/perl5/site_perl/5.8.8: \
/usr/local/lib/perl5/vendor_perl/5.8.8 \
;
# python virtualenv likes to monkey with our prompt
#
esetenv VIRTUAL_ENV_DISABLE_PROMPT=1
###
# grep 2.9 default on fedora 15 manual page says:
# ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36
# XXX TODO option to output default or add to --version, upstream
#
# sl: selected lines
# cx: context lines
# mt: matched
# ms: selected (huh? diff with mt?)
# mc: context line
# fn: filenames when -l
# ln: line numbers when -n
# bn: byte offsets when -b
# se: separators
#
psetenv GREP_COLORS \
sl= \
cx= \
ms=01\;31 \
mc=01\;31 \
fn=01\;36 \
ln=32 \
bn=32 \
se=36 \
;
###
esetenv TIMEFORMAT "time: %0Rs"
# overridden later if vim found
#
esetenv VISUAL vi
esetenv EDITOR $VISUAL
esetenv BROWSER elinks
esetenv COMP_WORDBREAKS "${COMP_WORDBREAKS/:/}"
esetenv BLOCK_SIZE human-readable # df, du, ls
esetenv RI "-f ansi" # ruby rdoc ri
esetenv LYNX_CFG $HOME/.lynxrc
esetenv LESS "-iSQRF#3 --no-vbell"
esetenv PAGER "less"
esetenv MANPAGER "$PAGER -s"
esetenv MANWIDTH 80
esetenv GH_MDWIDTH $MANWIDTH # github cli
esetenv MANHTMLPAGER elinks # man2html
esetenv PDSH_RCMD_TYPE ssh
esetenv PDSH_MISC_MODULES netgroup
esetenv PDSH_REMOTE_PDCP_PATH /usr/bin/pdcp # ours is /usr/local
esetenv SSH_ASKPASS /bin/true # for pdsh
esetenv FANOUT 384 # -f NNNN
#esetenv FANOUT 9999 # see github.com/chaos/pdsh #123
# TODO: what is this and why?
esetenv NCURSES_NO_PADDING 1
esetenv NCURSES_NO_SETBUF 1
esetenv ORACLE_BASE /var/oracle
esetenv ORACLE_HOME /opt/oracle/9i
esetenv ORACLE_OWNER oracle
esetenv PGUSER postgres
esetenv LDAPTLS_CACERT $HOME/.cacerts
# now using separate pki user and ~pki --smm20150209114221
# TODO: remove once this stabilizes
#
#esetenv EASYRSA_PKI $HOME/pki
#esetenv EASYRSA_VARS_FILE $HOME/.pki/easy/rc
###
# man-db uses 'col' in pipe, which breaks pinfo
#
esetenv MAN_KEEP_FORMATTING 1
# we want our git env carefully constructed by only ourselves
#
esetenv GIT_CONFIG_NOSYSTEM 1
# disables gtk3 warning when cannot reach dbus accessibility service
#
esetenv NO_AT_BRIDGE 1
# rather than make a ~root/.ssh/config just for rsyncing
# TODO find better place for this, perhaps ~root/ is better
#
esetenv RSYNC_RSH ssh
# TODO https://github.com/wofr06/lesspipe
type -p lesspipe.sh &>/dev/null && true
#esetenv LESSOPEN "|lesspipe.sh %s"
# because our PS1 has a newline, see upstream PR 514
esetenv LESS_SHELL_LINES 2
# tell redhat tools (eg 'service') not to use dbus and not to
# use systemd and to stop dbus from launching automatically
#
#psetenv DBUS_SESSION_BUS_ADDRESS :${USER:?}@${HOSTNAME:?}
esetenv SYSTEMCTL_SKIP_REDIRECT 1
# make 'gcal' format dates correctly
#
esetenv GCAL \
"--starting-day=mon " \
"--with-week-number " \
"--iso-week-number=yes " \
;
# libvirt appliance cache
esetenv LIBGUESTFS_CACHEDIR /var/cache/libguestfs
# for android Studio to display windows properly with ratpoison
esetenv _JAVA_AWT_WM_NONREPARENTING 1
# taskwarrior / timewarrior
source ~/.taskenv 2>/dev/null
##############################################################################
shell_init_arch_specific ()
{
case `uname -s` in # TODO: use HOSTTYPE, MACHTYPE, OSTYPE
(Linux) #########################
psetenv AWT_TOOLKIT \
MToolkit \
;
psetenv XDG_RUNTIME_DIR \
/run/user/${UID:?} \
;
;;
(SunOS) #########################
psetenv shell_init_path_post \
/usr/openwin/bin \
/usr/ccs/bin \
/usr/ucb \
;
psetenv LD_LIBRARY_PATH \
$LD_LIBRARY_PATH \
/usr/openwin/lib \
;
;;
(HP-UX) #########################
psetenv shell_init_path_post \
/usr/contrib/bin \
/opt/sudo/bin \
/opt/tusc/bin \
/usr/local/pa20_64/bin \
;
;;
(CYGWIN*) #######################
psetenv shell_init_path_post \
/usr/X11R6/bin \
;
psetenv LD_LIBRARY_PATH \
$LD_LIBRARY_PATH \
/usr/X11R6/lib \
;
psetenv PAGER "${PAGER}C"
psetenv MANPAGER "${MANPAGER}C"
;;
(Darwin) ########################
psetenv shell_init_path_pre \
/opt/local/libexec/gnubin \
;
# todo: this probably should be in the generic path, not
# Darwin-specific. possibly, nodejs stuff should be in a globally
# accessible path. but then there's xyz language and where those
# binaries are installed... maybe these links should all end up in
# ~/bin/, but that doesn't allow easy separation of local code and
# upstream code
#
# todo: this should not be here, maybe eg PYTHONPATH, etc
#
psetenv shell_init_path_post \
$HOME/node_modules/.bin \
$HOME/Library/Python/2.7/bin \
;
;;
esac
}
shell_init_path ()
{
psetenv PATH \
$HOME/bin \
$HOME/.local/bin \
$shell_init_path_pre \
$shell_init_path_generic \
$shell_init_path_post \
;
}
shell_init_vim ()
{
local base vim
# check for a .../share/vim/ in common locations it
# might be installed
#
for base in \
${HOME:?} \
/usr/local \
/opt/local \
/usr \
;
do
vim=$base/share/vim
test -d $vim &&
break
done
# if we found it, glob the version number dirs, find
# the latest by lex sort, and set up environment to use it
#
if (($? == 0)); then
set -- $vim/vim[[:digit:]]* || return
export VIM=${!#}
export VISUAL=vim
export EDITOR=$VISUAL
fi
}
shell_init_bc ()
{
esetenv BC_ENV_ARGS "-ql "
local bcbase="$HOME/.bc"
if test -d "$bcbase"
then esetenv BC_ENV_ARGS \
"$BC_ENV_ARGS " \
"$bcbase/rc.bc " \
"$bcbase/extensions.bc " \
; fi
}
source ~/.bash/initfuncs
# TODO: should we unset esetenv() and setenv() too?
unset -f psetenv