-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautocfg.sh
More file actions
executable file
·215 lines (184 loc) · 5.94 KB
/
autocfg.sh
File metadata and controls
executable file
·215 lines (184 loc) · 5.94 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
#!/bin/bash
echo "###################################################################"
echo "# This script configures dotfiles for Linux #"
echo "# Configures: ZSH, Tmux, Neovim, Git, WezTerm, Yazi, GDB, Ghostty #"
echo "###################################################################"
echo ""
echo "More info available at https://github.com/mdmfernandes/dotfiles"
echo ""
read -n 1 -s -r -p "Press any key to continue..."
echo ""
echo ""
# Read input flags
while test $# -gt 0; do
case "$1" in
-r | --remote)
remote=true
shift
;;
*)
break
;;
esac
done
# Config
apps=true
tmux=true
zsh=true
neovim=true
ghostty=true
wezterm=false
yazi=true
gdb=true
lang=false
# Helpers
exists() { # Check if a command exists
command -v "$1" >/dev/null 2>&1
}
# Update DB
sudo apt-get update
# Applications
if [[ "$apps" = true ]]; then
echo "[+] Installing applications [git, jq, colordiff, xclip, fzf, ripgrep, bat, tree, fd, pip3, zoxide]..."
sudo apt-get install --yes --quiet --no-install-recommends git jq colordiff xclip fzf ripgrep tree fd-find python3-pip curl
sudo apt-get install --yes --quiet --no-install-recommends bat
# Configure git
git config --global branch.autoSetupRebase always
git config --global core.pager "less -F -X"
fi
# TMUX
if [[ "$tmux" = true ]]; then
echo ""
echo "[+] Configuring TMUX..."
if ! exists tmux; then
echo " [+] Installing TMUX..."
sudo apt-get install --yes --quiet --no-install-recommends tmux
fi
echo " [+] Copying TMUX configuration files..."
cp "./tmux/tmux.conf" "$HOME/.tmux.conf"
if [[ "$remote" = true ]]; then
cp "./tmux/tmux.conf.remote" "$HOME/.tmux.conf.local"
fi
echo " [+] Installing tpm..."
git clone https://github.com/tmux-plugins/tpm "$HOME/.tmux/plugins/tpm"
tmux source "$HOME/.tmux.conf"
"$HOME/.tmux/plugins/tpm/bindings/install_plugins"
fi
# ZSH
if [[ "$zsh" = true ]]; then
echo ""
echo "[+] Configuring ZSH..."
if ! exists zsh; then
echo " [+] Installing ZSH..."
sudo apt-get install --yes --quiet --no-install-recommends zsh
chsh -s "$(which zsh)"
fi
echo " [+] Copying ZSH configuration files..."
mkdir -p "$HOME/.config/zsh"
mkdir -p "$HOME/.local/share/zsh/plugins"
mkdir -p "$HOME/.local/share/zsh/completions"
mkdir -p "$HOME/.local/share/zsh/themes"
# shellcheck source=/dev/null
echo "ZDOTDIR=$HOME/.config/zsh" >"$HOME/.zshenv" && . "$HOME/.zshenv"
cp "./zsh/zshrc" "$ZDOTDIR/.zshrc"
cp "./zsh/aliases.zsh" "$ZDOTDIR/aliases.zsh"
cp "./zsh/functions.zsh" "$ZDOTDIR/functions.zsh"
cp "./zsh/custom.zsh" "$ZDOTDIR/custom.zsh"
cp "./zsh/p10k.zsh" "$ZDOTDIR/p10k.zsh"
# shellcheck source=/dev/null
source "$ZDOTDIR/.zshrc" 2>/dev/null
echo " [+] Installing custom plugins..."
ZSH_SHARE="$HOME/.local/share/zsh"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_SHARE}/themes/powerlevel10k"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "${ZSH_SHARE}/plugins/zsh-syntax-highlighting"
git clone https://github.com/zsh-users/zsh-autosuggestions "${ZSH_SHARE}/plugins/zsh-autosuggestions"
git clone https://github.com/zsh-users/zsh-completions.git "${ZSH_SHARE}/plugins/zsh-completions"
git clone https://github.com/zsh-users/zsh-history-substring-search.git "${ZSH_SHARE}/plugins/zsh-history-substring-search"
curl -sS https://webinstall.dev/zoxide | bash
fi
# NeoVim
if [[ "$neovim" = true ]]; then
echo ""
echo "[+] Configuring Neovim..."
if ! exists nvim; then
echo " [+] Installing NeoVim..."
sudo apt-get install --yes --quiet --no-install-recommends neovim
fi
echo " [+] Copying neovim configuration files..."
cp -r ./nvim "$HOME/.config"
fi
# WezTerm
if [[ "$wezterm" = true ]]; then
echo ""
echo "[+] Configuring WezTerm..."
if ! exists wezterm; then
echo " [!] WezTerm not found. Please install from https://wezfurlong.org/wezterm"
else
echo " [+] Copying WezTerm configuration files..."
mkdir -p "$HOME/.config/wezterm"
cp "./wezterm/wezterm.lua" "$HOME/.config/wezterm/"
cp "./wezterm/wezterm_local.lua" "$HOME/.config/wezterm/"
fi
fi
# Yazi
if [[ "$yazi" = true ]]; then
echo ""
echo "[+] Configuring Yazi..."
if ! exists yazi; then
echo " [!] Yazi not found. Please install from https://yazi-rs.github.io/"
echo " [!] Or with cargo: cargo install yazi-build"
else
echo " [+] Copying Yazi configuration files..."
mkdir -p "$HOME/.config/yazi"
cp -r "./yazi" "$HOME/.config/yazi"
fi
fi
# Ghostty
if [[ "$ghostty" = true ]]; then
echo ""
echo "[+] Configuring Ghostty..."
if ! exists ghostty; then
echo " [!] Ghostty not found. Please install from https://github.com/ghostty-org/ghostty"
else
echo " [+] Copying Ghostty configuration files..."
mkdir -p "$HOME/.config/ghostty"
cp "./ghostty/config" "$HOME/.config/ghostty/"
fi
fi
# GDB
if [[ "$gdb" = true ]]; then
echo ""
echo "[+] Configuring GDB..."
if ! exists gdb; then
echo " [+] Installing GDB..."
sudo apt-get install gdb --yes --quiet
fi
echo " [+] Copying GDB configuration files..."
mkdir -p "$HOME/.config/gdb"
mkdir "$HOME/.local/src"
cp "./gdb/gdbinit" "$HOME/.gdbinit"
cp "./gdb/pwndbgtmux.py" "$HOME/.local/src/pwndbgtmux.py"
# Check for pwndbg
if [[ ! -d "$HOME/src/pwndbg" ]]; then
echo ""
echo " [!] pwndbg not found!"
echo " [!] Install pwndbg for enhanced GDB debugging:"
echo " [!] git clone https://github.com/pwndbg/pwndbg.git ~/.local/src/pwndbg"
echo " [!] cd ~/.local/src/pwndbg && ./setup.sh"
fi
fi
# Language tools
if [[ "$lang" = true ]]; then
echo ""
echo "[+] Configuring linters, formatters, and type checkers..."
pip3 install pylint flake8 black mypy markdownlint-cli
echo " [+] Copying language configuration files..."
cp -r ./lang/python/ "$HOME/.config"
cp ./lang/lua/stylua.toml "$HOME/.config"
cp ./lang/markdown/markdownlint.yaml "$HOME/.config"
cp ./lang/yaml/yamllint.yaml "$HOME/.config"
cp ./lang/.editorconfig "$HOME/.config/"
fi
echo ""
echo "[+] Configuration complete!"
echo "[+] Please restart your shell to apply changes"