setup-kapelu 3.2.9 → 3.2.10

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.
Files changed (2) hide show
  1. package/install.sh +106 -136
  2. package/package.json +15 -10
package/install.sh CHANGED
@@ -1,117 +1,112 @@
1
1
  #!/usr/bin/env bash
2
2
  # ╔════════════════════════════════════════════════════╗
3
- # │ Install - Script para comenzar la instalación.
4
- # │ Versión: 2.0 │
3
+ # │ setup-kapelu installer completo Ubuntu
5
4
  # │ Autor: Daniel Calderon - Kapelu │
6
- # │ Fecha: 06/03/2026 │
7
- # │ WebSite: https://danielcalderon.vercel.app/ │
8
- # │ Github: https://github.com/Kapelu │
5
+ # │ Fecha: 14/03/2026 │
9
6
  # ╚════════════════════════════════════════════════════╝
7
+
10
8
  set -Eeuo pipefail
11
9
  IFS=$'\n\t'
12
10
 
11
+ GREEN='\e[32m'
12
+ RESET='\e[0m'
13
+
13
14
  USER_NAME=$(whoami)
14
- HOME_DIR=$HOME
15
+ HOME_DIR="$HOME"
15
16
  DESKTOP_DIR=$(xdg-user-dir DESKTOP)
16
17
  TMP_DIR="/tmp/kape-setup-$RANDOM"
17
18
  REPO="https://github.com/Kapelu/kape-setup.git"
18
- green='\e[32m'
19
- reset='\e[0m'
20
- LOG="$HOME/setup-kapelu.log"
21
-
22
- log() {
23
- echo -e "\033[0;32m✅ $1\033[0m"
24
- echo "$1" >> "$LOG"
25
- }
26
19
 
27
- detect_distro(){
20
+ log() { echo -e "${GREEN}✅ $1${RESET}"; }
28
21
 
29
- if [ ! -f /etc/os-release ]; then
30
- log "Sistema no soportado"
31
- exit 1
32
- fi
33
-
34
- source /etc/os-release
35
-
36
- case "$ID" in
37
- ubuntu|debian|linuxmint|pop)
38
- log "Distribución detectada: $ID"
39
- ;;
40
- *)
41
- log "Distribución no soportada"
42
- exit 1
43
- esac
22
+ # 1️⃣ Detectar distro
23
+ detect_distro() {
24
+ if [[ -f /etc/os-release ]]; then
25
+ . /etc/os-release
26
+ else
27
+ echo "❌ No se puede detectar la distro"
28
+ exit 1
29
+ fi
30
+ case "$ID" in
31
+ ubuntu|debian|linuxmint|pop)
32
+ log "Distribución soportada: $ID"
33
+ ;;
34
+ *)
35
+ echo "❌ Distro no soportada: $ID"
36
+ exit 1
37
+ ;;
38
+ esac
44
39
  }
45
40
 
