setup-kapelu 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +120 -0
- package/config/.bashrc +148 -0
- package/config/protect-main.json +47 -0
- package/index.js +78 -0
- package/install.sh +164 -0
- package/package.json +33 -0
- package/script/btn-log.sh +98 -0
- package/script/btn-shd.sh +170 -0
- package/script/btn-sus.sh +176 -0
- package/script/node-clean.sh +326 -0
- package/script/setup.sh +463 -0
package/script/setup.sh
ADDED
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ╔════════════════════════════════════════════════════╗
|
|
3
|
+
# │ cerrar-sesion - Script para cerrar la sesión │
|
|
4
|
+
# │ Versión: 2.0 │
|
|
5
|
+
# │ Autor: Daniel Calderon - Kapelu │
|
|
6
|
+
# │ Fecha: 10/08/2023 │
|
|
7
|
+
# │ WebSite: https://danielcalderon.vercel.app/ │
|
|
8
|
+
# │ Github: https://github.com/Kapelu │
|
|
9
|
+
# ╚════════════════════════════════════════════════════╝
|
|
10
|
+
set -Eeuo pipefail
|
|
11
|
+
IFS=$'\n\t'
|
|
12
|
+
|
|
13
|
+
VERSION="3.0"
|
|
14
|
+
USUARIO=$(whoami)
|
|
15
|
+
HOSTNAME=$(hostname)
|
|
16
|
+
FECHA=$(date "+%d-%m-%Y")
|
|
17
|
+
HORA=$(date "+%H:%M:%S")
|
|
18
|
+
|
|
19
|
+
APT_BASE=( wget gpg curl git apt-transport-https chrome-gnome-shell gnome-browser-connector font-manager net-tools )
|
|
20
|
+
|
|
21
|
+
APT_DEV_TOOLS=( lsd neofetch dialog build-essential )
|
|
22
|
+
|
|
23
|
+
SNAP_DEV_TOOLS=( proton-pass proton-mail jdownloader2 vlc telegram-desktop )
|
|
24
|
+
clear
|
|
25
|
+
### ───────────────────────────────
|
|
26
|
+
### COLORES ANSI UNIFICADOS
|
|
27
|
+
### ───────────────────────────────
|
|
28
|
+
declare -A COLOR=(
|
|
29
|
+
[reset]='\e[0m'
|
|
30
|
+
[bold]='\e[1m'
|
|
31
|
+
[italic]='\e[3m'
|
|
32
|
+
[warn]='\e[31;47m'
|
|
33
|
+
[warn_alt]='\e[31;40m'
|
|
34
|
+
[green]='\e[32m'
|
|
35
|
+
[yellow]='\e[33m'
|
|
36
|
+
[blue]='\e[34m'
|
|
37
|
+
[magenta]='\e[35m'
|
|
38
|
+
[cyan]='\e[36m'
|
|
39
|
+
[gray]='\e[90m'
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
########################################
|
|
43
|
+
# DETECCIÓN DE DISTRO
|
|
44
|
+
########################################
|
|
45
|
+
|
|
46
|
+
detect_distro() {
|
|
47
|
+
|
|
48
|
+
if [[ -f /etc/os-release ]]; then
|
|
49
|
+
. /etc/os-release
|
|
50
|
+
else
|
|
51
|
+
echo "No se puede detectar la distro"
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
case "$ID" in
|
|
56
|
+
ubuntu|debian|linuxmint)
|
|
57
|
+
DISTRO=$ID
|
|
58
|
+
;;
|
|
59
|
+
*)
|
|
60
|
+
echo "⚠️ WARNING"
|
|
61
|
+
echo "Este script solo soporta:"
|
|
62
|
+
echo "Ubuntu / Debian / Linux Mint"
|
|
63
|
+
echo "Distro detectada: $ID"
|
|
64
|
+
exit 1
|
|
65
|
+
;;
|
|
66
|
+
esac
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
### ───────────────────────────────
|
|
71
|
+
### FUNCIONES ÚTILES
|
|
72
|
+
### ───────────────────────────────
|
|
73
|
+
print_banner() {
|
|
74
|
+
local msg="$1"
|
|
75
|
+
echo -e "${COLOR[green]}════════════════════════════════════════════════════${COLOR[reset]}"
|
|
76
|
+
echo -e "$msg"
|
|
77
|
+
echo -e "${COLOR[green]}════════════════════════════════════════════════════${COLOR[reset]}"
|
|
78
|
+
echo -e ""
|
|
79
|
+
}
|
|
80
|
+
sleep 3
|
|
81
|
+
|
|
82
|
+
command_exists() { command -v "$1" >/dev/null 2>&1; }
|
|
83
|
+
|
|
84
|
+
pkg_installed() { dpkg -s "$1" >/dev/null 2>&1; }
|
|
85
|
+
|
|
86
|
+
snap_installed() { snap list "$1" >/dev/null 2>&1; }
|
|
87
|
+
|
|
88
|
+
alerta_critica() {
|
|
89
|
+
for i in {1..6}; do
|
|
90
|
+
echo -ne "${COLOR[warn]}❌ ERROR EN LÍNEA $1${COLOR[reset]}\r"
|
|
91
|
+
sleep 0.4
|
|
92
|
+
echo -ne "${COLOR[warn_alt]}❌ ERROR EN LÍNEA $1${COLOR[reset]}\r"
|
|
93
|
+
sleep 0.4
|
|
94
|
+
done
|
|
95
|
+
echo
|
|
96
|
+
}
|
|
97
|
+
trap 'alerta_critica $LINENO; exit 1' ERR
|
|
98
|
+
|
|
99
|
+
########################################
|
|
100
|
+
# INSTALADOR APT
|
|
101
|
+
########################################
|
|
102
|
+
|
|
103
|
+
install_apt() {
|
|
104
|
+
|
|
105
|
+
local to_install=()
|
|
106
|
+
|
|
107
|
+
for pkg in "$@"; do
|
|
108
|
+
if pkg_installed "$pkg"; then
|
|
109
|
+
clear
|
|
110
|
+
echo -e "${COLOR[magenta]}✔ $pkg ya instalado${COLOR[reset]}"
|
|
111
|
+
else
|
|
112
|
+
to_install+=("$pkg")
|
|
113
|
+
fi
|
|
114
|
+
done
|
|
115
|
+
|
|
116
|
+
if [[ ${#to_install[@]} -gt 0 ]]; then
|
|
117
|
+
clear
|
|
118
|
+
echo -e "${COLOR[green]}📦 Instalando: ${to_install[*]}${COLOR[reset]}"
|
|
119
|
+
sudo apt install -y "${to_install[@]}"
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
########################################
|
|
125
|
+
# INSTALADOR SNAP
|
|
126
|
+
########################################
|
|
127
|
+
|
|
128
|
+
install_snap() {
|
|
129
|
+
|
|
130
|
+
local pkg="$1"
|
|
131
|
+
local flag="${2:-}"
|
|
132
|
+
|
|
133
|
+
if snap_installed "$pkg"; then
|
|
134
|
+
clear
|
|
135
|
+
echo -e "${COLOR[magenta]}✔ $pkg ya instalado${COLOR[reset]}"
|
|
136
|
+
|
|
137
|
+
else
|
|
138
|
+
clear
|
|
139
|
+
echo -e "${COLOR[green]}$📦 Instalando snap: $pkg${COLOR[reset]}"
|
|
140
|
+
sudo snap install "$pkg" $flag
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
########################################
|
|
146
|
+
# UPDATE SISTEMA
|
|
147
|
+
########################################
|
|
148
|
+
|
|
149
|
+
system_update() {
|
|
150
|
+
clear
|
|
151
|
+
echo -e "${COLOR[green]}🔄 Actualizando sistema${COLOR[reset]}"
|
|
152
|
+
sudo apt update -y
|
|
153
|
+
sudo apt upgrade -y
|
|
154
|
+
sudo apt full-upgrade -y
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
########################################
|
|
158
|
+
# LIMPIEZA
|
|
159
|
+
########################################
|
|
160
|
+
|
|
161
|
+
system_cleanup() { sudo apt autoremove -y; sudo apt clean; }
|
|
162
|
+
|
|
163
|
+
########################################
|
|
164
|
+
# FIREFOX
|
|
165
|
+
########################################
|
|
166
|
+
|
|
167
|
+
remove_firefox() {
|
|
168
|
+
|
|
169
|
+
sudo snap remove --purge firefox || true
|
|
170
|
+
sudo apt purge -y firefox || true
|
|
171
|
+
rm -rf ~/.mozilla || true
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
########################################
|
|
176
|
+
# BRAVE
|
|
177
|
+
########################################
|
|
178
|
+
|
|
179
|
+
install_brave() {
|
|
180
|
+
|
|
181
|
+
if command_exists brave-browser; then
|
|
182
|
+
clear
|
|
183
|
+
echo ""
|
|
184
|
+
echo -e "${COLOR[magenta]}✔ Brave ya instalado${COLOR[reset]}"
|
|
185
|
+
return
|
|
186
|
+
fi
|
|
187
|
+
clear
|
|
188
|
+
|
|
189
|
+
echo -e "${COLOR[green]}📦 Instalando Brave${COLOR[reset]}"
|
|
190
|
+
|
|
191
|
+
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg \
|
|
192
|
+
https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
|
|
193
|
+
|
|
194
|
+
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] \
|
|
195
|
+
https://brave-browser-apt-release.s3.brave.com/ stable main" \
|
|
196
|
+
| sudo tee /etc/apt/sources.list.d/brave-browser-release.list
|
|
197
|
+
|
|
198
|
+
sudo apt update -y
|
|
199
|
+
|
|
200
|
+
install_apt brave-browser -y
|
|
201
|
+
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
########################################
|
|
205
|
+
# GOOGLE CHROME
|
|
206
|
+
########################################
|
|
207
|
+
|
|
208
|
+
install_chrome() {
|
|
209
|
+
|
|
210
|
+
if command_exists google-chrome; then
|
|
211
|
+
clear
|
|
212
|
+
echo -e "${COLOR[magenta]}✔ Chrome ya instalado${COLOR[reset]}"
|
|
213
|
+
|
|
214
|
+
return
|
|
215
|
+
fi
|
|
216
|
+
clear
|
|
217
|
+
|
|
218
|
+
echo -e "${COLOR[green]}📦 Instalando Google Chrome${COLOR[reset]}"
|
|
219
|
+
|
|
220
|
+
tmp="/tmp/chrome.deb"
|
|
221
|
+
|
|
222
|
+
wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O "$tmp"
|
|
223
|
+
|
|
224
|
+
sudo dpkg -i "$tmp" || sudo apt -f install -y
|
|
225
|
+
|
|
226
|
+
rm -f "$tmp"
|
|
227
|
+
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
########################################
|
|
231
|
+
# PROTON VPN
|
|
232
|
+
########################################
|
|
233
|
+
|
|
234
|
+
install_protonvpn() {
|
|
235
|
+
|
|
236
|
+
if pkg_installed proton-vpn-gnome-desktop; then
|
|
237
|
+
clear
|
|
238
|
+
|
|
239
|
+
echo -e "${COLOR[magenta]}✔ ProtonVPN ya instalado${COLOR[reset]}"
|
|
240
|
+
|
|
241
|
+
return
|
|
242
|
+
fi
|
|
243
|
+
clear
|
|
244
|
+
|
|
245
|
+
echo -e "${COLOR[green]}📦 Instalando ProtonVPN${COLOR[reset]}"
|
|
246
|
+
|
|
247
|
+
tmp="/tmp/protonvpn.deb"
|
|
248
|
+
|
|
249
|
+
wget -q https://repo.protonvpn.com/debian/dists/stable/main/binary-all/protonvpn-stable-release_1.0.8_all.deb -O "$tmp"
|
|
250
|
+
|
|
251
|
+
sudo dpkg -i "$tmp"
|
|
252
|
+
|
|
253
|
+
sudo apt update -y
|
|
254
|
+
|
|
255
|
+
install_apt \
|
|
256
|
+
proton-vpn-gnome-desktop \
|
|
257
|
+
gnome-keyring \
|
|
258
|
+
libayatana-appindicator3-1
|
|
259
|
+
|
|
260
|
+
rm -f "$tmp"
|
|
261
|
+
|
|
262
|
+
echo "✔ ProtonVPN instalado"
|
|
263
|
+
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
########################################
|
|
267
|
+
# Sublime_text
|
|
268
|
+
########################################
|
|
269
|
+
install_sublime() {
|
|
270
|
+
|
|
271
|
+
if command -v subl >/dev/null 2>&1; then
|
|
272
|
+
echo -e "${COLOR[magenta]}✔ Sublime text ya instalado${COLOR[reset]}"
|
|
273
|
+
return 0
|
|
274
|
+
fi
|
|
275
|
+
|
|
276
|
+
REPO_FILE="/etc/apt/sources.list.d/sublime-text.list"
|
|
277
|
+
KEY_FILE="/usr/share/keyrings/sublimehq.gpg"
|
|
278
|
+
|
|
279
|
+
echo -e "${COLOR[green]}📦 Instalando Sublime text${COLOR[reset]}"
|
|
280
|
+
|
|
281
|
+
if [ ! -f "$KEY_FILE" ]; then
|
|
282
|
+
echo "Agregando clave del repositorio"
|
|
283
|
+
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg \
|
|
284
|
+
| gpg --dearmor \
|
|
285
|
+
| sudo tee "$KEY_FILE" > /dev/null
|
|
286
|
+
fi
|
|
287
|
+
|
|
288
|
+
if [ ! -f "$REPO_FILE" ]; then
|
|
289
|
+
echo "deb [signed-by=$KEY_FILE] https://download.sublimetext.com/ apt/stable/" \
|
|
290
|
+
| sudo tee "$REPO_FILE"
|
|
291
|
+
else
|
|
292
|
+
echo "Repositorio ya existe"
|
|
293
|
+
fi
|
|
294
|
+
|
|
295
|
+
sudo apt update
|
|
296
|
+
sudo apt install -y sublime-text
|
|
297
|
+
}
|
|
298
|
+
########################################
|
|
299
|
+
# VSCODE
|
|
300
|
+
########################################
|
|
301
|
+
|
|
302
|
+
install_vscode() {
|
|
303
|
+
|
|
304
|
+
if command_exists code; then
|
|
305
|
+
clear
|
|
306
|
+
|
|
307
|
+
echo -e "${COLOR[magenta]}✔ VSCode ya instalado${COLOR[reset]}"
|
|
308
|
+
|
|
309
|
+
return
|
|
310
|
+
fi
|
|
311
|
+
clear
|
|
312
|
+
echo -e "${COLOR[green]}📦 Instalando VSCode${COLOR[reset]}"
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
wget -qO- https://packages.microsoft.com/keys/microsoft.asc \
|
|
316
|
+
| gpg --dearmor > packages.microsoft.gpg
|
|
317
|
+
|
|
318
|
+
sudo install -D -m 644 packages.microsoft.gpg \
|
|
319
|
+
/etc/apt/keyrings/packages.microsoft.gpg
|
|
320
|
+
|
|
321
|
+
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/packages.microsoft.gpg] \
|
|
322
|
+
https://packages.microsoft.com/repos/code stable main" \
|
|
323
|
+
| sudo tee /etc/apt/sources.list.d/vscode.list
|
|
324
|
+
|
|
325
|
+
sudo apt update
|
|
326
|
+
|
|
327
|
+
install_apt code
|
|
328
|
+
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
########################################
|
|
332
|
+
# NODE
|
|
333
|
+
########################################
|
|
334
|
+
|
|
335
|
+
install_node() {
|
|
336
|
+
|
|
337
|
+
if command_exists node; then
|
|
338
|
+
clear
|
|
339
|
+
echo -e "${COLOR[magenta]}✔ Node ya instalado${COLOR[reset]}"
|
|
340
|
+
|
|
341
|
+
return
|
|
342
|
+
fi
|
|
343
|
+
clear
|
|
344
|
+
|
|
345
|
+
echo -e "${COLOR[green]}📦 Instalando NVM${COLOR[reset]}"
|
|
346
|
+
|
|
347
|
+
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
|
|
348
|
+
|
|
349
|
+
export NVM_DIR="$HOME/.nvm"
|
|
350
|
+
source "$NVM_DIR/nvm.sh"
|
|
351
|
+
|
|
352
|
+
nvm install --lts
|
|
353
|
+
nvm use --lts
|
|
354
|
+
|
|
355
|
+
npm install -g pnpm yarn
|
|
356
|
+
|
|
357
|
+
curl -fsSL https://bun.sh/install | bash
|
|
358
|
+
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
########################################
|
|
362
|
+
# INSTALAR SNAP TOOLS
|
|
363
|
+
########################################
|
|
364
|
+
|
|
365
|
+
install_snap_tools() {
|
|
366
|
+
|
|
367
|
+
for pkg in "${SNAP_DEV_TOOLS[@]}"; do
|
|
368
|
+
|
|
369
|
+
if [[ "$pkg" == "sublime-text" ]]; then
|
|
370
|
+
install_snap "$pkg" "--classic"
|
|
371
|
+
else
|
|
372
|
+
install_snap "$pkg"
|
|
373
|
+
fi
|
|
374
|
+
|
|
375
|
+
done
|
|
376
|
+
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
########################################
|
|
380
|
+
# INSTALAR APT TOOLS
|
|
381
|
+
########################################
|
|
382
|
+
|
|
383
|
+
install_apt_tools() {
|
|
384
|
+
|
|
385
|
+
install_apt "${APT_DEV_TOOLS[@]}"
|
|
386
|
+
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
########################################
|
|
390
|
+
# SSH
|
|
391
|
+
########################################
|
|
392
|
+
|
|
393
|
+
setup_ssh() {
|
|
394
|
+
|
|
395
|
+
if [[ -f "$HOME/.ssh/id_ed25519" ]]; then
|
|
396
|
+
echo "✔ SSH ya configurado"
|
|
397
|
+
return
|
|
398
|
+
fi
|
|
399
|
+
|
|
400
|
+
read -rp "Email SSH: " EMAIL
|
|
401
|
+
|
|
402
|
+
ssh-keygen -t ed25519 -C "$EMAIL" -f "$HOME/.ssh/id_ed25519" -N ""
|
|
403
|
+
|
|
404
|
+
eval "$(ssh-agent -s)"
|
|
405
|
+
ssh-add "$HOME/.ssh/id_ed25519"
|
|
406
|
+
|
|
407
|
+
cat "$HOME/.ssh/id_ed25519.pub"
|
|
408
|
+
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
########################################
|
|
412
|
+
# EJECUCIÓN
|
|
413
|
+
########################################
|
|
414
|
+
clear
|
|
415
|
+
main() {
|
|
416
|
+
START=$SECONDS
|
|
417
|
+
|
|
418
|
+
detect_distro
|
|
419
|
+
|
|
420
|
+
system_update
|
|
421
|
+
|
|
422
|
+
install_apt "${APT_BASE[@]}"
|
|
423
|
+
|
|
424
|
+
system_cleanup
|
|
425
|
+
|
|
426
|
+
remove_firefox
|
|
427
|
+
|
|
428
|
+
########################################
|
|
429
|
+
# INSTALACIÓN PARALELA
|
|
430
|
+
########################################
|
|
431
|
+
|
|
432
|
+
install_brave &
|
|
433
|
+
install_chrome &
|
|
434
|
+
install_sublime_text &
|
|
435
|
+
install_vscode &
|
|
436
|
+
install_protonvpn &
|
|
437
|
+
install_node &
|
|
438
|
+
install_apt_tools &
|
|
439
|
+
install_snap_tools &
|
|
440
|
+
|
|
441
|
+
wait
|
|
442
|
+
|
|
443
|
+
#setup_ssh
|
|
444
|
+
|
|
445
|
+
system_cleanup
|
|
446
|
+
|
|
447
|
+
ELAPSED=$(( SECONDS - START ))
|
|
448
|
+
HORAS=$((ELAPSED / 3600))
|
|
449
|
+
MINUTOS=$(( (ELAPSED % 3600) / 60 ))
|
|
450
|
+
SEGUNDOS=$((ELAPSED % 60))
|
|
451
|
+
|
|
452
|
+
clear
|
|
453
|
+
print_banner " 🎉 Secuencia Post-Install completada con éxito!!!
|
|
454
|
+
Usuario: $USUARIO
|
|
455
|
+
Host: $HOSTNAME
|
|
456
|
+
Fecha: $FECHA
|
|
457
|
+
Hora de inicio: $HORA
|
|
458
|
+
Hora de fin : $(date '+%H:%M:%S')
|
|
459
|
+
Tiempo total : ${HORAS}h:${MINUTOS}m:${SEGUNDOS}s"
|
|
460
|
+
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
main
|