-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.py
More file actions
executable file
·355 lines (298 loc) · 12.5 KB
/
install.py
File metadata and controls
executable file
·355 lines (298 loc) · 12.5 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
import os
import argparse
def detect_distro():
"""Detect the Linux distribution"""
try:
with open('/etc/os-release', 'r') as f:
for line in f:
if line.startswith('ID='):
distro = line.strip().split('=')[1].strip('"')
return distro
except FileNotFoundError:
pass
return 'unknown'
distro = detect_distro()
print(f"Detected distribution: {distro}")
parser = argparse.ArgumentParser(description="Installation parameters")
parser.add_argument(
"--UI",
type=str,
required=True,
help="Should the installation procedure include GUI applications? (GUI || headless)",
)
parser.add_argument(
"--other_tools",
type=str,
required=False,
help="By default only development tools are installed, should other non dev programs (like Discord) be also installed? (yes || no)",
)
args = parser.parse_args()
print(args)
# With GUI
list_of_programs_with_gui_apt = [
"sudo apt-get install tilix -y",
]
list_of_programs_with_gui_snap = [
"sudo snap install code --classic",
"sudo snap install alacritty --classic",
]
# Gentoo GUI packages
list_of_programs_with_gui_gentoo = [
"sudo emerge --ask=n x11-terms/tilix",
"sudo emerge --ask=n app-editors/vscode",
"sudo emerge --ask=n x11-terms/alacritty",
]
# Fedora GUI packages
list_of_programs_with_gui_fedora = [
"sudo dnf install -y tilix",
"sudo dnf install -y alacritty",
]
# Without GUI
list_of_programs_without_gui_apt = [
"sudo apt-get install neovim -y",
"sudo apt-get install ranger -y",
"sudo apt-get install neofetch -y",
"sudo apt-get install tmux -y",
"sudo apt-get install gcc g++ -y",
"sudo apt-get install clang clangd -y",
"sudo apt-get install cmake -y",
"sudo apt-get install gdb -y",
"sudo apt-get install pipx -y",
# System administration tools
"sudo apt-get install htop btop iotop -y",
"sudo apt-get install ncdu tree -y",
"sudo apt-get install lsof strace -y",
"sudo apt-get install rsync unzip zip -y",
# Network tools
"sudo apt-get install curl wget -y",
"sudo apt-get install jq gnupg -y", # Required for tofuenv
"sudo apt-get install nmap netcat-openbsd -y",
"sudo apt-get install dnsutils iputils-ping -y",
"sudo apt-get install traceroute mtr-tiny -y",
"sudo apt-get install tcpdump wireshark-common -y",
# Disk and filesystem tools
"sudo apt-get install smartmontools -y",
"sudo apt-get install parted gparted -y",
"sudo apt-get install hdparm -y",
]
# Gentoo headless packages
list_of_programs_without_gui_gentoo = [
"sudo emerge --ask=n app-editors/neovim app-misc/ranger app-misc/neofetch app-misc/tmux",
"sudo emerge --ask=n sys-devel/gcc sys-devel/clang sys-devel/clang-runtime dev-util/cmake sys-devel/gdb dev-python/pipx",
# System administration tools
"sudo emerge --ask=n sys-process/htop sys-process/btop sys-process/iotop sys-fs/ncdu app-text/tree",
"sudo emerge --ask=n sys-process/lsof dev-util/strace",
"sudo emerge --ask=n net-misc/rsync app-arch/unzip app-arch/zip",
# Network tools
"sudo emerge --ask=n net-misc/curl net-misc/wget app-misc/jq app-crypt/gnupg net-analyzer/nmap",
"sudo emerge --ask=n net-analyzer/netcat net-dns/bind-tools net-misc/iputils",
"sudo emerge --ask=n net-analyzer/traceroute net-analyzer/mtr net-analyzer/tcpdump net-analyzer/wireshark",
# Disk and filesystem tools
"sudo emerge --ask=n sys-apps/smartmontools sys-block/parted sys-block/gparted sys-apps/hdparm",
]
# Fedora headless packages
list_of_programs_without_gui_fedora = [
"sudo dnf install -y neovim ranger neofetch tmux",
"sudo dnf install -y gcc gcc-c++",
"sudo dnf install -y clang clang-tools-extra",
"sudo dnf install -y cmake gdb pipx",
# System administration tools
"sudo dnf install -y htop btop iotop",
"sudo dnf install -y ncdu tree",
"sudo dnf install -y lsof strace",
"sudo dnf install -y rsync unzip zip",
# Network tools
"sudo dnf install -y curl wget",
"sudo dnf install -y jq gnupg2",
"sudo dnf install -y nmap nmap-ncat",
"sudo dnf install -y bind-utils iputils",
"sudo dnf install -y traceroute mtr",
"sudo dnf install -y tcpdump wireshark-cli",
# Disk and filesystem tools
"sudo dnf install -y smartmontools parted gparted hdparm",
]
list_of_programs_without_gui_cargo = [
"cargo install eza",
"cargo install bat",
"cargo install hx",
"cargo install tokei",
"cargo install du-dust",
"cargo install rm-improved",
"cargo install bottom",
"cargo install mcfly",
]
# Ensure we have git and basic build tools (in case running from fresh Ubuntu or Gentoo)
if distro == 'gentoo':
# Gentoo-specific initialization
os.system("sudo emerge --sync")
os.system("sudo emerge --ask=n sys-devel/gcc sys-devel/make dev-vcs/git dev-lang/python")
# Development libraries
os.system(
"sudo emerge --ask=n dev-libs/openssl sys-libs/zlib \
app-arch/bzip2 sys-libs/readline dev-db/sqlite net-misc/wget net-misc/curl \
sys-devel/llvm sys-libs/ncurses app-arch/xz-utils dev-lang/tk \
dev-libs/libxml2 dev-libs/xmlsec dev-libs/libffi"
)
elif distro == 'fedora':
# Fedora-specific initialization
os.system("sudo dnf update -y")
os.system("sudo dnf groupinstall -y 'Development Tools'")
os.system("sudo dnf install -y git python3")
# Development libraries
os.system(
"sudo dnf install -y openssl-devel zlib-devel \
bzip2-devel readline-devel sqlite-devel wget curl llvm \
ncurses-devel xz-devel tk-devel libxml2-devel xmlsec1-devel libffi-devel"
)
else:
# Ubuntu/Debian initialization (original code)
os.system("sudo apt-get update && sudo apt-get upgrade -y")
os.system("sudo apt-get install build-essential git python3 -y")
# Other useful libraries that will come in handy at some point anyway:
os.system(
"sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev -y"
)
# Install and configure ZSH
if distro == 'gentoo':
os.system("sudo emerge --ask=n app-shells/zsh")
elif distro == 'fedora':
os.system("sudo dnf install -y zsh")
else:
os.system("sudo apt-get install zsh -y")
os.system("sudo chsh -s $(which zsh) $USER")
os.system(
r'sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" &'
)
# Install and configure useful command line tools
# Install and configure terminal theming/powerlevel10k etc
if distro == 'gentoo':
os.system("sudo emerge --ask=n media-fonts/powerline-fonts")
elif distro == 'fedora':
os.system("sudo dnf install -y powerline-fonts")
else:
os.system("sudo apt-get install fonts-powerline -y")
os.system(
r"git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
)
os.system(
r"git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting"
)
os.system(
r"git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions"
)
# Install Starship prompt
os.system(r"curl -sS https://starship.rs/install.sh | sh -s -- -y")
# Install uv (Python package manager)
os.system(r"curl -LsSf https://astral.sh/uv/install.sh | sh")
# Install Python versions via uv
os.system(r". $HOME/.cargo/env && $HOME/.cargo/bin/uv python install 3.11 3.12 3.13 --default")
os.system(r"curl https://sh.rustup.rs -sSf | sh -s -- -y")
## one of them should work
#os.system(r". $HOME/.cargo/env")
# Install Homebrew
os.system(r'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"')
# Install version managers
# SDKMAN (for Java, Kotlin, Scala, etc.)
os.system(r'curl -s "https://get.sdkman.io" | bash')
# GVM (Go Version Manager)
os.system(r'bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)')
# NVM (Node Version Manager) - using Homebrew
os.system(r'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && brew install nvm')
# Install essential tools via Homebrew (only what's not managed by version managers)
homebrew_packages = [
"jq", # JSON processor (also installed via apt for tofuenv)
"fd", # Alternative to find
"ripgrep", # Alternative to grep
"fzf", # Fuzzy finder
"yq", # YAML processor
"bandwhich", # Network utilization monitor
"procs", # Modern ps replacement
]
for package in homebrew_packages:
os.system(f'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && brew install {package}')
# Install tofuenv (OpenTofu version manager) via Homebrew
os.system(r'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && brew tap tofuutils/tap && brew install tofuenv')
# VERSION MANAGERS INSTALLED:
# - SDKMAN: Java, Kotlin, Scala, Groovy, etc. (installed above)
# - GVM: Go Version Manager (installed above)
# - NVM: Node Version Manager (installed above)
# - HVM: Hugo Version Manager (installed above)
# - tofuenv: OpenTofu Version Manager (installed above)
# - UV: Python Version Manager (installed above)
# HVM (Hugo Version Manager)
os.system(r'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && go install github.com/jmooring/hvm@latest')
# Generate HVM alias for zsh (will be added at the end when zshrc is copied)
# Note: This will be handled after .zshrc is copied to avoid conflicts
# Install useful programs
# Distro neutral
for each in list_of_programs_without_gui_cargo:
os.system(r". $HOME/.cargo/env && " + each)
if args.UI == "GUI":
if distro == 'gentoo':
# Install Gentoo GUI packages
for each in list_of_programs_with_gui_gentoo:
os.system(each)
elif distro == 'fedora':
# Install Fedora GUI packages
for each in list_of_programs_with_gui_fedora:
os.system(each)
else:
# Install Ubuntu/Debian GUI packages (original code)
for each in list_of_programs_with_gui_snap:
os.system(each)
for each in list_of_programs_with_gui_apt:
os.system(each)
# Distro specific headless packages
if distro == 'gentoo':
# Install Gentoo headless packages
for each in list_of_programs_without_gui_gentoo:
os.system(each)
elif distro == 'fedora':
# Install Fedora headless packages
for each in list_of_programs_without_gui_fedora:
os.system(each)
else:
# Ubuntu/Debian (original code)
for each in list_of_programs_without_gui_apt:
os.system(each)
# PYENV removed - using uv for Python management instead
# ZSHRC
os.system("cp ./.zshrc ~/.zshrc")
# TMUX CONFIG
os.system("cp ./.tmux.conf ~/.tmux.conf")
# NEOVIM CONFIG
os.system("mkdir -p ~/.config/nvim")
os.system("cp ./init.lua ~/.config/nvim/init.lua")
# ALACRITTY CONFIG (if GUI mode)
if args.UI == "GUI":
os.system("mkdir -p ~/.config/alacritty")
os.system("cp ./alacritty.toml ~/.config/alacritty/alacritty.toml")
# Generate HVM alias and add to zshrc
os.system(r'echo "" >> ~/.zshrc')
os.system(r'echo "# HVM (Hugo Version Manager) alias" >> ~/.zshrc')
os.system(r'$HOME/go/bin/hvm gen alias zsh >> ~/.zshrc')
# NERD FONTS
# os.system(r"git clone https://github.com/ryanoasis/nerd-fonts.git && cd ./nerd-fonts && ./install.sh")
# MesloLGL Nerd Font Regular
# my-shell-config removed - everything consolidated into .zshrc
# NERD FONTS - Install FiraCode Nerd Font for Alacritty
if args.UI == "GUI":
if distro == 'gentoo':
# On Gentoo, also install via emerge for system-wide availability
os.system("sudo emerge --ask=n media-fonts/firacode")
elif distro == 'fedora':
# On Fedora, install FiraCode via dnf for system-wide availability
os.system("sudo dnf install -y fira-code-fonts")
# Install nerd-fonts version manually for full support (common for all distros)
os.system("mkdir -p ~/.local/share/fonts")
os.system("wget -P ~/.local/share/fonts https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/FiraCode.zip")
os.system("cd ~/.local/share/fonts && unzip -o FiraCode.zip && rm FiraCode.zip")
os.system("fc-cache -fv")
print("Installation completed! Please restart your shell or run 'source ~/.zshrc' to apply changes.")
print("Don't forget to:")
print("- Install a specific OpenTofu version: tofuenv use latest")
print("- Install Python versions: uv python install 3.12")
if args.UI == "GUI":
print("- FiraCode Nerd Font installed for Alacritty")