46
- check_git(){
47
-
48
- if ! command -v git >/dev/null; then
49
- log "Instalando git"
50
- sudo apt update
51
- sudo apt install -y git
52
- fi
41
+ # 2️⃣ Actualizar sistema
42
+ system_update() {
43
+ log "Actualizando sistema..."
44
+ sudo apt update -y
45
+ sudo apt upgrade -y
46
+ sudo apt install -y curl git build-essential xdg-utils
53
47
  }
54
48
 
55
- permits(){
56
- while IFS= read -r -d '' file
57
- do
58
- if head -n1 "$file" | grep -q "^#!"
59
- then
60
- chmod +x "$file"
49
+ # 3️⃣ Instalar NVM + Node LTS
50
+ install_node() {
51
+ log "Instalando NVM..."
52
+ export NVM_DIR="$HOME/.nvm"
53
+ if [ ! -d "$NVM_DIR" ]; then
54
+ curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
61
55
  fi
62
- done < <(find . -type f -print0)
63
- }
56
+ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
57
+ [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
64
58
 
65
- backup_bashrc(){
59
+ log "Instalando Node LTS..."
60
+ nvm install --lts
61
+ nvm use --lts
62
+ nvm alias default 'lts/*'
66
63
 
67
- if [ -f "$HOME_DIR/.bashrc" ]; then
68
- cp "$HOME_DIR/.bashrc" "$HOME_DIR/.bashrc.backup.$(date +%s)"
69
- log "Backup de .bashrc creado"
70
- fi
64
+ log "Node $(node -v) y npm $(npm -v) listos"
71
65
  }
72
66
 
73
- clone_repo(){
74
-
75
- log "Clonando repositorio"
76
-
77
- git clone -b main "$REPO" "$TMP_DIR"
67
+ # 4️⃣ Instalar setup-kapelu globalmente
68
+ install_kapelu() {
69
+ log "Instalando setup-kapelu globalmente..."
70
+ npm install -g setup-kapelu
71
+ if command -v kapelu >/dev/null 2>&1; then
72
+ log "setup-kapelu instalado correctamente"
73
+ else
74
+ echo "❌ Error instalando setup-kapelu"
75
+ exit 1
76
+ fi
78
77
  }
79
78
 
80
- copy_scripts(){
81
-
82
- mkdir -p "$HOME_DIR/script"
83
-
84
- cp -r "$TMP_DIR/script/." "$HOME_DIR/script/"
85
-
86
- find "$HOME_DIR/script" -type f -name "*.sh" -exec chmod +x {} \;
87
-
79
+ # 5️⃣ Clonar repositorio temporal
80
+ clone_repo() {
81
+ log "Clonando repositorio..."
82
+ git clone -b main "$REPO" "$TMP_DIR"
88
83
  }
89
84
 
90
- copy_config(){
91
-
92
- cp "$TMP_DIR/config/.bashrc" "$HOME_DIR/.bashrc"
93
-
94
- cp "$TMP_DIR/config/protect-main.json" "$HOME_DIR/"
85
+ # 6️⃣ Copiar scripts y dar permisos
86
+ copy_scripts() {
87
+ mkdir -p "$HOME_DIR/script"
88
+ cp -r "$TMP_DIR/script/." "$HOME_DIR/script/"
89
+ find "$HOME_DIR/script" -type f -exec chmod +x {} \;
95
90
  }
96
91
 
97
- create_desktop(){
98
-
99
- mkdir -p "$DESKTOP_DIR"
100
-
101
- DATA=(
102
- "log|Logout|Cierra sesión en 10 segundos|system-log-out"
103
- "shd|Apagar|Apaga la PC en 10 segundos|system-shutdown"
104
- "sus|Suspender|Suspende la PC en 10 segundos|system-suspend"
105
- )
106
-
107
- for row in "${DATA[@]}"
108
- do
109
-
110
- IFS="|" read -r id name comment icon <<< "$row"
111
-
112
- file="$DESKTOP_DIR/btn_${id}.desktop"
92
+ # 7️⃣ Copiar configuración
93
+ copy_config() {
94
+ cp "$TMP_DIR/config/.bashrc" "$HOME_DIR/.bashrc"
95
+ cp "$TMP_DIR/config/protect-main.json" "$HOME_DIR/"
96
+ }
113
97
 
114
- cat <<EOF > "$file"
98
+ # 8️⃣ Crear accesos directos en escritorio
99
+ create_desktop() {
100
+ mkdir -p "$DESKTOP_DIR"
101
+ DATA=(
102
+ "log|Logout|Cierra sesión en 10 segundos|system-log-out"
103
+ "shd|Apagar|Apaga la PC en 10 segundos|system-shutdown"
104
+ "sus|Suspender|Suspende la PC en 10 segundos|system-suspend"
105
+ )
106
+ for row in "${DATA[@]}"; do
107
+ IFS="|" read -r id name comment icon <<< "$row"
108
+ file="$DESKTOP_DIR/btn_${id}.desktop"
109
+ cat <<EOF > "$file"
115
110
  [Desktop Entry]
116
111
  Name=$name
117
112
  Comment=$comment
@@ -121,66 +116,41 @@ Terminal=false
121
116
  Type=Application
122
117
  Categories=Utility;
123
118
  EOF
124
-
125
- chmod +x "$file"
126
- gio set "$file" metadata::trusted true
127
-
128
- done
129
-
130
- killall -q nautilus 2>/dev/null
131
- }
132
-
133
-
134
- system_update(){ sudo apt update -y; sudo apt upgrade -y; sudo apt full-upgrade -y; }
135
-
136
- system_cleanup(){
137
-
138
- sudo apt autoremove -y
139
- sudo apt clean
119
+ chmod +x "$file"
120
+ gio set "$file" metadata::trusted true
121
+ done
122
+ killall -q nautilus 2>/dev/null || true
140
123
  }
141
124
 
142
- cleanup(){ rm -rf "$TMP_DIR"; }
143
-
144
- run_setup(){
145
-
146
- printf "${green}📦 ¿Desea ejecutar setup.sh? (s/n): ${reset}"
147
- read RESP
148
-
149
- if [ "$RESP" = "s" ]; then
150
-
125
+ # 9️⃣ Ejecutar setup.sh
126
+ run_setup() {
151
127
  FILE="$HOME_DIR/script/setup.sh"
152
-
153
128
  if [ ! -f "$FILE" ]; then
154
- echo "❌ Error: setup.sh no encontrado en $HOME_DIR/script/"
129
+ echo "❌ setup.sh no encontrado"
155
130
  return 1
156
131
  fi
157
-
158
- if [ ! -x "$FILE" ]; then
159
- chmod +x "$FILE"
160
- fi
161
-
132
+ chmod +x "$FILE"
162
133
  "$FILE"
163
-
164
- else
165
- system_update
166
- system_cleanup
167
- fi
168
-
169
134
  }
170
135
 
171
- main(){
172
-
173
- log "Iniciando Secuencia Post-Install setup-kape"
174
-
175
- detect_distro
176
- check_git
177
- clone_repo
178
- copy_scripts
179
- backup_bashrc
180
- copy_config
181
- create_desktop
182
- run_setup
183
- cleanup
136
+ # 🔟 Limpieza
137
+ cleanup() {
138
+ rm -rf "$TMP_DIR"
139
+ }
184
140
 
141
+ # ────────────── Main ──────────────
142
+ main() {
143
+ detect_distro
144
+ system_update
145
+ install_node
146
+ install_kapelu
147
+ clone_repo
148
+ copy_scripts
149
+ copy_config
150
+ create_desktop
151
+ run_setup
152
+ cleanup
153
+ log "🎉 Secuencia Post-Install completada con éxito"
185
154
  }
155
+
186
156
  main
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "setup-kapelu",
3
- "version": "3.2.9",
3
+ "version": "3.2.10",
4
4
  "description": "Script post-install de Ubuntu",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -10,23 +10,28 @@
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/Kapelu/kape-setup.git"
12
12
  },
13
+ "files": [
14
+ "cli.js",
15
+ "install.sh",
16
+ "script/",
17
+ "config/"
18
+ ],
13
19
  "keywords": [
14
20
  "ubuntu",
15
21
  "setup",
16
22
  "post-install",
17
- "cli",
18
- "script"
23
+ "vscode",
24
+ "node",
25
+ "sublime-text",
26
+ "script",
27
+ "script-install",
28
+ "snap",
29
+ "tool"
19
30
  ],
20
31
  "author": "Daniel Calderon",
21
32
  "license": "ISC",
22
33
  "bugs": {
23
34
  "url": "https://github.com/Kapelu/kape-setup/issues"
24
35
  },
25
- "homepage": "https://github.com/Kapelu/kape-setup#readme",
26
- "files": [
27
- "cli.js",
28
- "install.sh",
29
- "script/",
30
- "config/"
31
- ]
36
+ "homepage": "https://github.com/Kapelu/kape-setup#readme"
32
37
  }