Update vanity_setup.sh

This commit is contained in:
Marco Gallegos
2025-11-19 19:22:22 -06:00
committed by GitHub
parent 7056d72d86
commit 532dfe4762

View File

@@ -1,102 +1,123 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
# ──────────────────────────────────────────────── # ==============================================
# ASCII ART VANITY OS SHELL # HEADER
# ──────────────────────────────────────────────── # ==============================================
printf "\n" header() {
printf "██╗ ██╗ █████╗ ███╗ ██╗██╗███╗ ██╗██╗ ██╗ ██████╗ ███████╗\n" echo ""
printf "██║ ██║██╔══██╗████╗ ██║██║████╗ ██║██║ ██║ ██╔════╝ ██╔════╝\n" echo "=============================================="
printf "██║ ██║███████║██╔██╗ ██║██║██╔██╗ ██║██║ ██║ ██║ ███╗█████╗ \n" echo " V A N I T Y S H E L L"
printf "╚██╗ ██╔╝██╔══██║██║╚██╗██║██║██║╚██╗██║██║ ██║ ██║ ██║██╔══╝ \n" echo " macOS Development Installer"
printf " ╚████╔╝ ██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝ ╚██████╔╝███████╗\n" echo "=============================================="
printf " ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚══════╝\n" echo ""
printf " Vanity OS Shell Installer (macOS)\n\n" }
# ──────────────────────────────────────────────── # ==============================================
# Homebrew # PROGRESO VISUAL
# ──────────────────────────────────────────────── # ==============================================
if ! command -v brew >/dev/null 2>&1; then progress() {
echo "Instalando Homebrew…" local task="$1"
echo "$task"
for i in 10 25 40 55 70 85 100; do
printf " [%3s%%]\r" "$i"
sleep 0.06
done
printf " [100%%] ✓ Completado\n\n"
}
# ==============================================
# INSTALACIÓN REAL
# ==============================================
install_everything() {
# ------------------------------------------------
# Homebrew
# ------------------------------------------------
progress "Instalando Homebrew"
if ! command -v brew >/dev/null 2>&1; then
NONINTERACTIVE=1 /bin/bash -c \ NONINTERACTIVE=1 /bin/bash -c \
"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)" eval "$(/opt/homebrew/bin/brew shellenv)"
else fi
echo "Homebrew ya está instalado."
fi
echo "Actualizando Homebrew…" brew update
brew update
# ──────────────────────────────────────────────── # ------------------------------------------------
# Instalando paquetes base # Paquetes base
# ──────────────────────────────────────────────── # ------------------------------------------------
brew install zsh curl wget git xclip yq jq progress "Instalando paquetes base"
brew install zsh curl wget git xclip yq jq
# ──────────────────────────────────────────────── # ------------------------------------------------
# Oh My Zsh # Oh My Zsh
# ──────────────────────────────────────────────── # ------------------------------------------------
if [ ! -d "$HOME/.oh-my-zsh" ]; then progress "Instalando Oh My Zsh"
echo "Instalando Oh My Zsh…" if [ ! -d "$HOME/.oh-my-zsh" ]; then
RUNZSH=no CHSH=no KEEP_ZSHRC=yes \ RUNZSH=no CHSH=no KEEP_ZSHRC=yes \
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi fi
# ──────────────────────────────────────────────── # ------------------------------------------------
# Plugins de ZSH # Plugins ZSH
# ──────────────────────────────────────────────── # ------------------------------------------------
mkdir -p ~/.oh-my-zsh/custom/plugins progress "Instalando plugins ZSH"
mkdir -p ~/.oh-my-zsh/custom/plugins
repos=( repos=(
"zsh-users/zsh-autosuggestions" "zsh-users/zsh-autosuggestions"
"zsh-users/zsh-syntax-highlighting" "zsh-users/zsh-syntax-highlighting"
"zsh-users/zsh-completions" "zsh-users/zsh-completions"
) )
for r in "${repos[@]}"; do for r in "${repos[@]}"; do
folder=$(basename "$r") folder=$(basename "$r")
if [ ! -d "$HOME/.oh-my-zsh/custom/plugins/$folder" ]; then [ ! -d "$HOME/.oh-my-zsh/custom/plugins/$folder" ] && \
git clone https://github.com/$r ~/.oh-my-zsh/custom/plugins/$folder git clone https://github.com/$r ~/.oh-my-zsh/custom/plugins/$folder
fi done
done
# ──────────────────────────────────────────────── # ------------------------------------------------
# Instalación Oh My Posh + tema + fuentes # Oh My Posh + tema + fuente
# ──────────────────────────────────────────────── # ------------------------------------------------
brew install jandedobbeleer/oh-my-posh/oh-my-posh progress "Instalando Oh My Posh y tema Catppuccin"
brew install jandedobbeleer/oh-my-posh/oh-my-posh
mkdir -p ~/.poshthemes mkdir -p ~/.poshthemes
curl -fsSL \ curl -fsSL \
https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/catppuccin.omp.json \ https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/catppuccin.omp.json \
-o ~/.poshthemes/catppuccin.omp.json -o ~/.poshthemes/catppuccin.omp.json
# fuente recomendada oh-my-posh font install meslo
oh-my-posh font install meslo
# ──────────────────────────────────────────────── # ------------------------------------------------
# Descargar tu .zshrc.example # Descargar tu archivo .zshrc
# ──────────────────────────────────────────────── # ------------------------------------------------
echo "Descargando .zshrc.example…" progress "Descargando archivo .zshrc VanityOS"
curl -fsSL https://raw.githubusercontent.com/marcogll/mac_vntySet/refs/heads/main/.zshrc.example \ curl -fsSL \
https://raw.githubusercontent.com/marcogll/mac_vntySet/refs/heads/main/.zshrc.example \
-o ~/.zshrc -o ~/.zshrc
# ──────────────────────────────────────────────── # ------------------------------------------------
# Python, Node, Docker, Lazydocker # Python, Node, yt-dlp, Docker, LazyDocker
# ──────────────────────────────────────────────── # ------------------------------------------------
brew install python node lazydocker progress "Instalando Python, Node, yt-dlp y LazyDocker"
brew install python node yt-dlp lazydocker
# Docker Desktop CLI + Compose # ------------------------------------------------
brew install --cask docker # Docker Desktop
# ------------------------------------------------
progress "Instalando Docker Desktop (CLI + Compose)"
brew install --cask docker
# ──────────────────────────────────────────────── # ------------------------------------------------
# Portainer (docker) # Portainer (Docker)
# ──────────────────────────────────────────────── # ------------------------------------------------
docker volume create portainer_data || true progress "Configurando Portainer CE"
docker stop portainer >/dev/null 2>&1 || true docker volume create portainer_data || true
docker rm portainer >/dev/null 2>&1 || true docker stop portainer >/dev/null 2>&1 || true
docker rm portainer >/dev/null 2>&1 || true
docker run -d \ docker run -d \
-p 8000:8000 -p 9443:9443 \ -p 8000:8000 -p 9443:9443 \
--name=portainer \ --name=portainer \
--restart=always \ --restart=always \
@@ -104,12 +125,51 @@ docker run -d \
-v portainer_data:/data \ -v portainer_data:/data \
portainer/portainer-ce:latest portainer/portainer-ce:latest
# ──────────────────────────────────────────────── # ------------------------------------------------
# Copiar "source ~/.zshrc" al portapapeles # Copiar "source ~/.zshrc" al portapapeles
# ──────────────────────────────────────────────── # ------------------------------------------------
echo "source ~/.zshrc" | pbcopy echo "source ~/.zshrc" | pbcopy
echo ""
echo "La configuración está lista."
echo "Pega en tu terminal:"
echo ""
echo " source ~/.zshrc"
echo ""
echo "(Ya está copiado en tu portapapeles)"
}
printf "\nListo.\n" # ==============================================
printf "Pega y ejecuta en tu terminal para activar la configuración:\n" # MENU
printf "\n source ~/.zshrc\n\n" # ==============================================
printf "(Ya lo tienes en el portapapeles, solo pega con Cmd+V)\n\n" menu() {
header
echo "Selecciona una opción (ENTER = A):"
echo ""
echo " A) Instalar TODO (recomendado)"
echo " 1) Instalar Homebrew"
echo " 2) Instalar ZSH + plugins"
echo " 3) Instalar Oh My Posh + tema"
echo " 4) Instalar Python + Node"
echo " 5) Instalar Docker + Portainer + LazyDocker"
echo " 6) Instalar yt-dlp + aliases"
echo " 0) Salir"
echo ""
read -rp "Opción [A]: " opt
opt="${opt:-A}"
echo ""
case "$opt" in
A|a) install_everything ;;
0) echo "Saliendo…"; exit 0 ;;
*)
echo "Modo individual aún no habilitado."
sleep 1
menu
;;
esac
}
menu