feat: Add ZeroTier CLI and Speedtest CLI installation, ensure Xcode Command Line Tools, and improve user prompts.

This commit is contained in:
Marco Gallegos
2025-11-21 07:42:11 -06:00
parent acf0ea4649
commit 59b59e0c87
2 changed files with 61 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ Automatiza en pocos minutos un entorno de desarrollo moderno para macOS. VanityO
- Homebrew configurado para Apple Silicon o Intel. - Homebrew configurado para Apple Silicon o Intel.
- Zsh + Oh My Zsh con plugins (`zsh-autosuggestions`, `zsh-syntax-highlighting`, `zsh-completions`). - Zsh + Oh My Zsh con plugins (`zsh-autosuggestions`, `zsh-syntax-highlighting`, `zsh-completions`).
- Oh My Posh (tema Catppuccin) + fuente Meslo Nerd Font. - Oh My Posh (tema Catppuccin) + fuente Meslo Nerd Font.
- Node.js, Python, Git, direnv y herramientas base de terminal. - Node.js, Python, Git, direnv y herramientas base de terminal (incluyendo ZeroTier CLI y Speedtest CLI).
- yt-dlp + ffmpeg para descargas directas desde YouTube (video y audio). - yt-dlp + ffmpeg para descargas directas desde YouTube (video y audio).
- Docker CLI, Lazydocker y despliegue automático de Portainer CE (con Docker Desktop preinstalado y arrancado). - Docker CLI, Lazydocker y despliegue automático de Portainer CE (con Docker Desktop preinstalado y arrancado).
- Ajusta automáticamente la fuente de la app Terminal a Meslo Nerd Font para que Oh My Posh muestre los iconos correctamente. - Ajusta automáticamente la fuente de la app Terminal a Meslo Nerd Font para que Oh My Posh muestre los iconos correctamente.
@@ -17,7 +17,7 @@ Automatiza en pocos minutos un entorno de desarrollo moderno para macOS. VanityO
## ✅ Requisitos previos ## ✅ Requisitos previos
- macOS 12+ (Intel o Apple Silicon). - macOS 12+ (Intel o Apple Silicon).
- Conexión estable a internet y espacio libre (~5GB para Docker). - Conexión estable a internet y espacio libre (~5GB para Docker).
- Se recomienda instalar las Xcode Command Line Tools antes de iniciar: - Las Xcode Command Line Tools se instalan automáticamente si no están presentes; si prefieres hacerlo antes de correr el script, ejecuta:
```bash ```bash
xcode-select --install xcode-select --install
``` ```
@@ -72,6 +72,8 @@ Cada ejecución genera un registro detallado en `.logs/vanity-YYYYmmdd-HHMMSS.lo
- Verificar Docker: `docker info` - Verificar Docker: `docker info`
- Confirmar Portainer: abre `https://localhost:9443` en el navegador. - Confirmar Portainer: abre `https://localhost:9443` en el navegador.
- Lanzar Lazydocker: `lazydocker` - Lanzar Lazydocker: `lazydocker`
- Probar ZeroTier CLI: `zerotier-cli info`
- Ejecutar una prueba rápida de red: `speedtest-cli`
- Descargar un video de prueba: `ytv https://youtu.be/<ID>` - Descargar un video de prueba: `ytv https://youtu.be/<ID>`
- Descargar solo audio: `ytm https://youtu.be/<ID>` - Descargar solo audio: `ytm https://youtu.be/<ID>`
- Ver ayuda rápida: ejecuta `help` - Ver ayuda rápida: ejecuta `help`

View File

@@ -46,6 +46,8 @@ ensure_brew_shellenv() {
} }
install_homebrew() { install_homebrew() {
ensure_xcode_clt
if [ -z "$BREW_BIN" ] && [ ! -x /opt/homebrew/bin/brew ] && [ ! -x /usr/local/bin/brew ]; then if [ -z "$BREW_BIN" ] && [ ! -x /opt/homebrew/bin/brew ] && [ ! -x /usr/local/bin/brew ]; then
echo "Instalando Homebrew…" echo "Instalando Homebrew…"
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@@ -65,7 +67,7 @@ install_homebrew() {
install_cli_dependencies() { install_cli_dependencies() {
echo "Instalando herramientas base de desarrollo…" echo "Instalando herramientas base de desarrollo…"
brew install zsh curl wget git jq yq node python go direnv yt-dlp ffmpeg brew install zsh curl wget git jq yq node python go direnv yt-dlp ffmpeg zerotier-one speedtest-cli
echo "Instalando Oh My Posh y fuentes Nerd Font…" echo "Instalando Oh My Posh y fuentes Nerd Font…"
brew tap homebrew/cask-fonts >/dev/null 2>&1 || true brew tap homebrew/cask-fonts >/dev/null 2>&1 || true
@@ -207,6 +209,59 @@ install_docker_stack() {
portainer/portainer-ce:latest >/dev/null portainer/portainer-ce:latest >/dev/null
} }
ensure_xcode_clt() {
if xcode-select -p >/dev/null 2>&1; then
return
fi
echo "Instalando Xcode Command Line Tools…"
echo "macOS abrirá un diálogo gráfico; acepta la instalación para continuar."
if ! /usr/bin/xcode-select --install >/dev/null 2>&1; then
if xcode-select -p >/dev/null 2>&1; then
return
fi
echo "No se pudo iniciar la instalación automática. Ejecuta 'xcode-select --install' manualmente y vuelve a intentarlo." >&2
exit 1
fi
wait_for_enter "Una vez que la instalación gráfica termine, presiona Enter para continuar… "
local attempts=0
local max_attempts=60
while ! xcode-select -p >/dev/null 2>&1; do
sleep 5
attempts=$((attempts + 1))
if (( attempts >= max_attempts )); then
echo "No se detectó la instalación de las Xcode Command Line Tools tras varios intentos." >&2
echo "Instálalas manualmente con 'xcode-select --install' y vuelve a ejecutar este script." >&2
exit 1
fi
done
echo "Xcode Command Line Tools instaladas correctamente."
}
wait_for_enter() {
local prompt="$1"
if [ -t 0 ]; then
read -r -p "$prompt" _
printf "\n"
return 0
fi
if [ -r /dev/tty ]; then
printf "%s" "$prompt" > /dev/tty
read -r _ < /dev/tty
printf "\n"
return 0
fi
printf "%s\n" "$prompt"
return 1
}
read_menu_choice() { read_menu_choice() {
local prompt="$1" local prompt="$1"
@@ -288,5 +343,5 @@ echo ""
echo "Para aplicar la configuración ejecuta ahora:" echo "Para aplicar la configuración ejecuta ahora:"
echo "source ~/.zshrc" echo "source ~/.zshrc"
echo "" echo ""
read -r -p "Presiona Enter una vez hayas ejecutado el comando anterior en tu terminal… " _ wait_for_enter "Presiona Enter una vez hayas ejecutado el comando anterior en tu terminal… "
echo "Reinicia tu Mac para asegurarte de que todas las herramientas queden listas para el próximo arranque." echo "Reinicia tu Mac para asegurarte de que todas las herramientas queden listas para el próximo arranque."