mirror of
https://github.com/marcogll/scripts_mg.git
synced 2026-01-13 13:25:15 +00:00
Update omarchy-setup.sh
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# OMARCHY ZSH SETUP SCRIPT v2.0
|
# OMARCHY ZSH SETUP SCRIPT v2.1
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# GitHub: https://github.com/marcogll/scripts_mg
|
# GitHub: https://github.com/marcogll/scripts_mg
|
||||||
# Instalación: bash <(curl -fsSL https://raw.githubusercontent.com/marcogll/scripts_mg/main/omarchy_zsh_setup/omarchy-setup.sh)
|
# Instalación: bash <(curl -fsSL https://raw.githubusercontent.com/marcogll/scripts_mg/main/omarchy_zsh_setup/omarchy-setup.sh)
|
||||||
@@ -24,6 +24,36 @@ ZEROTIER_NETWORK=""
|
|||||||
KEYRING_PASSWORD=""
|
KEYRING_PASSWORD=""
|
||||||
NEEDS_REBOOT=false
|
NEEDS_REBOOT=false
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
LOG_FILE="$HOME/omarchy-setup.log"
|
||||||
|
ERROR_LOG="$HOME/omarchy-errors.log"
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# LOGGING
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
setup_logging() {
|
||||||
|
# Crear archivos de log
|
||||||
|
: > "$LOG_FILE"
|
||||||
|
: > "$ERROR_LOG"
|
||||||
|
|
||||||
|
# Redirigir stdout y stderr
|
||||||
|
exec > >(tee -a "$LOG_FILE")
|
||||||
|
exec 2> >(tee -a "$ERROR_LOG" >&2)
|
||||||
|
|
||||||
|
log "==================================================================="
|
||||||
|
log "OMARCHY SETUP v2.1 - $(date '+%Y-%m-%d %H:%M:%S')"
|
||||||
|
log "==================================================================="
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo "[$(date '+%H:%M:%S')] $*" | tee -a "$LOG_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
log_error() {
|
||||||
|
echo "[$(date '+%H:%M:%S')] ERROR: $*" | tee -a "$ERROR_LOG" >&2
|
||||||
|
}
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# FUNCIONES AUXILIARES
|
# FUNCIONES AUXILIARES
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -31,9 +61,12 @@ NEEDS_REBOOT=false
|
|||||||
print_header() {
|
print_header() {
|
||||||
clear
|
clear
|
||||||
echo -e "${CYAN}╔════════════════════════════════════════════════════════════════╗${NC}"
|
echo -e "${CYAN}╔════════════════════════════════════════════════════════════════╗${NC}"
|
||||||
echo -e "${CYAN}║${NC}${BOLD} OMARCHY ZSH SETUP v2.0 - Setup Completo${NC} ${CYAN}║${NC}"
|
echo -e "${CYAN}║${NC}${BOLD} OMARCHY ZSH SETUP v2.1 - Setup Completo${NC} ${CYAN}║${NC}"
|
||||||
echo -e "${CYAN}╚════════════════════════════════════════════════════════════════╝${NC}"
|
echo -e "${CYAN}╚════════════════════════════════════════════════════════════════╝${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo -e "${CYAN}Logs:${NC} $LOG_FILE"
|
||||||
|
echo -e "${CYAN}Errores:${NC} $ERROR_LOG"
|
||||||
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
progress_bar() {
|
progress_bar() {
|
||||||
@@ -53,15 +86,31 @@ progress_bar() {
|
|||||||
step() {
|
step() {
|
||||||
CURRENT_STEP=$((CURRENT_STEP + 1))
|
CURRENT_STEP=$((CURRENT_STEP + 1))
|
||||||
echo ""
|
echo ""
|
||||||
|
log "STEP ${CURRENT_STEP}/${TOTAL_STEPS}: $1"
|
||||||
echo -e "${GREEN}[${CURRENT_STEP}/${TOTAL_STEPS}]${NC} ${BOLD}$1${NC}"
|
echo -e "${GREEN}[${CURRENT_STEP}/${TOTAL_STEPS}]${NC} ${BOLD}$1${NC}"
|
||||||
progress_bar $CURRENT_STEP $TOTAL_STEPS "$1"
|
progress_bar $CURRENT_STEP $TOTAL_STEPS "$1"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
success() { echo -e "${GREEN}✓${NC} $1"; }
|
success() {
|
||||||
warning() { echo -e "${YELLOW}⚠${NC} $1"; }
|
echo -e "${GREEN}✓${NC} $1"
|
||||||
error() { echo -e "${RED}✗${NC} $1"; }
|
log "SUCCESS: $1"
|
||||||
info() { echo -e "${CYAN}ℹ${NC} $1"; }
|
}
|
||||||
|
|
||||||
|
warning() {
|
||||||
|
echo -e "${YELLOW}⚠${NC} $1"
|
||||||
|
log "WARNING: $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
error() {
|
||||||
|
echo -e "${RED}✗${NC} $1"
|
||||||
|
log_error "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
info() {
|
||||||
|
echo -e "${CYAN}ℹ${NC} $1"
|
||||||
|
log "INFO: $1"
|
||||||
|
}
|
||||||
|
|
||||||
ask_yes_no() {
|
ask_yes_no() {
|
||||||
local prompt="$1"
|
local prompt="$1"
|
||||||
@@ -77,8 +126,8 @@ ask_yes_no() {
|
|||||||
read -p "$(echo -e ${YELLOW}$prompt${NC})" response
|
read -p "$(echo -e ${YELLOW}$prompt${NC})" response
|
||||||
response=${response:-$default}
|
response=${response:-$default}
|
||||||
case $response in
|
case $response in
|
||||||
[Yy]* ) return 0;;
|
[Yy]* ) log "USER: $prompt -> YES"; return 0;;
|
||||||
[Nn]* ) return 1;;
|
[Nn]* ) log "USER: $prompt -> NO"; return 1;;
|
||||||
* ) echo "Por favor responde sí (y) o no (n).";;
|
* ) echo "Por favor responde sí (y) o no (n).";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -154,9 +203,14 @@ install_packages() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
info "Instalando ${#to_install[@]} paquetes nuevos..."
|
info "Instalando ${#to_install[@]} paquetes nuevos..."
|
||||||
sudo pacman -S --noconfirm --needed "${to_install[@]}"
|
log "Paquetes a instalar: ${to_install[*]}"
|
||||||
|
|
||||||
success "Paquetes instalados: ${#to_install[@]}"
|
if sudo pacman -S --noconfirm --needed "${to_install[@]}"; then
|
||||||
|
success "Paquetes instalados: ${#to_install[@]}"
|
||||||
|
else
|
||||||
|
error "Fallo al instalar algunos paquetes"
|
||||||
|
log_error "Paquetes que fallaron: revisar log de pacman"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_yay() {
|
install_yay() {
|
||||||
@@ -174,10 +228,14 @@ install_yay() {
|
|||||||
cd yay
|
cd yay
|
||||||
|
|
||||||
info "Compilando yay..."
|
info "Compilando yay..."
|
||||||
makepkg -si --noconfirm --nocheck
|
if makepkg -si --noconfirm --nocheck; then
|
||||||
cd ~
|
cd ~
|
||||||
|
success "yay instalado"
|
||||||
success "yay instalado"
|
else
|
||||||
|
cd ~
|
||||||
|
error "Fallo al instalar yay"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_oh_my_posh() {
|
install_oh_my_posh() {
|
||||||
@@ -188,10 +246,37 @@ install_oh_my_posh() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Instalando oh-my-posh-bin desde AUR..."
|
info "Intentando instalar oh-my-posh-bin desde AUR..."
|
||||||
yay -S --noconfirm oh-my-posh-bin
|
log "Método 1: Instalación desde AUR"
|
||||||
|
|
||||||
success "Oh My Posh instalado"
|
if yay -S --noconfirm oh-my-posh-bin 2>&1 | tee -a "$LOG_FILE"; then
|
||||||
|
success "Oh My Posh instalado desde AUR"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
warning "Fallo instalación desde AUR, intentando con script oficial..."
|
||||||
|
log "Método 2: Script de instalación oficial"
|
||||||
|
|
||||||
|
info "Descargando e instalando Oh My Posh..."
|
||||||
|
if curl -s https://ohmyposh.dev/install.sh | bash -s 2>&1 | tee -a "$LOG_FILE"; then
|
||||||
|
# Agregar al PATH si se instaló en ~/.local/bin
|
||||||
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
|
|
||||||
|
if command -v oh-my-posh &> /dev/null; then
|
||||||
|
success "Oh My Posh instalado con script oficial"
|
||||||
|
|
||||||
|
# Asegurar que esté en el PATH permanentemente
|
||||||
|
if ! grep -q ".local/bin" "$HOME/.zshrc" 2>/dev/null; then
|
||||||
|
info "Agregando ~/.local/bin al PATH..."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
error "Fallo al instalar Oh My Posh"
|
||||||
|
warning "Continuando sin Oh My Posh (puedes instalarlo después)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
error "Fallo al instalar Oh My Posh con script oficial"
|
||||||
|
warning "Continuando sin Oh My Posh"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_google_chrome() {
|
install_google_chrome() {
|
||||||
@@ -208,8 +293,11 @@ install_google_chrome() {
|
|||||||
success "Google Chrome ya está instalado"
|
success "Google Chrome ya está instalado"
|
||||||
else
|
else
|
||||||
info "Instalando Google Chrome desde AUR..."
|
info "Instalando Google Chrome desde AUR..."
|
||||||
yay -S --noconfirm google-chrome
|
if yay -S --noconfirm google-chrome; then
|
||||||
success "Google Chrome instalado"
|
success "Google Chrome instalado"
|
||||||
|
else
|
||||||
|
error "Fallo al instalar Google Chrome"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,10 +310,12 @@ install_localsend() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
info "Instalando LocalSend desde AUR..."
|
info "Instalando LocalSend desde AUR..."
|
||||||
yay -S --noconfirm localsend-bin
|
if yay -S --noconfirm localsend-bin; then
|
||||||
|
success "LocalSend instalado"
|
||||||
success "LocalSend instalado"
|
info "Abre LocalSend desde el menú de aplicaciones"
|
||||||
info "Abre LocalSend desde el menú de aplicaciones"
|
else
|
||||||
|
error "Fallo al instalar LocalSend"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_emoji_launcher() {
|
install_emoji_launcher() {
|
||||||
@@ -307,6 +397,7 @@ install_zerotier() {
|
|||||||
|
|
||||||
if ask_yes_no "¿Conectarse a tu red ZeroTier?" "y"; then
|
if ask_yes_no "¿Conectarse a tu red ZeroTier?" "y"; then
|
||||||
read -p "$(echo -e ${YELLOW}Network ID: ${NC})" ZEROTIER_NETWORK
|
read -p "$(echo -e ${YELLOW}Network ID: ${NC})" ZEROTIER_NETWORK
|
||||||
|
log "ZeroTier Network ID: $ZEROTIER_NETWORK"
|
||||||
|
|
||||||
if [ ! -z "$ZEROTIER_NETWORK" ]; then
|
if [ ! -z "$ZEROTIER_NETWORK" ]; then
|
||||||
info "Conectando..."
|
info "Conectando..."
|
||||||
@@ -338,6 +429,7 @@ configure_gnome_keyring() {
|
|||||||
echo " 3. Personalizada"
|
echo " 3. Personalizada"
|
||||||
echo ""
|
echo ""
|
||||||
read -p "$(echo -e ${YELLOW}Selecciona [1/2/3]: ${NC})" keyring_option
|
read -p "$(echo -e ${YELLOW}Selecciona [1/2/3]: ${NC})" keyring_option
|
||||||
|
log "Keyring option: $keyring_option"
|
||||||
|
|
||||||
case "$keyring_option" in
|
case "$keyring_option" in
|
||||||
2)
|
2)
|
||||||
@@ -426,7 +518,7 @@ create_zshrc() {
|
|||||||
|
|
||||||
cat > "$HOME/.zshrc" << 'ZSHRC_EOF'
|
cat > "$HOME/.zshrc" << 'ZSHRC_EOF'
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# CONFIGURACIÓN ZSH - OMARCHY v2.0
|
# CONFIGURACIÓN ZSH - OMARCHY v2.1
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
# --- PATH --------------------------------------------------------------------
|
# --- PATH --------------------------------------------------------------------
|
||||||
@@ -508,6 +600,10 @@ alias ..='cd ..'
|
|||||||
alias ...='cd ../..'
|
alias ...='cd ../..'
|
||||||
alias ....='cd ../../..'
|
alias ....='cd ../../..'
|
||||||
|
|
||||||
|
# System info
|
||||||
|
alias ff='fastfetch'
|
||||||
|
alias nf='fastfetch'
|
||||||
|
|
||||||
# Arch
|
# Arch
|
||||||
alias pacu='sudo pacman -Syu'
|
alias pacu='sudo pacman -Syu'
|
||||||
alias paci='sudo pacman -S'
|
alias paci='sudo pacman -S'
|
||||||
@@ -731,6 +827,7 @@ configure_git() {
|
|||||||
if ask_yes_no "¿Configurar Git?" "y"; then
|
if ask_yes_no "¿Configurar Git?" "y"; then
|
||||||
read -p "$(echo -e ${YELLOW}Nombre: ${NC})" git_name
|
read -p "$(echo -e ${YELLOW}Nombre: ${NC})" git_name
|
||||||
read -p "$(echo -e ${YELLOW}Email: ${NC})" git_email
|
read -p "$(echo -e ${YELLOW}Email: ${NC})" git_email
|
||||||
|
log "Git config: $git_name <$git_email>"
|
||||||
|
|
||||||
git config --global user.name "$git_name"
|
git config --global user.name "$git_name"
|
||||||
git config --global user.email "$git_email"
|
git config --global user.email "$git_email"
|
||||||
@@ -774,6 +871,7 @@ set_default_shell() {
|
|||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
setup_logging
|
||||||
print_header
|
print_header
|
||||||
|
|
||||||
echo -e "${BOLD}Este script instalará:${NC}"
|
echo -e "${BOLD}Este script instalará:${NC}"
|
||||||
@@ -813,8 +911,15 @@ main() {
|
|||||||
set_default_shell
|
set_default_shell
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
log "==================================================================="
|
||||||
|
log "INSTALACIÓN COMPLETADA - $(date '+%Y-%m-%d %H:%M:%S')"
|
||||||
|
log "==================================================================="
|
||||||
echo -e "${GREEN}✓✓✓ Instalación completada ✓✓✓${NC}"
|
echo -e "${GREEN}✓✓✓ Instalación completada ✓✓✓${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo -e "${CYAN}📋 Logs guardados en:${NC}"
|
||||||
|
echo -e " ${BOLD}$LOG_FILE${NC}"
|
||||||
|
echo -e " ${BOLD}$ERROR_LOG${NC}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
if [ "$NEEDS_REBOOT" = true ]; then
|
if [ "$NEEDS_REBOOT" = true ]; then
|
||||||
echo -e "${YELLOW}╔════════════════════════════════════════════╗${NC}"
|
echo -e "${YELLOW}╔════════════════════════════════════════════╗${NC}"
|
||||||
@@ -833,12 +938,12 @@ main() {
|
|||||||
sleep 3
|
sleep 3
|
||||||
sudo reboot
|
sudo reboot
|
||||||
else
|
else
|
||||||
warning "Recuerda reiniciar manualmente para aplicar todos los cambios"
|
warning "Recuerda reiniciar manualmente"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${CYAN}Próximos pasos:${NC}"
|
echo -e "${CYAN}Próximos pasos:${NC}"
|
||||||
echo " 1. Cierra esta terminal"
|
echo " 1. Cierra esta terminal"
|
||||||
echo " 2. Abre una nueva terminal"
|
echo " 2. Abre una nueva"
|
||||||
echo " 3. Ejecuta: source ~/.zshrc"
|
echo " 3. Ejecuta: source ~/.zshrc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user