This repository was archived by the owner on Aug 12, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0001-stateless-configuration.patch
More file actions
389 lines (384 loc) · 14.4 KB
/
0001-stateless-configuration.patch
File metadata and controls
389 lines (384 loc) · 14.4 KB
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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Simental Magana, Marcos" <marcos.simental.magana@intel.com>
Date: Tue, 16 May 2017 14:46:31 -0500
Subject: [PATCH] stateless configuration
Aditionally, remove the auto run of zsh-newuser-install
if user has no ~/.zshrc file. we do decent defaults and
this should not run automatically for new users.
---
Scripts/newuser | 8 --
StartupFiles/zlogin | 16 +--
StartupFiles/zshenv | 67 ++++++++----
StartupFiles/zshrc | 251 +++++++++++++++++---------------------------
4 files changed, 148 insertions(+), 194 deletions(-)
delete mode 100644 Scripts/newuser
diff --git a/Scripts/newuser b/Scripts/newuser
deleted file mode 100644
index b5d7421..0000000
--- a/Scripts/newuser
+++ /dev/null
@@ -1,8 +0,0 @@
-# zsh script sourced at startup when a user is found to have
-# no startup files. See the documentation for the zsh/newuser
-# module in zshmodules(1).
-
-if functions zsh-newuser-install >/dev/null 2>&1 ||
- autoload -U +X zsh-newuser-install; then
- zsh-newuser-install
-fi
diff --git a/StartupFiles/zlogin b/StartupFiles/zlogin
index c1a85de..22c179e 100644
--- a/StartupFiles/zlogin
+++ b/StartupFiles/zlogin
@@ -8,16 +8,6 @@
# msgs, from, etc).
#
-# THIS FILE IS NOT INTENDED TO BE USED AS /etc/zlogin, NOR WITHOUT EDITING
-return 0 # Remove this line after editing this file as appropriate
-
-clear
-stty dec new cr0 -tabs
-ttyctl -f # freeze the terminal modes... can't change without a ttyctl -u
-mesg y
-uptime
-fortune
-log
-from 2>/dev/null
-cat notes
-msgs -fp
+if [ -f /etc/zlogin ]; then
+ source /etc/zlogin
+fi
diff --git a/StartupFiles/zshenv b/StartupFiles/zshenv
index 23363a4..aa7d8a0 100644
--- a/StartupFiles/zshenv
+++ b/StartupFiles/zshenv
@@ -10,22 +10,53 @@
# commands that produce output or assume the shell is attached to a tty.
#
-# THIS FILE IS NOT INTENDED TO BE USED AS /etc/zshenv, NOR WITHOUT EDITING
-return 0 # Remove this line after editing this file as appropriate
-
-# This kludge can be used to override some installations that put aliases for
-# rm, mv, etc. into the system profiles. Just be sure to put "unalias alias"
-# in your own rc file(s) if you use this.
-alias alias=:
-
-# Some people insist on setting their PATH here to affect things like ssh.
-# Those that do should probably use $SHLVL to ensure that this only happens
-# the first time the shell is started (to avoid overriding a customized
-# environment). Also, the various profile/rc/login files all get sourced
-# *after* this file, so they will override this value. One solution is to
-# put your path-setting code into a file named .zpath, and source it from
-# both here (if we're not a login shell) and from the .zprofile file (which
-# is only sourced if we are a login shell).
-if [[ $SHLVL == 1 && ! -o LOGIN ]]; then
- source ~/.zpath
+if [ -f /etc/zshenv ]; then
+ source /etc/zshenv
+else
+ PATH="/usr/local/bin:/usr/bin:/opt/3rd-party/bin"
+
+ if [[ -x "/bin/vi" ]]; then
+ EDITOR="/usr/bin/vi"
+ else
+ EDITOR="/usr/bin/nano" # we have nano by default
+ fi
+ test -z "$TERM" && TERM="xterm" # Basic terminal capab. For screen etc.
+
+ if [ ! -e /etc/localtime ]; then
+ TZ="UTC" # Time Zone. Look at http://theory.uwinnipeg.ca/gnu/glibc/libc_303.html
+ # for an explanation of how to set this to your local timezone.
+ export TZ
+ fi
+
+ # Set some flags
+ CFLAGS="-g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -Wl,--copy-dt-needed-entries -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -malign-data=abi -fno-semantic-interposition -ftree-vectorize -ftree-loop-vectorize "
+ FFLAGS="-g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wl,--copy-dt-needed-entries -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -malign-data=abi -fno-semantic-interposition -ftree-vectorize -ftree-loop-vectorize "
+ CFFLAGS="-g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wl,--copy-dt-needed-entries -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -malign-data=abi -fno-semantic-interposition -ftree-vectorize -ftree-loop-vectorize "
+ CXXFLAGS="$CFLAGS -fvisibility-inlines-hidden "
+
+ export GOMP_SPINCOUNT=1000
+ export AR=gcc-ar
+ export CXX=g++
+ export RANLIB=gcc-ranlib
+ export LA_VERSION="OpenBLAS"
+ export LA_LIBS=/usr/lib64/libopenblas.so.0
+ export LA_INCLUDE=/usr/include
+ export LA_PATH=/usr/lib64/
+ export MPI_CC=/usr/bin/mpicc
+ export MPI_LIBS=/usr/lib64/libmpich.so
+ export MPI_INCLUDE=/usr/include/
+ export MPI_PATH=/usr/lib64/
+ export MPI_VERSION=3.2
+ export THEANO_FLAGS='floatX=float32,openmp=true,gcc.cxxflags="-ftree-vectorize -mavx"'
+ export CC=gcc
+
+ for langfile in /usr/share/defaults/etc/locale.conf /etc/locale.conf "$HOME/.i18n" ; do
+ [ -f $langfile ] && . $langfile
+ done
+
+ export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
+
+ XDG_CONFIG_DIRS=/usr/share/xdg:/etc/xdg
+
+ export PATH EDITOR TERM CFLAGS CXXFLAGS CFFLAGS FFLAGS XDG_CONFIG_DIRS
fi
diff --git a/StartupFiles/zshrc b/StartupFiles/zshrc
index d4e1d03..41dd548 100644
--- a/StartupFiles/zshrc
+++ b/StartupFiles/zshrc
@@ -6,158 +6,99 @@
# options, key bindings, etc.
#
-# THIS FILE IS NOT INTENDED TO BE USED AS /etc/zshrc, NOR WITHOUT EDITING
-return 0 # Remove this line after editing this file as appropriate
-
-# Search path for the cd command
-cdpath=(.. ~ ~/src ~/zsh)
-
-# Use hard limits, except for a smaller stack and no core dumps
-unlimit
-limit stack 8192
-limit core 0
-limit -s
-
-umask 022
-
-# Set up aliases
-alias mv='nocorrect mv' # no spelling correction on mv
-alias cp='nocorrect cp' # no spelling correction on cp
-alias mkdir='nocorrect mkdir' # no spelling correction on mkdir
-alias j=jobs
-alias pu=pushd
-alias po=popd
-alias d='dirs -v'
-alias h=history
-alias grep=egrep
-alias ll='ls -l'
-alias la='ls -a'
-
-# List only directories and symbolic
-# links that point to directories
-alias lsd='ls -ld *(-/DN)'
-
-# List only file beginning with "."
-alias lsa='ls -ld .*'
-
-# Shell functions
-setenv() { typeset -x "${1}${1:+=}${(@)argv[2,$#]}" } # csh compatibility
-freload() { while (( $# )); do; unfunction $1; autoload -U $1; shift; done }
-
-# Where to look for autoloaded function definitions
-fpath=($fpath ~/.zfunc)
-
-# Autoload all shell functions from all directories in $fpath (following
-# symlinks) that have the executable bit on (the executable bit is not
-# necessary, but gives you an easy way to stop the autoloading of a
-# particular shell function). $fpath should not be empty for this to work.
-for func in $^fpath/*(N-.x:t); autoload $func
-
-# automatically remove duplicates from these arrays
-typeset -U path cdpath fpath manpath
-
-# Global aliases -- These do not have to be
-# at the beginning of the command line.
-alias -g M='|more'
-alias -g H='|head'
-alias -g T='|tail'
-
-manpath=($X11HOME/man /usr/man /usr/lang/man /usr/local/man)
-export MANPATH
-
-# Hosts to use for completion (see later zstyle)
-hosts=(`hostname` ftp.math.gatech.edu prep.ai.mit.edu wuarchive.wustl.edu)
-
-# Set prompts
-PROMPT='%m%# ' # default prompt
-RPROMPT=' %~' # prompt for right side of screen
-
-# Some environment variables
-export MAIL=/var/spool/mail/$USERNAME
-export LESS=-cex3M
-export HELPDIR=/usr/share/zsh/$ZSH_VERSION/help # directory for run-help function to find docs
-unalias run-help && autoload -Uz run-help
-
-MAILCHECK=300
-HISTSIZE=200
-DIRSTACKSIZE=20
-
-# Watch for my friends
-#watch=( $(<~/.friends) ) # watch for people in .friends file
-watch=(notme) # watch for everybody but me
-LOGCHECK=300 # check every 5 min for login/logout activity
-WATCHFMT='%n %a %l from %m at %t.'
-
-# Set/unset shell options
-setopt notify globdots correct pushdtohome cdablevars autolist
-setopt correctall autocd recexact longlistjobs
-setopt autoresume histignoredups pushdsilent noclobber
-setopt autopushd pushdminus extendedglob rcquotes mailwarning
-unsetopt bgnice autoparamslash
-
-# Autoload zsh modules when they are referenced
-zmodload -a zsh/zpty zpty
-zmodload -a zsh/zprof zprof
-zmodload -ap zsh/mapfile mapfile
-# stat(1) is now commonly an external command, so just load zstat
-zmodload -aF zsh/stat b:zstat
-
-# Some nice key bindings
-#bindkey '^X^Z' universal-argument ' ' magic-space
-#bindkey '^X^A' vi-find-prev-char-skip
-#bindkey '^Xa' _expand_alias
-#bindkey '^Z' accept-and-hold
-#bindkey -s '\M-/' \\\\
-#bindkey -s '\M-=' \|
-
-# bindkey -v # vi key bindings
-
-bindkey -e # emacs key bindings
-bindkey ' ' magic-space # also do history expansion on space
-bindkey '^I' complete-word # complete on tab, leave expansion to _expand
-
-# Setup new style completion system. To see examples of the old style (compctl
-# based) programmable completion, check Misc/compctl-examples in the zsh
-# distribution.
-autoload -Uz compinit
-compinit
-
-# Completion Styles
-
-# list of completers to use
-zstyle ':completion:*::::' completer _expand _complete _ignored _approximate
-
-# allow one error for every three characters typed in approximate completer
-zstyle -e ':completion:*:approximate:*' max-errors \
- 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )'
-
-# insert all expansions for expand completer
-zstyle ':completion:*:expand:*' tag-order all-expansions
-
-# formatting and messages
-zstyle ':completion:*' verbose yes
-zstyle ':completion:*:descriptions' format '%B%d%b'
-zstyle ':completion:*:messages' format '%d'
-zstyle ':completion:*:warnings' format 'No matches for: %d'
-zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
-zstyle ':completion:*' group-name ''
-
-# match uppercase from lowercase
-zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
-
-# offer indexes before parameters in subscripts
-zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
-
-# command for process lists, the local web server details and host completion
-#zstyle ':completion:*:processes' command 'ps -o pid,s,nice,stime,args'
-#zstyle ':completion:*:urls' local 'www' '/var/www/htdocs' 'public_html'
-zstyle '*' hosts $hosts
-
-# Filename suffixes to ignore during completion (except after rm command)
-zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' \
- '*?.old' '*?.pro'
-# the same for old style completion
-#fignore=(.o .c~ .old .pro)
-
-# ignore completion functions (until the _ignored completer)
-zstyle ':completion:*:functions' ignored-patterns '_*'
+if [ -f /etc/zshrc ]; then
+ source /etc/zshrc
+else
+ # Set up aliases
+ alias mv='nocorrect mv' # no spelling correction on mv
+ alias cp='nocorrect cp' # no spelling correction on cp
+ alias mkdir='nocorrect mkdir' # no spelling correction on mkdir
+ alias ls='ls --color=auto' # default ls with colors
+
+ # Set prompt
+ # endchar color (red if return status != 0)
+ root_endch="%(?.#.%F{red}#%f)"
+ other_endch="%(?.%%.%F{red}%%%f)"
+
+ # conditional %(cond.true.false)
+ endchar="%(#.${root_endch}.${other_endch})"
+
+ # use red for root and blue(39) for non-root users
+ username="%F{%(#.red.39)}%n%f"
+
+ # host in orange
+ host="%F{208}%m%f"
+
+ # current directory in blue(39)
+ dir="%F{39}%~%f"
+
+ PROMPT="${username}@${host} ${dir} ${endchar} "
+
+ # Set/unset shell options
+ setopt menucomplete; autoload compinit; compinit;
+
+ # bindkey -v # vi key bindings
+ bindkey -e # emacs key bindings
+ bindkey ' ' magic-space # also do history expansion on space
+
+ # Enable past command match search with up/down arrows
+ autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
+ zle -N up-line-or-beginning-search
+ zle -N down-line-or-beginning-search
+ [[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search
+ [[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search
+
+ # Enable Ctrl-R history search
+ bindkey '^R' history-incremental-search-backward
+
+ # Enable home/end keys
+ # http://www.zshwiki.org/home/zle/bindkeys#reading_terminfo
+ # create a zkbd compatible hash;
+ # to add other keys to this hash, see: man 5 terminfo
+ typeset -A key
+
+ key[Home]="$terminfo[khome]"
+ key[End]="$terminfo[kend]"
+ key[Insert]="$terminfo[kich1]"
+ key[Backspace]="$terminfo[kbs]"
+ key[Delete]="$terminfo[kdch1]"
+ key[Up]="$terminfo[kcuu1]"
+ key[Down]="$terminfo[kcud1]"
+ key[Left]="$terminfo[kcub1]"
+ key[Right]="$terminfo[kcuf1]"
+ key[PageUp]="$terminfo[kpp]"
+ key[PageDown]="$terminfo[knp]"
+
+ # setup key accordingly
+ [[ -n "$key[Home]" ]] && bindkey -- "$key[Home]" beginning-of-line
+ [[ -n "$key[End]" ]] && bindkey -- "$key[End]" end-of-line
+ [[ -n "$key[Insert]" ]] && bindkey -- "$key[Insert]" overwrite-mode
+ [[ -n "$key[Backspace]" ]] && bindkey -- "$key[Backspace]" backward-delete-char
+ [[ -n "$key[Delete]" ]] && bindkey -- "$key[Delete]" delete-char
+ [[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-history
+ [[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-history
+ [[ -n "$key[Left]" ]] && bindkey -- "$key[Left]" backward-char
+ [[ -n "$key[Right]" ]] && bindkey -- "$key[Right]" forward-char
+
+ # Finally, make sure the terminal is in application mode, when zle is
+ # active. Only then are the values from $terminfo valid.
+ if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
+ function zle-line-init () {
+ echoti smkx
+ }
+ function zle-line-finish () {
+ echoti rmkx
+ }
+ zle -N zle-line-init
+ zle -N zle-line-finish
+ fi
+
+ # Enable command comments on interactive mode (e.g: % #echo foo)
+ setopt interactivecomments
+
+ # Don't show '%' for EOL missing '\n'
+ PROMPT_EOL_MARK=""
+
+
+ umask 022
+fi