-
Notifications
You must be signed in to change notification settings - Fork 50
/
customization-text.yaml
241 lines (200 loc) · 6.94 KB
/
customization-text.yaml
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
- name: Core OS customization (terminal)
hosts: 127.0.0.1
connection: local
tasks:
- name: Remove old common bash aliases
blockinfile:
path: ~/.bashrc
marker: "### {mark} Ansible managed: Bash aliases (common)"
state: absent
- name: Remove old Linux bash aliases
blockinfile:
path: ~/.bashrc
marker: "### {mark} Ansible managed: Bash aliases (Linux)"
state: absent
- name: Add bash aliases
blockinfile:
path: ~/.bashrc
marker: "### {mark} Ansible managed: Bash aliases"
block: |
alias diff='colordiff'
alias dir='ls -lA'
alias ll='ls -l'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias clip='xclip -selection clipboard'
alias grep='grep --color=auto'
alias ls='ls -Fh --color'
alias gpg-stop='gpgconf --kill gpg-agent'
alias wsl='wsl.exe'
export LS_COLORS='ow=93'
- name: Install APT packages
become: yes
apt:
package: "{{ item }}"
loop:
- colordiff
- fortune
- neofetch
- name: Ensure neofetch configuration folder exists
file:
path: ~/.config/neofetch
state: directory
- name: Override neofetch configuration
copy:
dest: ~/.config/neofetch/config
mode: 0755
content: |
print_info() {
info title
prin ""
info "OS" distro
info "Kernel" kernel
info "Uptime" uptime
info "IP" local_ip
prin ""
info "Host" model
info "CPU" cpu
info "Memory" memory
info "GPU" gpu
info "Screens" resolution
info "Disk" disk
info "Battery" battery
}
cpu_temp="C"
refresh_rate="on"
block_range=(0 15)
cpu_display="infobar"
memory_display="infobar"
battery_display="infobar"
disk_display="infobar"
thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch"
- name: Add neofetch & fortune to ~/.bashrc
blockinfile:
path: ~/.bashrc
marker: "### {mark} Ansible managed: login banner"
block: |
echo ""
neofetch
fortune
- name: Disable sudo password requirement
become: yes
lineinfile:
path: /etc/sudoers
line: "{{ lookup('env', 'USER') }} ALL=(ALL) NOPASSWD: ALL"
- name: Enhance terminal prompt
blockinfile:
path: ~/.bashrc
marker: "### {mark} Ansible managed: prompt enhancement"
block: |
if [ -z "$WSL_DISTRO_NAME" ]; then
# Write current path in the terminal title bar
function writeCwdInTitlebar() {
case "$TERM" in
xterm*|rxvt*)
echo -ne "\033]0;`whoami`@`hostname`: `dirs +0`\007\c"
;;
*)
;;
esac
}
else
# Write current path in the terminal title bar
function writeCwdInTitlebar() {
case "$TERM" in
xterm*|rxvt*)
echo -ne "\033]0;[WSL] $WSL_DISTRO_NAME: `dirs +0`\007\c"
;;
*)
;;
esac
}
# Set up support for X server in WSL if we don't have the built-in Wayland support
if [ -z "${WAYLAND_DISPLAY}" ]; then
export WSL_HOST_IP="$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}')"
export DISPLAY="${WSL_HOST_IP}:0.0"
fi
fi
# Force newline when things don't end cleanly
clear_newline() {
if [ "$(__get_terminal_column)" != 0 ]; then
echo -e '\033[7m%\033[0m'
fi
}
__get_terminal_column() {
exec < /dev/tty
local oldstty=$(stty -g)
stty raw -echo min 0
echo -en "\033[6n" > /dev/tty
local pos
IFS=';' read -r -d R -a pos
stty $oldstty
echo "$((${pos[1]} - 1))"
}
PROMPT_COMMAND="clear_newline;writeCwdInTitlebar;"
# Environment customization
export ANSIBLE_NOCOWS=1
export CLICOLOR=1
export GREP_COLORS='1;35;40'
export LSCOLORS=GxFxCxDxBxegedabagaced
# Create a bunch of symlinks to known things in Google Drive
if [ -d ~/gdrive ]; then
# TODO: How many of these things can/should be raw automated instead of
# being pulled from Google Drive?
if [ ! -e ~/.config/git/config ]; then
mkdir -p ~/.config/git
chmod 700 ~/.config
ln -s $HOME/gdrive/DevBinaries/.config/git/config ~/.config/git
fi
if [ ! -e ~/.docker/config.json ]; then
mkdir -p ~/.docker
chmod 700 ~/.docker
ln -s $HOME/gdrive/DevBinaries/.docker/config.json ~/.docker
fi
if [ ! -e ~/.git-credentials ]; then
ln -s $HOME/gdrive/DevBinaries/DotFiles/.git-credentials ~/
fi
if [ ! -d ~/.gnupg ]; then
mkdir -p ~/.gnupg
chmod 700 ~/.gnupg
fi
ln -fs $HOME/gdrive/DevBinaries/DotFiles/.gnupg/* ~/.gnupg/
if [ ! -d ~/.kube ]; then
mkdir ~/.kube
fi
if [ ! -e ~/.kube/config ]; then
ln -s $HOME/gdrive/DevBinaries/DotFiles/.kube/config ~/.kube/
fi
if [ ! -d ~/.kube/ports ]; then
ln -s $HOME/gdrive/DevBinaries/DotFiles/.kube/ports ~/.kube/
fi
if [ ! -e ~/.npmrc ]; then
ln -s $HOME/gdrive/DevBinaries/DotFiles/.npmrc ~/
fi
if [ ! -e ~/.nuget/NuGet/NuGet.Config ]; then
mkdir -p ~/.nuget/NuGet
ln -s $HOME/gdrive/DevBinaries/DotFiles/NuGet.Config ~/.nuget/NuGet/
fi
if [ -d ~/gdrive/DevBinaries/.ssh ]; then
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ln -fs $HOME/gdrive/DevBinaries/.ssh/* ~/.ssh/
chmod 700 ~/.ssh/* 2>/dev/null
if [ ! -e ~/.ssh/authorized_keys ]; then
ln -s $HOME/gdrive/DevBinaries/.ssh/id_rsa.pub ~/.ssh/authorized_keys
fi
fi
if [ -d ~/gdrive/DevBinaries ]; then
export PATH=~/gdrive/DevBinaries:$PATH
fi
fi
# Start in the ~/dev folder when it exists (and we're in an interactive shell)
if [ -d ~/dev ]; then
case "$-" in
*i*) cd ~/dev ;;
*) ;;
esac
fi