Repository navigation
Expand file tree
/
Copy pathmy_setup.sh
More file actions
executable file
·227 lines (171 loc) · 4.91 KB
/
Copy pathmy_setup.sh
File metadata and controls
executable file
·227 lines (171 loc) · 4.91 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
#! /bin/bash
function install_debian() {
# Installation prereqs
apt-get install apt-transport-https ca-certificates debhelper debsums curl wget gnupg2 software-properties-common
# Basic dev stuff
apt-get install --assume-yes \
fish \
zsh \
htop \
dstat \
atop \
git \
vim \
locate \
linux-perf \
gcc \
python3-setuptools \
python3-pip \
# Terminal utils
apt-get install --assume-yes \
command-not-found \
python3-pygments \
tmux \
tig \
zsh-syntax-highlighting \
# VM tools
apt-get install --assume-yes open-vm-tools
# UI
apt-get install --assume-yes \
fonts-open-sans \
ttf-mscorefonts-installer
# Docker install
apt-get remove --purge docker docker-engine docker.io containerd runc
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
apt-get install --assume-yes docker-ce
}
#install_debian
function install_rc() {
MY_DIR=xirafa
mkdir -p ~/.$MY_DIR
rm -f ~/.$MY_DIR/*
cat > ~/.$MY_DIR/commonrc << EOFFF
# aliases
alias grep='grep --color=auto'
alias g='grep -ina --color=auto'
alias gv='grep -vi'
alias rm='rm --one-file-system'
alias ll='ls -lAF --color=auto'
alias l='ls -lAF --color=auto'
alias ltr='ls -ltrFa --color=auto'
alias ls='ls -F'
alias rm='rm --one-file-system'
alias '..'='cd ..'
alias vi=vim
alias tf='tail -f'
alias gdb='gdb -silent'
export EDITOR=vim
EOFFF
cat > ~/.$MY_DIR/shrc << EOFFF
alias -- -='less -niSR'
alias j='jobs -l'
function p() { ps -ef | grep -i \$@ | grep -v grep ; }
# prettier output for 'mount'
function _mount
{
if [ -z "\$1" ]; then
command mount | column -t
else
command mount "\$@"
fi
}
alias mount='_mount'
export EDITOR=vim
EOFFF
cat > ~/.$MY_DIR/bashrc << EOFFF
stty -ixon
shopt -s autocd # cd to dirname when just dirname is given as command
shopt -s checkjobs # Notify existing jobs before exit
#shopt -s failglob
shopt -s histappend # Append to bash history file
#eval "\$(SHELL=/bin/sh lesspipe)"
alias which='type --all'
set -o ignoreeof # ^D doesnt exit
set -o notify # Don't wait for next prompt to print job exit status
set mark-symlinked-directories on
set completion-ignore-case on
if [ -n "\$PS1" ]; then
PS1='\[\033[42;37;1m\]\u@\H\[\033[0m\] \[\033[44;37;1m\]\w\[\033[0m\] \\\$ '
fi
source ~/.$MY_DIR/commonrc
source ~/.$MY_DIR/shrc
EOFFF
# Write zshrc
cat > ~/.$MY_DIR/zshrc << EOFFF
source ~/.$MY_DIR/commonrc
source ~/.$MY_DIR/shrc
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
alias which='whence -ca'
setopt ignoreeof
if [ -n "\$PS1" ]; then
PS1='%(?..%B%F{white}%K{red}$?%f%k )%B%F{white}%K{green}%n@%m%f%k%b %B%F{white}%K{blue}%~%f%k%b%# '
fi
# For some reason, /etc/zsh_command_not_found uses "--no-failure-msg". Do this instead.
function command_not_found_handler {
/usr/lib/command-not-found -- \${1+"\$1"}
}
EOFFF
# Write fishrc
cat > ~/.$MY_DIR/fishrc << EOFFF
source ~/.$MY_DIR/commonrc
alias which='type -a'
alias j='jobs'
function p
ps -ef | grep -i \$argv[1]
end
function mount
if test (count \$argv) -gt 0
command mount \$argv
else
command mount | column -t
end
end
function fish_prompt --description 'Write out the prompt'
set -l color_cwd
set -l suffix
switch "\$USER"
case root toor
set color_cwd yellow
set suffix '#'
case '*'
set color_cwd blue
set suffix '>'
end
set -l last_status \$status
set -l prompt_status ""
if test \$last_status != 0
set prompt_status (set_color -b red) (set_color -o white) \$last_status (set_color normal) ' '
end
echo -n -s \$prompt_status (set_color -o white) (set_color -b green) "\$USER" @ (prompt_hostname) (set_color normal) ' ' (set_color -o white) (set_color -b \$color_cwd) (prompt_pwd) (set_color normal) "\$suffix "
end
EOFFF
# Fish setup
if [ ! -s /usr/local/bin/- ]; then
ln -s $(which less) /usr/local/bin/-
fi
touch ~/.config/fish/config.fish
grep -q $MY_DIR/fishrc ~/.config/fish/config.fish || echo "source ~/.$MY_DIR/fishrc" >> ~/.config/fish/config.fish
curl -Lo ~/.config/fish/functions/humanize_duration.fish --create-dirs https://raw.githubusercontent.com/fishpkg/fish-humanize-duration/master/humanize_duration.fish
curl -Lo ~/.config/fish/conf.d/done.fish --create-dirs https://raw.githubusercontent.com/franciscolourenco/done/master/conf.d/done.fish
# zshrc setup
set +x
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
set -x
touch ~/.zshrc
grep -q $MY_DIR/zshrc ~/.zshrc || echo "source ~/.$MY_DIR/zshrc" >> ~/.zshrc
sed -i 's/^plugins=.*/plugins=(git colored-man-pages colorize docker systemd)/' ~/.zshrc
# bash setup
touch ~/.bashrc
grep -q $MY_DIR/bashrc ~/.bashrc || echo "source ~/.$MY_DIR/bashrc" >> ~/.bashrc
}
# Run stuff
set -x
#install_debian
install_rc
# File indexing
# updatedb
set +x
echo ""
echo "=TODOs="
echo "Install gnome extension: https://extensions.gnome.org/extension/1160/dash-to-panel/"
echo "sudo visudo, then paste: $USER ALL=(ALL) NOPASSWD:ALL"