-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall_my_programs_debian
More file actions
executable file
·190 lines (163 loc) · 5.09 KB
/
install_my_programs_debian
File metadata and controls
executable file
·190 lines (163 loc) · 5.09 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
#!/usr/bin/env bash
set -euo pipefail
DRY_RUN=false
timestamp=$(date +"%Y%m%d%H%M%S")
usage() {
cat <<'EOF'
Usage: install_my_programs_debian [options]
Options:
--dry-run Print planned actions without changing the system
-h, --help Show this help message
EOF
}
parse_args() {
while [[ $# -gt 0 ]]; do
case "$1" in
--dry-run)
DRY_RUN=true
;;
-h | --help)
usage
exit 0
;;
*)
echo "Unknown option: $1" >&2
usage >&2
exit 1
;;
esac
shift
done
}
run_cmd() {
if [[ "$DRY_RUN" == "true" ]]; then
printf '[dry-run] %s\n' "$*"
return 0
fi
"$@"
}
# Title: Install my unix programs
# Description: This scripts install my basic programs that I use day-by-day;
# It has a lot of useful programs that I recommend. This list
# will increase with time. Any suggestion are accepted. :-)
# Tags: Install, Unix
# Debian Programs
install_apt_first_available() {
local label="$1"
shift
if [[ "$DRY_RUN" == "true" ]]; then
run_cmd sudo apt install -y "$1"
return
fi
local pkg
for pkg in "$@"; do
if apt-cache show "$pkg" >/dev/null 2>&1; then
if dpkg -s "$pkg" >/dev/null 2>&1; then
echo "✅ $label already installed ($pkg)"
else
sudo apt install -y "$pkg"
echo "✅ Installed $label ($pkg)"
fi
return
fi
done
echo "ℹ️ $label unavailable in apt repositories; skipping"
}
install_with_fallback() {
local label="$1"
local apt_pkg="$2"
local cargo_pkg="${3:-}"
if [[ "$DRY_RUN" == "true" ]]; then
run_cmd sudo apt install -y "$apt_pkg"
return
fi
if dpkg -s "$apt_pkg" >/dev/null 2>&1; then
echo "✅ $label already installed ($apt_pkg)"
return
fi
if sudo apt install -y "$apt_pkg" >/dev/null 2>&1; then
echo "✅ Installed $label ($apt_pkg)"
return
fi
if [[ -n "$cargo_pkg" ]] && command -v cargo >/dev/null 2>&1; then
if [[ "$DRY_RUN" == "true" ]]; then
run_cmd cargo install "$cargo_pkg" --locked
else
cargo install "$cargo_pkg" --locked || true
fi
return
fi
echo "ℹ️ $label fallback unavailable; skipping"
}
parse_args "$@"
# Update and upgrade libraries
echo "Updating system..."
run_cmd sudo apt update -y
run_cmd sudo apt upgrade -y
echo "Installing essential tools..."
run_cmd sudo apt install -y \
curl wget git build-essential g++ make cmake pkg-config \
neovim tmux zsh htop btop tree jq ripgrep fzf bat fd-find zoxide \
openssl xclip parallel pre-commit
echo "Configuring monitoring stack..."
if command -v nvidia-smi >/dev/null 2>&1 || [[ -e "/dev/dri" ]]; then
if [[ "$DRY_RUN" == "true" ]]; then
run_cmd sudo apt install -y nvtop
echo "✅ nvtop install planned (dry-run)"
elif apt-cache show nvtop >/dev/null 2>&1; then
run_cmd sudo apt install -y nvtop
echo "✅ nvtop installed"
else
echo "ℹ️ nvtop package unavailable in apt repositories; skipping"
fi
else
echo "ℹ️ No GPU device detected; nvtop skipped"
fi
echo "Installing advanced productivity CLI tools..."
install_apt_first_available lazygit lazygit
install_apt_first_available glow glow
install_apt_first_available hyperfine hyperfine
install_apt_first_available yq yq
install_apt_first_available shellcheck shellcheck
install_apt_first_available shfmt shfmt
install_with_fallback "git-delta (delta)" git-delta git-delta
install_with_fallback "tealdeer (tldr)" tealdeer tealdeer
install_apt_first_available gawk gawk
install_apt_first_available entr entr
install_apt_first_available "gnu parallel" parallel
install_apt_first_available "dua-cli (dua)" dua-cli
install_apt_first_available dust du-dust dust
install_apt_first_available procs procs
install_apt_first_available xh xh
install_apt_first_available doggo doggo
install_apt_first_available watchexec watchexec
install_apt_first_available kubectl kubectl kubernetes-client
install_apt_first_available k9s k9s
install_apt_first_available trivy trivy
install_with_fallback zellij zellij zellij
install_apt_first_available starship starship
echo "Installing Python & ML dependencies..."
run_cmd sudo apt install -y \
python3 python3-pip python3-venv python3-dev python3-setuptools pylint \
libffi-dev libopenblas-dev liblapack-dev gfortran libfreetype6-dev libpng-dev \
libgit2-dev
echo "Installing Docker..."
if [[ "$DRY_RUN" == "true" ]]; then
printf '[dry-run] curl -fsSL https://get.docker.com | sudo sh\n'
else
curl -fsSL https://get.docker.com | sudo sh
fi
run_cmd sudo usermod -aG docker "$USER"
echo "Installing LaTeX (for reports/publications)..."
run_cmd sudo apt install -y texlive-latex-extra texlive-fonts-recommended texlive-pictures
echo "Cleaning up..."
run_cmd sudo apt autoremove -y
run_cmd sudo apt clean
if [[ -f "./run_commands/my_starship.toml" ]]; then
run_cmd mkdir -p "$HOME/.config"
if [[ -f "$HOME/.config/starship.toml" ]]; then
run_cmd cp "$HOME/.config/starship.toml" "$HOME/.config/starship.toml.${timestamp}.bak"
fi
run_cmd cp -f "./run_commands/my_starship.toml" "$HOME/.config/starship.toml"
echo "✅ Installed Starship config to ~/.config/starship.toml"
fi