mirror of
https://github.com/marcogll/omarchy_setup.git
synced 2026-01-13 13:25:16 +00:00
Initial commit of Zsh setup files
This commit is contained in:
395
.zshrc
Normal file
395
.zshrc
Normal file
@@ -0,0 +1,395 @@
|
|||||||
|
# =============================================================================
|
||||||
|
# CONFIGURACIÓN ZSH - OMARCHY v2.1
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
# --- PATH --------------------------------------------------------------------
|
||||||
|
typeset -U PATH path
|
||||||
|
path=(
|
||||||
|
$HOME/.local/bin
|
||||||
|
$HOME/bin
|
||||||
|
$HOME/.npm-global/bin
|
||||||
|
$HOME/AppImages
|
||||||
|
$HOME/go/bin
|
||||||
|
$path
|
||||||
|
)
|
||||||
|
|
||||||
|
# --- Oh My Zsh ---------------------------------------------------------------
|
||||||
|
export ZSH="$HOME/.oh-my-zsh"
|
||||||
|
ZSH_THEME="" # Oh My Posh manejará el prompt, así que el tema de OMZ queda vacío.
|
||||||
|
|
||||||
|
plugins=(
|
||||||
|
git sudo history colorize
|
||||||
|
docker docker-compose
|
||||||
|
npm node python pip golang
|
||||||
|
copypath copyfile
|
||||||
|
# Si usas zoxide, no lo añadas aquí, se inicializa más abajo
|
||||||
|
)
|
||||||
|
|
||||||
|
export ZSH_DISABLE_COMPFIX=true
|
||||||
|
zstyle ':completion::complete:*' use-cache on
|
||||||
|
zstyle ':completion::complete:*' cache-path "$HOME/.zcompcache"
|
||||||
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
||||||
|
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||||
|
zstyle ':completion:*' menu select
|
||||||
|
|
||||||
|
# Cargar Oh My Zsh
|
||||||
|
[ -r "$ZSH/oh-my-zsh.sh" ] && source "$ZSH/oh-my-zsh.sh"
|
||||||
|
|
||||||
|
# Cargar plugins específicos (zsh-autosuggestions y zsh-syntax-highlighting)
|
||||||
|
[ -r "${ZSH_CUSTOM:-$ZSH/custom}/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" ] && \
|
||||||
|
source "${ZSH_CUSTOM:-$ZSH/custom}/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
||||||
|
|
||||||
|
[ -r "${ZSH_CUSTOM:-$ZSH/custom}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ] && \
|
||||||
|
source "${ZSH_CUSTOM:-$ZSH/custom}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||||
|
|
||||||
|
# --- Oh My Posh --------------------------------------------------------------
|
||||||
|
# Asegúrate de que Oh My Posh esté instalado y el tema 'catppuccin.omp.json'
|
||||||
|
# esté en ~/.poshthemes/
|
||||||
|
if command -v oh-my-posh >/dev/null 2>&1; then
|
||||||
|
if [ -f ~/.poshthemes/catppuccin.omp.json ]; then
|
||||||
|
eval "$(oh-my-posh init zsh --config ~/.poshthemes/catppuccin.omp.json)"
|
||||||
|
else
|
||||||
|
# Fallback si el tema Catppuccin no se encuentra
|
||||||
|
eval "$(oh-my-posh init zsh)"
|
||||||
|
echo "Advertencia: Tema Catppuccin para Oh My Posh no encontrado en ~/.poshthemes/. Usando el tema por defecto."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- Go ----------------------------------------------------------------------
|
||||||
|
export GOPATH="$HOME/go"
|
||||||
|
export GOBIN="$GOPATH/bin"
|
||||||
|
|
||||||
|
# --- NVM ---------------------------------------------------------------------
|
||||||
|
# Es importante que NVM se cargue después de la configuración de PATH,
|
||||||
|
# pero antes de que intentes usar 'node' o 'npm'.
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # Esto carga nvm
|
||||||
|
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # Esto carga nvm bash_completion
|
||||||
|
|
||||||
|
# --- Python ------------------------------------------------------------------
|
||||||
|
alias pip='pip3'
|
||||||
|
alias python='python3'
|
||||||
|
|
||||||
|
venv() {
|
||||||
|
case "$1" in
|
||||||
|
create) python -m venv .venv && echo "✅ Entorno virtual creado en ./.venv" ;;
|
||||||
|
on|activate)
|
||||||
|
if [ -f ".venv/bin/activate" ]; then
|
||||||
|
. .venv/bin/activate
|
||||||
|
echo "🟢 Entorno virtual activado"
|
||||||
|
else
|
||||||
|
echo "❌ Entorno virtual no encontrado en ./.venv"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
off|deactivate)
|
||||||
|
if command -v deactivate &>/dev/null; then
|
||||||
|
deactivate 2>/dev/null
|
||||||
|
echo "🔴 Entorno virtual desactivado"
|
||||||
|
else
|
||||||
|
echo "🤷 No hay un entorno virtual activo para desactivar"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*) echo "Uso: venv [create|on|off|activate|deactivate]" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# --- Aliases -----------------------------------------------------------------
|
||||||
|
alias cls='clear'
|
||||||
|
alias ll='ls -alF'
|
||||||
|
alias la='ls -A'
|
||||||
|
alias l='ls -CF'
|
||||||
|
alias ..='cd ..'
|
||||||
|
alias ...='cd ../..'
|
||||||
|
alias ....='cd ../../..'
|
||||||
|
|
||||||
|
# System info
|
||||||
|
alias ff='fastfetch' # Requiere fastfetch
|
||||||
|
alias nf='fastfetch' # Requiere fastfetch
|
||||||
|
|
||||||
|
# Arch Linux (si aplica)
|
||||||
|
alias pacu='sudo pacman -Syu'
|
||||||
|
alias paci='sudo pacman -S'
|
||||||
|
alias pacr='sudo pacman -Rns'
|
||||||
|
alias pacs='pacman -Ss'
|
||||||
|
alias yayu='yay -Syu' # Requiere yay AUR helper
|
||||||
|
alias yayi='yay -S' # Requiere yay AUR helper
|
||||||
|
|
||||||
|
# Git
|
||||||
|
alias gs='git status'
|
||||||
|
alias ga='git add'
|
||||||
|
alias gc='git commit'
|
||||||
|
alias gcm='git commit -m'
|
||||||
|
alias gp='git push'
|
||||||
|
alias gl='git pull'
|
||||||
|
alias gd='git diff'
|
||||||
|
alias gb='git branch'
|
||||||
|
alias gco='git checkout'
|
||||||
|
alias gcb='git checkout -b'
|
||||||
|
alias glog='git log --oneline --graph --decorate'
|
||||||
|
gac(){ git add . && git commit -m "$1"; }
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
# Detecta si se usa 'docker compose' o 'docker-compose'
|
||||||
|
docker compose version >/dev/null 2>&1 && alias dc='docker compose' || alias dc='docker-compose'
|
||||||
|
alias d='docker'
|
||||||
|
alias dps='docker ps -a'
|
||||||
|
alias di='docker images'
|
||||||
|
alias dex='docker exec -it'
|
||||||
|
alias dlog='docker logs -f'
|
||||||
|
|
||||||
|
# NPM
|
||||||
|
alias nrs='npm run start'
|
||||||
|
alias nrd='npm run dev'
|
||||||
|
alias nrb='npm run build'
|
||||||
|
alias nrt='npm run test'
|
||||||
|
alias ni='npm install'
|
||||||
|
alias nid='npm install --save-dev'
|
||||||
|
alias nig='npm install -g'
|
||||||
|
|
||||||
|
# Python
|
||||||
|
alias py='python'
|
||||||
|
alias pir='pip install -r requirements.txt'
|
||||||
|
alias pipi='pip install'
|
||||||
|
alias pipf='pip freeze > requirements.txt'
|
||||||
|
|
||||||
|
# ZeroTier
|
||||||
|
alias zt='sudo zerotier-cli'
|
||||||
|
alias ztstatus='sudo zerotier-cli listnetworks'
|
||||||
|
alias ztinfo='sudo zerotier-cli info'
|
||||||
|
|
||||||
|
# Clima (requiere curl)
|
||||||
|
alias clima='curl wttr.in/Saltillo'
|
||||||
|
|
||||||
|
# --- Funciones ---------------------------------------------------------------
|
||||||
|
mkcd(){ mkdir -p "$1" && cd "$1"; }
|
||||||
|
|
||||||
|
extract(){
|
||||||
|
[ ! -f "$1" ] && echo "No es un archivo" && return 1
|
||||||
|
case "$1" in
|
||||||
|
*.tar.bz2) tar xjf "$1" ;;
|
||||||
|
*.tar.gz) tar xzf "$1" ;;
|
||||||
|
*.bz2) bunzip2 "$1" ;;
|
||||||
|
*.rar) unrar e "$1" ;; # Requiere 'unrar'
|
||||||
|
*.gz) gunzip "$1" ;;
|
||||||
|
*.tar) tar xf "$1" ;;
|
||||||
|
*.tbz2) tar xjf "$1" ;;
|
||||||
|
*.tgz) tar xzf "$1" ;;
|
||||||
|
*.zip) unzip "$1" ;;
|
||||||
|
*.Z) uncompress "$1" ;;
|
||||||
|
*.7z) 7z x "$1" ;; # Requiere '7zip'
|
||||||
|
*) echo "No se puede extraer '$1': formato no reconocido o herramienta no instalada." ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
killport(){
|
||||||
|
[ $# -eq 0 ] && echo "Uso: killport <puerto>" && return 1
|
||||||
|
local pid=$(lsof -ti:"$1" 2>/dev/null) # Requiere 'lsof'
|
||||||
|
[ -n "$pid" ] && kill -9 "$pid" && echo "✅ Proceso en puerto $1 eliminado (PID: $pid)" || echo "🤷 No se encontró ningún proceso en el puerto $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
serve(){ python -m http.server "${1:-8000}"; }
|
||||||
|
|
||||||
|
# --- yt-dlp MEJORADO ---------------------------------------------------------
|
||||||
|
# Requiere yt-dlp instalado
|
||||||
|
export YTDLP_DIR="$HOME/Videos/YouTube"
|
||||||
|
mkdir -p "$YTDLP_DIR"/{Music,Videos} 2>/dev/null # Crear directorios si no existen
|
||||||
|
|
||||||
|
ytm() {
|
||||||
|
case "$1" in
|
||||||
|
-h|--help|'')
|
||||||
|
echo "🎵 ytm <URL|búsqueda> - Descarga audio (MP3 320kbps) a $YTDLP_DIR/Music/"
|
||||||
|
echo "Ejemplos:"
|
||||||
|
echo " ytm https://youtu.be/dQw4w9WgXcQ"
|
||||||
|
echo " ytm 'Never Gonna Give You Up'"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if ! command -v yt-dlp &>/dev/null; then
|
||||||
|
echo "❌ yt-dlp no está instalado. Por favor, instálalo para usar esta función."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local out="$YTDLP_DIR/Music/%(title).180s.%(ext)s"
|
||||||
|
local opts=(
|
||||||
|
--extract-audio --audio-format mp3 --audio-quality 320K
|
||||||
|
--embed-metadata --embed-thumbnail --convert-thumbnails jpg
|
||||||
|
--no-playlist --retries 10 --fragment-retries 10
|
||||||
|
--user-agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36"
|
||||||
|
--extractor-args "youtube:player_client=android,web"
|
||||||
|
--progress --newline -o "$out"
|
||||||
|
)
|
||||||
|
|
||||||
|
if [[ "$1" == http* ]]; then
|
||||||
|
echo "📥 Descargando audio..."
|
||||||
|
yt-dlp "${opts[@]}" "$@"
|
||||||
|
else
|
||||||
|
echo "🔍 Buscando: $*"
|
||||||
|
yt-dlp "${opts[@]}" "ytsearch1:$*"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ $? -eq 0 ] && echo "✅ Audio descargado en: $YTDLP_DIR/Music/" || echo "❌ Falló la descarga de audio."
|
||||||
|
}
|
||||||
|
|
||||||
|
ytv() {
|
||||||
|
case "$1" in
|
||||||
|
-h|--help|'')
|
||||||
|
echo "🎬 ytv <URL|búsqueda> [calidad] - Descarga video a $YTDLP_DIR/Videos/"
|
||||||
|
echo "Calidades disponibles: 1080, 720, 480 (por defecto: mejor disponible MP4)"
|
||||||
|
echo "Ejemplos:"
|
||||||
|
echo " ytv https://youtu.be/dQw4w9WgXcQ 1080"
|
||||||
|
echo " ytv 'Rick Astley - Never Gonna Give You Up' 720"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if ! command -v yt-dlp &>/dev/null; then
|
||||||
|
echo "❌ yt-dlp no está instalado. Por favor, instálalo para usar esta función."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local quality="${2:-best}"
|
||||||
|
local out="$YTDLP_DIR/Videos/%(title).180s.%(ext)s"
|
||||||
|
|
||||||
|
local fmt
|
||||||
|
case "$quality" in
|
||||||
|
1080) fmt='bv*[height<=1080][ext=mp4]+ba/b[height<=1080]' ;;
|
||||||
|
720) fmt='bv*[height<=720][ext=mp4]+ba/b[height<=720]' ;;
|
||||||
|
480) fmt='bv*[height<=480][ext=mp4]+ba/b[height<=480]' ;;
|
||||||
|
*) fmt='bv*[ext=mp4]+ba/b[ext=mp4]/b' ;; # Mejor calidad MP4
|
||||||
|
esac
|
||||||
|
|
||||||
|
local opts=(
|
||||||
|
-f "$fmt" --embed-metadata --embed-thumbnail
|
||||||
|
--embed-subs --sub-langs "es.*,en.*" --convert-thumbnails jpg
|
||||||
|
--no-playlist --retries 10 --fragment-retries 10
|
||||||
|
--user-agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36"
|
||||||
|
--extractor-args "youtube:player_client=android,web"
|
||||||
|
--progress --newline -o "$out"
|
||||||
|
)
|
||||||
|
|
||||||
|
if [[ "$1" == http* ]]; then
|
||||||
|
echo "📥 Descargando video..."
|
||||||
|
yt-dlp "${opts[@]}" "$1"
|
||||||
|
else
|
||||||
|
echo "🔍 Buscando: $1"
|
||||||
|
yt-dlp "${opts[@]}" "ytsearch1:$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ $? -eq 0 ] && echo "✅ Video descargado en: $YTDLP_DIR/Videos/" || echo "❌ Falló la descarga de video."
|
||||||
|
}
|
||||||
|
|
||||||
|
ytls() {
|
||||||
|
echo "🎵 Últimos 5 audios descargados en Music:"
|
||||||
|
ls -1t "$YTDLP_DIR/Music" 2>/dev/null | head -5 | sed 's/^/ /' || echo " (vacío)"
|
||||||
|
echo ""
|
||||||
|
echo "🎬 Últimos 5 videos descargados en Videos:"
|
||||||
|
ls -1t "$YTDLP_DIR/Videos" 2>/dev/null | head -5 | sed 's/^/ /' || echo " (vacío)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# --- GNOME Keyring -----------------------------------------------------------
|
||||||
|
# Iniciar gnome-keyring-daemon si la sesión es gráfica y no está corriendo
|
||||||
|
if [ -n "$DESKTOP_SESSION" ]; then
|
||||||
|
if ! pgrep -u "$USER" gnome-keyring-daemon > /dev/null 2>&1; then
|
||||||
|
eval $(gnome-keyring-daemon --start --components=pkcs11,secrets,ssh 2>/dev/null)
|
||||||
|
fi
|
||||||
|
export SSH_AUTH_SOCK GPG_AGENT_INFO GNOME_KEYRING_CONTROL GNOME_KEYRING_PID
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- SSH Agent ---------------------------------------------------------------
|
||||||
|
# Iniciar ssh-agent si no está corriendo y manejar las llaves SSH
|
||||||
|
if [ -z "$SSH_AUTH_SOCK" ]; then
|
||||||
|
export SSH_AGENT_DIR="$HOME/.ssh/agent"
|
||||||
|
mkdir -p "$SSH_AGENT_DIR"
|
||||||
|
SSH_ENV="$SSH_AGENT_DIR/env"
|
||||||
|
|
||||||
|
start_agent() {
|
||||||
|
echo "🔑 Iniciando ssh-agent..."
|
||||||
|
ssh-agent > "$SSH_ENV"
|
||||||
|
chmod 600 "$SSH_ENV"
|
||||||
|
. "$SSH_ENV" > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -f "$SSH_ENV" ]; then
|
||||||
|
. "$SSH_ENV" > /dev/null
|
||||||
|
ps -p $SSH_AGENT_PID > /dev/null 2>&1 || start_agent
|
||||||
|
else
|
||||||
|
start_agent
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "$HOME/.ssh" ]; then
|
||||||
|
for key in "$HOME/.ssh"/*; do
|
||||||
|
if [ -f "$key" ] && [[ ! "$key" =~ \.pub$ ]] && \
|
||||||
|
[[ ! "$key" =~ known_hosts ]] && [[ ! "$key" =~ authorized_keys ]] && \
|
||||||
|
[[ ! "$key" =~ config ]] && [[ ! "$key" =~ agent ]]; then
|
||||||
|
if ssh-keygen -l -f "$key" &>/dev/null; then
|
||||||
|
local key_fingerprint=$(ssh-keygen -lf "$key" 2>/dev/null | awk '{print $2}')
|
||||||
|
if ! ssh-add -l 2>/dev/null | grep -q "$key_fingerprint"; then
|
||||||
|
if ssh-add "$key" 2>/dev/null; then
|
||||||
|
echo "✅ Llave SSH agregada: $(basename $key)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Alias útiles para SSH
|
||||||
|
alias ssh-list='ssh-add -l' # Listar llaves cargadas
|
||||||
|
alias ssh-clear='ssh-add -D' # Limpiar todas las llaves
|
||||||
|
alias ssh-reload=' # Recargar todas las llaves
|
||||||
|
ssh-add -D 2>/dev/null
|
||||||
|
for key in ~/.ssh/*; do
|
||||||
|
if [ -f "$key" ] && [[ ! "$key" =~ \.pub$ ]] && ssh-keygen -l -f "$key" &>/dev/null; then
|
||||||
|
ssh-add "$key" 2>/dev/null && echo "✅ $(basename $key)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
'
|
||||||
|
|
||||||
|
alias ssh-github='ssh -T git@github.com' # Test GitHub connection
|
||||||
|
|
||||||
|
# --- zoxide ------------------------------------------------------------------
|
||||||
|
# Reemplazo inteligente de cd (requiere zoxide)
|
||||||
|
if command -v zoxide >/dev/null 2>&1; then
|
||||||
|
eval "$(zoxide init zsh)"
|
||||||
|
|
||||||
|
# Alias para compatibilidad con el comportamiento tradicional
|
||||||
|
alias cd='z'
|
||||||
|
alias cdi='zi' # Interactive mode
|
||||||
|
alias zz='z -' # Ir al directorio anterior
|
||||||
|
else
|
||||||
|
echo "Advertencia: zoxide no está instalado. Instálalo para usar 'z', 'zi', 'zz'."
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# --- Historial de Zsh --------------------------------------------------------
|
||||||
|
HISTSIZE=100000 # Número de comandos guardados en el historial en RAM
|
||||||
|
SAVEHIST=100000 # Número de comandos guardados en el archivo de historial
|
||||||
|
HISTFILE=~/.zsh_history # Archivo donde se guarda el historial
|
||||||
|
setopt APPEND_HISTORY # Añadir nuevos comandos al archivo de historial
|
||||||
|
setopt SHARE_HISTORY # Compartir historial entre sesiones de Zsh
|
||||||
|
setopt HIST_IGNORE_DUPS # No guardar comandos duplicados consecutivamente
|
||||||
|
setopt HIST_IGNORE_ALL_DUPS # No guardar comandos duplicados en el historial
|
||||||
|
setopt HIST_IGNORE_SPACE # No guardar comandos que comienzan con espacio
|
||||||
|
setopt AUTO_CD # Si se introduce un directorio, cambiar a él
|
||||||
|
setopt EXTENDED_GLOB # Habilitar características de expansión de comodines extendidas
|
||||||
|
|
||||||
|
stty -ixon 2>/dev/null # Deshabilita CTRL+S (pause) y CTRL+Q (resume)
|
||||||
|
|
||||||
|
export LESS='-R' # Habilita colores en man pages y less
|
||||||
|
|
||||||
|
# --- Funciones externas ------------------------------------------------------
|
||||||
|
# Cargar cualquier archivo .zsh que se encuentre en ~/.zsh_functions/
|
||||||
|
[ -d "$HOME/.zsh_functions" ] || mkdir -p "$HOME/.zsh_functions"
|
||||||
|
for func_file in "$HOME/.zsh_functions"/*.zsh(N); do
|
||||||
|
source "$func_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
# --- Local Overrides ---------------------------------------------------------
|
||||||
|
# Permite tener un archivo ~/.zshrc.local para configuraciones personales
|
||||||
|
# sin modificar el archivo principal. Este archivo se cargará al final.
|
||||||
|
[ -f ~/.zshrc.local ] && source ~/.zshrc.local
|
||||||
|
|
||||||
|
# Mensaje de bienvenida (opcional, puedes borrarlo)
|
||||||
|
#echo "🌈 Zsh está configurado con Catppuccin Frappe. ¡Disfruta!"
|
||||||
714
Readme.md
Normal file
714
Readme.md
Normal file
@@ -0,0 +1,714 @@
|
|||||||
|
# 🚀 Omarchy Setup Script v3.0.0
|
||||||
|
|
||||||
|
Script de instalación y configuración **modular** para **Arch Linux / Omarchy** con menú interactivo.
|
||||||
|
|
||||||
|
## 🎯 Características Principales
|
||||||
|
|
||||||
|
- **✅ Estructura Modular**: Scripts independientes para cada componente
|
||||||
|
- **🎨 Menú Interactivo**: Selecciona qué instalar según tus necesidades
|
||||||
|
- **🎨 Interfaz Mejorada**: Colores y mensajes claros durante la instalación
|
||||||
|
- **🔧 Fácil de Extender**: Agrega nuevos módulos fácilmente
|
||||||
|
|
||||||
|
## ⚡ Instalación rápida
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clonar el repositorio
|
||||||
|
git clone https://github.com/marcogll/scripts_mg.git
|
||||||
|
cd scripts_mg/omarchy_zsh_setup
|
||||||
|
|
||||||
|
# Ejecutar el script maestro
|
||||||
|
./omarchy-setup.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📦 Estructura Modular
|
||||||
|
|
||||||
|
```
|
||||||
|
omarchy_zsh_setup/
|
||||||
|
├── omarchy-setup.sh # Script maestro con menú interactivo
|
||||||
|
├── modules/
|
||||||
|
│ ├── common.sh # Funciones comunes (colores, logging, etc.)
|
||||||
|
│ ├── apps.sh # Instalación de aplicaciones
|
||||||
|
│ ├── zsh-config.sh # Configuración de Zsh
|
||||||
|
│ ├── docker.sh # Docker y Portainer
|
||||||
|
│ ├── zerotier.sh # ZeroTier VPN
|
||||||
|
│ ├── printer.sh # Configuración de impresoras (CUPS)
|
||||||
|
│ └── davinci-resolve.sh # DaVinci Resolve (Intel Edition)
|
||||||
|
└── Readme.md
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🎮 Uso del Menú Interactivo
|
||||||
|
|
||||||
|
Al ejecutar `./omarchy-setup.sh`, verás un menú con las siguientes opciones:
|
||||||
|
|
||||||
|
```
|
||||||
|
╔════════════════════════════════════════════════════════════╗
|
||||||
|
║ 🌀 Omarchy Setup Script — Configuración Modular ║
|
||||||
|
╚════════════════════════════════════════════════════════════╝
|
||||||
|
|
||||||
|
Selecciona las opciones que deseas instalar:
|
||||||
|
|
||||||
|
1) 📦 Instalar Aplicaciones (VS Code, Cursor, VLC, herramientas)
|
||||||
|
2) 🐚 Configurar Zsh (shell, plugins, configuración personalizada)
|
||||||
|
3) 🐳 Instalar Docker y Portainer
|
||||||
|
4) 🌐 Instalar ZeroTier
|
||||||
|
5) 🖨️ Configurar Impresoras (CUPS)
|
||||||
|
6) 🎬 Instalar DaVinci Resolve (Intel Edition)
|
||||||
|
7) 🔄 Actualizar Sistema
|
||||||
|
8) 🧹 Limpiar Paquetes Huérfanos
|
||||||
|
9) ✅ Instalar Todo (opciones 1-5)
|
||||||
|
0) 🚪 Salir
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📋 Módulos Disponibles
|
||||||
|
|
||||||
|
### 1. 📦 Aplicaciones (`apps.sh`)
|
||||||
|
- Herramientas base (git, curl, wget, etc.)
|
||||||
|
- VS Code
|
||||||
|
- Cursor (desde AUR)
|
||||||
|
- VLC y plugins multimedia
|
||||||
|
- Herramientas de desarrollo
|
||||||
|
- Configuración de VLC como reproductor predeterminado
|
||||||
|
|
||||||
|
### 2. 🐚 Zsh (`zsh-config.sh`)
|
||||||
|
- Instalación de Zsh y plugins
|
||||||
|
- Descarga de configuración `.zshrc` desde GitHub
|
||||||
|
- Configuración como shell predeterminada
|
||||||
|
- Plugins: syntax-highlighting, autosuggestions
|
||||||
|
|
||||||
|
### 3. 🐳 Docker (`docker.sh`)
|
||||||
|
- Instalación de Docker y Docker Compose
|
||||||
|
- Configuración de servicios
|
||||||
|
- Instalación de Portainer
|
||||||
|
- Agregar usuario al grupo docker
|
||||||
|
|
||||||
|
### 4. 🌐 ZeroTier (`zerotier.sh`)
|
||||||
|
- Instalación de ZeroTier One
|
||||||
|
- Configuración de servicio
|
||||||
|
- Instrucciones para unirse a redes
|
||||||
|
|
||||||
|
### 5. 🖨️ Impresoras (`printer.sh`)
|
||||||
|
- Instalación de CUPS
|
||||||
|
- Drivers comunes de impresora
|
||||||
|
- Configuración de servicios
|
||||||
|
- Interfaz web en http://localhost:631
|
||||||
|
|
||||||
|
### 6. 🎬 DaVinci Resolve (`davinci-resolve.sh`)
|
||||||
|
- Instalación de DaVinci Resolve para Intel GPU
|
||||||
|
- Configuración de OpenCL
|
||||||
|
- Requiere ZIP de instalación en `~/Downloads`
|
||||||
|
- Configuración de librerías y wrapper
|
||||||
|
|
||||||
|
## 🔧 Ejecutar Módulos Individualmente
|
||||||
|
|
||||||
|
Cada módulo puede ejecutarse de forma independiente:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Instalar solo aplicaciones
|
||||||
|
./modules/apps.sh
|
||||||
|
|
||||||
|
# Configurar solo Zsh
|
||||||
|
./modules/zsh-config.sh
|
||||||
|
|
||||||
|
# Instalar Docker
|
||||||
|
./modules/docker.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🌐 Instalación desde URL
|
||||||
|
|
||||||
|
**Nota**: El script requiere que los módulos estén presentes localmente. Se recomienda clonar el repositorio completo.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clonar repositorio
|
||||||
|
git clone https://github.com/marcogll/scripts_mg.git
|
||||||
|
cd scripts_mg/omarchy_zsh_setup
|
||||||
|
./omarchy-setup.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✨ Características de los Módulos
|
||||||
|
|
||||||
|
### 📦 Aplicaciones
|
||||||
|
- **Herramientas base**: git, curl, wget, base-devel, stow
|
||||||
|
- **Editores**:
|
||||||
|
- VS Code (desde AUR: visual-studio-code-bin)
|
||||||
|
- Cursor (desde AUR: cursor-bin)
|
||||||
|
- **Multimedia**:
|
||||||
|
- VLC con todos los plugins (vlc-plugins-all)
|
||||||
|
- Audacity (editor de audio)
|
||||||
|
- Inkscape (editor gráfico vectorial)
|
||||||
|
- ffmpeg, gstreamer con plugins
|
||||||
|
- yt-dlp (descarga de videos)
|
||||||
|
- **Red y transferencia**:
|
||||||
|
- FileZilla (cliente FTP)
|
||||||
|
- Telegram Desktop
|
||||||
|
- scrcpy (control Android desde PC)
|
||||||
|
- **Utilidades**: neofetch, htop, fastfetch, btop, vim, nano, tmux
|
||||||
|
- **Flatpak**: Sistema de paquetes universal
|
||||||
|
- **Drivers Intel Iris Xe**:
|
||||||
|
- Mesa y Vulkan (gráficos 3D)
|
||||||
|
- Intel Media Driver (aceleración de video VA-API)
|
||||||
|
- OpenCL (Intel Compute Runtime desde AUR)
|
||||||
|
- Codecs y herramientas de hardware acceleration
|
||||||
|
- **Desde AUR**:
|
||||||
|
- keyd (remapeo de teclado)
|
||||||
|
- fragments (cliente BitTorrent)
|
||||||
|
- logiops (driver Logitech)
|
||||||
|
- ltunify (Logitech Unifying Receiver)
|
||||||
|
- TeamViewer (acceso remoto, con daemon habilitado)
|
||||||
|
- intel-compute-runtime (OpenCL para Intel)
|
||||||
|
|
||||||
|
### 🐚 Zsh
|
||||||
|
- Shell Zsh con plugins (syntax-highlighting, autosuggestions)
|
||||||
|
- Configuración personalizada desde GitHub
|
||||||
|
- Configuración como shell predeterminada
|
||||||
|
|
||||||
|
### 🐳 Docker
|
||||||
|
- Docker y Docker Compose
|
||||||
|
- Portainer (interfaz web de gestión)
|
||||||
|
- Usuario agregado al grupo docker
|
||||||
|
- Servicios habilitados y configurados
|
||||||
|
|
||||||
|
### 🌐 ZeroTier
|
||||||
|
- ZeroTier One VPN
|
||||||
|
- Servicio configurado y habilitado
|
||||||
|
- Instrucciones para unirse a redes
|
||||||
|
|
||||||
|
### 🖨️ Impresoras
|
||||||
|
- CUPS (Common Unix Printing System)
|
||||||
|
- Drivers comunes de impresora
|
||||||
|
- Interfaz web en http://localhost:631
|
||||||
|
- Soporte para impresoras de red
|
||||||
|
|
||||||
|
### 🎬 DaVinci Resolve
|
||||||
|
- Instalación para Intel GPU
|
||||||
|
- Configuración de OpenCL
|
||||||
|
- Ajuste de librerías del sistema
|
||||||
|
- Wrapper para ejecución
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 Paquetes instalados
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Ver lista completa (click para expandir)</summary>
|
||||||
|
|
||||||
|
### Sistema Base
|
||||||
|
- **zsh**, **zsh-completions**
|
||||||
|
- **oh-my-posh-bin** (desde AUR)
|
||||||
|
- **git**, **curl**, **wget**
|
||||||
|
- **yay** (AUR helper, compilado desde AUR)
|
||||||
|
|
||||||
|
### Desarrollo
|
||||||
|
- **python**, **python-pip**, **python-virtualenv**
|
||||||
|
- **nodejs**, **npm**
|
||||||
|
- **go** (Golang)
|
||||||
|
- **docker**, **docker-compose**
|
||||||
|
- **base-devel** (herramientas de compilación)
|
||||||
|
|
||||||
|
### Utilidades de Terminal
|
||||||
|
- **eza** (ls mejorado)
|
||||||
|
- **bat** (cat mejorado)
|
||||||
|
- **zoxide** (cd inteligente)
|
||||||
|
- **fastfetch** (info del sistema)
|
||||||
|
- **htop**, **btop** (monitores del sistema)
|
||||||
|
- **tree** (visualización de directorios)
|
||||||
|
|
||||||
|
### Multimedia y Control
|
||||||
|
- **yt-dlp**, **ffmpeg**
|
||||||
|
- **playerctl**, **brightnessctl**, **pamixer**
|
||||||
|
- **audacity**, **inkscape**
|
||||||
|
|
||||||
|
### Red y Seguridad
|
||||||
|
- **zerotier-one** (desde AUR)
|
||||||
|
- **gnome-keyring**, **libsecret**, **seahorse**
|
||||||
|
- **lsof**, **net-tools**
|
||||||
|
- **teamviewer**
|
||||||
|
|
||||||
|
### Utilidades del Sistema
|
||||||
|
- **nano**, **unzip**, **tar**
|
||||||
|
- **p7zip**, **unrar**
|
||||||
|
|
||||||
|
### Instalaciones Adicionales
|
||||||
|
- **speedtest-cli** (vía pip)
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎯 Durante la instalación
|
||||||
|
|
||||||
|
El script ejecuta los siguientes pasos:
|
||||||
|
|
||||||
|
1. **Verificación de requerimientos** (root, Arch Linux, conexión a Internet)
|
||||||
|
2. **Instalación de paquetes base** desde repositorios oficiales
|
||||||
|
3. **Instalación de yay** desde AUR (si no está instalado)
|
||||||
|
4. **Configuración de Docker** (servicio y permisos de usuario)
|
||||||
|
5. **Instalación de Oh My Zsh y plugins**
|
||||||
|
6. **Configuración de .zshrc y tema Catppuccin** desde GitHub
|
||||||
|
7. **Configuración de TeamViewer** (servicio)
|
||||||
|
8. **Instalación de ZeroTier One** desde AUR (opcional)
|
||||||
|
9. **Configuración de GNOME Keyring** (opcional)
|
||||||
|
10. **Configuración de claves SSH** (opcional)
|
||||||
|
|
||||||
|
### Preguntas interactivas:
|
||||||
|
|
||||||
|
- **ZeroTier Network ID**: Si deseas unirte a una red ZeroTier (opcional)
|
||||||
|
- **GNOME Keyring**: Si deseas configurar el almacén de contraseñas
|
||||||
|
- **Claves SSH**: Si deseas añadir claves SSH existentes al agente
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔑 GNOME Keyring
|
||||||
|
|
||||||
|
El keyring guarda contraseñas de forma segura:
|
||||||
|
- **Git** (credential helper)
|
||||||
|
- **SSH keys** (almacenadas de forma segura)
|
||||||
|
- **Aplicaciones GNOME**
|
||||||
|
|
||||||
|
### Configuración automática:
|
||||||
|
|
||||||
|
El script configura automáticamente:
|
||||||
|
- PAM para auto-desbloqueo del keyring
|
||||||
|
- Inicio automático de gnome-keyring-daemon
|
||||||
|
- Integración con SSH agent
|
||||||
|
|
||||||
|
### Comandos útiles:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Abrir gestor de contraseñas
|
||||||
|
seahorse
|
||||||
|
|
||||||
|
# Ver estado del keyring
|
||||||
|
gnome-keyring-daemon --version
|
||||||
|
|
||||||
|
# Comandos de ZeroTier (aliases en .zshrc)
|
||||||
|
zt # Alias de sudo zerotier-cli
|
||||||
|
ztstatus # Ver redes conectadas (listnetworks)
|
||||||
|
ztinfo # Info del nodo (info)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚙️ Configuración incluida
|
||||||
|
|
||||||
|
### Aliases de Arch Linux
|
||||||
|
```bash
|
||||||
|
pacu # Actualizar sistema
|
||||||
|
paci <pkg> # Instalar paquete
|
||||||
|
pacr <pkg> # Remover paquete
|
||||||
|
pacs <query> # Buscar paquete
|
||||||
|
yayu # Actualizar AUR
|
||||||
|
yayi <pkg> # Instalar desde AUR
|
||||||
|
```
|
||||||
|
|
||||||
|
### Git shortcuts
|
||||||
|
```bash
|
||||||
|
gs # git status
|
||||||
|
ga # git add
|
||||||
|
gc # git commit
|
||||||
|
gcm "msg" # git commit -m
|
||||||
|
gp # git push
|
||||||
|
gl # git pull
|
||||||
|
gco <branch> # git checkout
|
||||||
|
gcb <branch> # git checkout -b
|
||||||
|
glog # git log gráfico
|
||||||
|
gac "msg" # add + commit
|
||||||
|
```
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
```bash
|
||||||
|
dc # docker compose
|
||||||
|
d # docker
|
||||||
|
dps # docker ps -a
|
||||||
|
di # docker images
|
||||||
|
dex <name> sh # docker exec -it
|
||||||
|
dlog <name> # docker logs -f
|
||||||
|
```
|
||||||
|
|
||||||
|
### Python
|
||||||
|
```bash
|
||||||
|
py # python
|
||||||
|
venv create # Crear .venv
|
||||||
|
venv on # Activar
|
||||||
|
venv off # Desactivar
|
||||||
|
pir # pip install -r requirements.txt
|
||||||
|
pipf # pip freeze > requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
### yt-dlp
|
||||||
|
```bash
|
||||||
|
ytm <URL> # Descargar audio MP3 320kbps
|
||||||
|
ytm "lofi beats" # Buscar y descargar
|
||||||
|
ytv <URL> # Descargar video MP4 (calidad por defecto)
|
||||||
|
ytv <URL> 1080 # Descargar video en 1080p
|
||||||
|
ytv <URL> 720 # Descargar video en 720p
|
||||||
|
ytls # Listar últimos descargas
|
||||||
|
```
|
||||||
|
|
||||||
|
Descargas en: `~/Videos/YouTube/{Music,Videos}/`
|
||||||
|
|
||||||
|
### NPM
|
||||||
|
```bash
|
||||||
|
nrs # npm run start
|
||||||
|
nrd # npm run dev
|
||||||
|
nrb # npm run build
|
||||||
|
nrt # npm run test
|
||||||
|
ni # npm install
|
||||||
|
nid # npm install --save-dev
|
||||||
|
nig # npm install -g
|
||||||
|
```
|
||||||
|
|
||||||
|
### Utilidades
|
||||||
|
```bash
|
||||||
|
mkcd <dir> # mkdir + cd
|
||||||
|
extract <file> # Extraer cualquier archivo
|
||||||
|
killport <port> # Matar proceso en puerto
|
||||||
|
serve [port] # Servidor HTTP (default 8000)
|
||||||
|
clima # Ver clima Saltillo
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🌐 ZeroTier Network ID
|
||||||
|
|
||||||
|
Tu Network ID tiene formato: `a0cbf4b62a1234567` (16 caracteres hex)
|
||||||
|
|
||||||
|
### Dónde encontrarlo:
|
||||||
|
1. Ve a https://my.zerotier.com
|
||||||
|
2. Selecciona tu red
|
||||||
|
3. Copia el Network ID
|
||||||
|
|
||||||
|
### Después de la instalación:
|
||||||
|
1. Ve a tu panel de ZeroTier
|
||||||
|
2. Busca el nuevo dispositivo
|
||||||
|
3. **Autorízalo** marcando el checkbox
|
||||||
|
|
||||||
|
### Comandos útiles:
|
||||||
|
```bash
|
||||||
|
# Ver redes
|
||||||
|
ztstatus
|
||||||
|
|
||||||
|
# Unirse a red
|
||||||
|
sudo zerotier-cli join <network-id>
|
||||||
|
|
||||||
|
# Salir de red
|
||||||
|
sudo zerotier-cli leave <network-id>
|
||||||
|
|
||||||
|
# Info del nodo
|
||||||
|
ztinfo
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📂 Estructura creada
|
||||||
|
|
||||||
|
```
|
||||||
|
$HOME/
|
||||||
|
├── .zshrc # Configuración de Zsh (descargado desde GitHub)
|
||||||
|
├── .zshrc.local # Config local (opcional, no creado automáticamente)
|
||||||
|
├── .oh-my-zsh/ # Oh My Zsh
|
||||||
|
│ └── custom/plugins/ # Plugins adicionales
|
||||||
|
│ ├── zsh-autosuggestions/
|
||||||
|
│ └── zsh-syntax-highlighting/
|
||||||
|
├── .poshthemes/ # Temas Oh My Posh
|
||||||
|
│ └── catppuccin.omp.json # Tema Catppuccin Frappe
|
||||||
|
├── .zsh_functions/ # Funciones personalizadas (directorio creado)
|
||||||
|
├── Videos/YouTube/ # Descargas de yt-dlp
|
||||||
|
│ ├── Music/ # Audios MP3
|
||||||
|
│ └── Videos/ # Videos MP4
|
||||||
|
├── .ssh/ # Claves SSH (si existen)
|
||||||
|
└── omarchy-setup.log # Log de instalación
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔄 Después de la instalación
|
||||||
|
|
||||||
|
### 1. Reiniciar sesión o terminal (IMPORTANTE)
|
||||||
|
|
||||||
|
**⚠️ REINICIO REQUERIDO** si se instalaron servicios como TeamViewer o ZeroTier.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Cerrar y volver a abrir la terminal para usar Zsh
|
||||||
|
# O cerrar sesión y volver a entrar para aplicar:
|
||||||
|
# - Cambio de shell a Zsh
|
||||||
|
# - Grupos (docker)
|
||||||
|
# - Permisos del sistema
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Verificar instalación
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Ver versión de Zsh
|
||||||
|
zsh --version
|
||||||
|
|
||||||
|
# Ver tema Oh My Posh
|
||||||
|
oh-my-posh version
|
||||||
|
|
||||||
|
# Verificar Docker
|
||||||
|
docker ps
|
||||||
|
|
||||||
|
# Ver ZeroTier (si se configuró)
|
||||||
|
ztstatus
|
||||||
|
|
||||||
|
# Ver TeamViewer (si se instaló)
|
||||||
|
teamviewer info
|
||||||
|
|
||||||
|
# Actualizar sistema
|
||||||
|
pacu
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Configuraciones opcionales
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Crear archivo de configuración local
|
||||||
|
nano ~/.zshrc.local
|
||||||
|
|
||||||
|
# Ejemplo de contenido:
|
||||||
|
export OPENAI_API_KEY="sk-..."
|
||||||
|
export GITHUB_TOKEN="ghp_..."
|
||||||
|
alias miproyecto="cd ~/Projects/mi-app && code ."
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🛠️ Solución de problemas
|
||||||
|
|
||||||
|
### Docker no funciona sin sudo
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verificar que estás en el grupo docker
|
||||||
|
groups # Debe incluir 'docker'
|
||||||
|
|
||||||
|
# Si no aparece, reinicia sesión o ejecuta:
|
||||||
|
newgrp docker
|
||||||
|
|
||||||
|
# Verificar acceso
|
||||||
|
docker ps
|
||||||
|
```
|
||||||
|
|
||||||
|
### Git sigue pidiendo contraseña
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verificar credential helper
|
||||||
|
git config --global credential.helper
|
||||||
|
|
||||||
|
# Debe ser: libsecret
|
||||||
|
|
||||||
|
# Si no, configurar:
|
||||||
|
git config --global credential.helper libsecret
|
||||||
|
|
||||||
|
# Abrir Seahorse y verificar keyring
|
||||||
|
seahorse
|
||||||
|
|
||||||
|
# Verificar que el keyring está corriendo
|
||||||
|
pgrep -u "$USER" gnome-keyring-daemon
|
||||||
|
```
|
||||||
|
|
||||||
|
### ZeroTier no conecta
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verificar servicio
|
||||||
|
sudo systemctl status zerotier-one
|
||||||
|
|
||||||
|
# Ver logs
|
||||||
|
sudo journalctl -u zerotier-one -f
|
||||||
|
|
||||||
|
# Reiniciar servicio
|
||||||
|
sudo systemctl restart zerotier-one
|
||||||
|
|
||||||
|
# Verificar que autorizaste el nodo en https://my.zerotier.com
|
||||||
|
ztinfo
|
||||||
|
ztstatus
|
||||||
|
```
|
||||||
|
|
||||||
|
### Oh My Posh no se muestra correctamente
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verificar instalación
|
||||||
|
which oh-my-posh
|
||||||
|
oh-my-posh version
|
||||||
|
|
||||||
|
# Verificar que el tema existe
|
||||||
|
ls ~/.poshthemes/catppuccin.omp.json
|
||||||
|
|
||||||
|
# Verificar que tienes una Nerd Font instalada
|
||||||
|
# (El script NO instala fuentes automáticamente)
|
||||||
|
fc-list | grep -i nerd
|
||||||
|
|
||||||
|
# Si no tienes Nerd Font, instala una:
|
||||||
|
# - Nerd Fonts: https://www.nerdfonts.com/
|
||||||
|
```
|
||||||
|
|
||||||
|
### El shell no cambió a Zsh
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verificar shell actual
|
||||||
|
echo $SHELL
|
||||||
|
|
||||||
|
# Cambiar manualmente
|
||||||
|
chsh -s $(which zsh)
|
||||||
|
|
||||||
|
# Cerrar y abrir nueva terminal
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📚 Recursos
|
||||||
|
|
||||||
|
- **Arch Wiki**: https://wiki.archlinux.org/
|
||||||
|
- **Oh My Zsh**: https://ohmyz.sh/
|
||||||
|
- **Oh My Posh**: https://ohmyposh.dev/
|
||||||
|
- **Catppuccin Theme**: https://github.com/catppuccin/catppuccin
|
||||||
|
- **ZeroTier**: https://www.zerotier.com/
|
||||||
|
- **yt-dlp**: https://github.com/yt-dlp/yt-dlp
|
||||||
|
- **Nerd Fonts**: https://www.nerdfonts.com/ (requerido para iconos del prompt)
|
||||||
|
- **yay AUR Helper**: https://github.com/Jguer/yay
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🆘 Soporte
|
||||||
|
|
||||||
|
Si encuentras problemas:
|
||||||
|
|
||||||
|
1. Revisa los mensajes de error durante la instalación
|
||||||
|
2. Verifica que cerraste sesión después de instalar (para aplicar grupos)
|
||||||
|
3. Comprueba que los grupos se aplicaron: `groups`
|
||||||
|
4. Verifica que los módulos están presentes: `ls modules/`
|
||||||
|
5. Ejecuta módulos individualmente para aislar problemas
|
||||||
|
6. Abre un issue en: https://github.com/marcogll/scripts_mg/issues
|
||||||
|
|
||||||
|
### Verificar Instalación de Módulos
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verificar que todos los módulos existen
|
||||||
|
ls -la modules/
|
||||||
|
|
||||||
|
# Ejecutar un módulo individual para debug
|
||||||
|
bash -x modules/apps.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔧 Agregar Nuevos Módulos
|
||||||
|
|
||||||
|
Para agregar un nuevo módulo:
|
||||||
|
|
||||||
|
1. Crea un archivo en `modules/nombre-modulo.sh`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# ===============================================================
|
||||||
|
# nombre-modulo.sh - Descripción del módulo
|
||||||
|
# ===============================================================
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "${SCRIPT_DIR}/common.sh"
|
||||||
|
|
||||||
|
install_nombre_modulo() {
|
||||||
|
log_step "Instalación de Nombre Módulo"
|
||||||
|
|
||||||
|
# Tu código aquí
|
||||||
|
log_info "Instalando paquetes..."
|
||||||
|
sudo pacman -S --noconfirm --needed paquete1 paquete2 || {
|
||||||
|
log_error "Error al instalar paquetes"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
log_success "Módulo instalado correctamente"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ejecutar si se llama directamente
|
||||||
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
|
install_nombre_modulo "$@"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Agrega el módulo al menú en `omarchy-setup.sh`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# En la función show_menu(), agrega:
|
||||||
|
echo -e " ${GREEN}X)${NC} 📦 Descripción del módulo"
|
||||||
|
|
||||||
|
# En el case statement, agrega:
|
||||||
|
X)
|
||||||
|
run_module "nombre-modulo"
|
||||||
|
echo ""
|
||||||
|
read -p "Presiona Enter para continuar..."
|
||||||
|
;;
|
||||||
|
|
||||||
|
# En la función run_module(), agrega:
|
||||||
|
"nombre-modulo")
|
||||||
|
install_nombre_modulo
|
||||||
|
;;
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Si quieres incluirlo en "Instalar Todo", agrégalo al array `modules` en la función `install_all()`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📝 Changelog
|
||||||
|
|
||||||
|
### v3.0.0 (2025-01-XX)
|
||||||
|
- ✨ **Nueva estructura modular**: Scripts independientes para cada componente
|
||||||
|
- 🎨 **Menú interactivo**: Selecciona qué instalar según tus necesidades
|
||||||
|
- 🎨 **Interfaz mejorada**: Colores y mensajes claros durante la instalación
|
||||||
|
- 📦 **Módulos disponibles**:
|
||||||
|
- Aplicaciones (apps.sh)
|
||||||
|
- Zsh (zsh-config.sh)
|
||||||
|
- Docker y Portainer (docker.sh)
|
||||||
|
- ZeroTier (zerotier.sh)
|
||||||
|
- Impresoras CUPS (printer.sh)
|
||||||
|
- DaVinci Resolve (davinci-resolve.sh)
|
||||||
|
- 🔧 **Fácil de extender**: Agrega nuevos módulos fácilmente
|
||||||
|
- 🧹 **Limpieza**: Eliminado archivo duplicado davinci_resolve_intel.sh
|
||||||
|
|
||||||
|
### v2.8.1 (2025-11-02)
|
||||||
|
- Versión unificada con estética Catppuccin
|
||||||
|
- Instalación mejorada de paquetes con manejo de errores robusto
|
||||||
|
- **oh-my-posh** instalado desde AUR automáticamente
|
||||||
|
- Configuración `.zshrc` descargada desde GitHub
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📄 Licencia
|
||||||
|
|
||||||
|
MIT License - Libre de usar y modificar
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 👤 Autor
|
||||||
|
|
||||||
|
**Marco**
|
||||||
|
- GitHub: [@marcogll](https://github.com/marcogll)
|
||||||
|
- Repo: [scripts_mg](https://github.com/marcogll/scripts_mg)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Instalar en una línea
|
||||||
|
bash <(curl -fsSL https://raw.githubusercontent.com/marcogll/scripts_mg/main/omarchy_zsh_setup/omarchy-setup.sh)
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📝 Notas importantes
|
||||||
|
|
||||||
|
- **Módulos locales requeridos**: El script requiere que los módulos estén presentes localmente. Clona el repositorio completo.
|
||||||
|
- **Permisos sudo**: El script requiere permisos de sudo para instalar paquetes y configurar servicios.
|
||||||
|
- **Reinicio recomendado**: Después de instalar servicios (Docker, ZeroTier, CUPS), se recomienda reiniciar o al menos cerrar sesión para aplicar cambios de grupos.
|
||||||
|
- **Shell por defecto**: El módulo de Zsh verificará y cambiará el shell predeterminado si es necesario.
|
||||||
|
- **DaVinci Resolve**: Requiere el ZIP de instalación en `~/Downloads` antes de ejecutar el módulo.
|
||||||
|
|
||||||
|
## 🚀 Próximos Pasos
|
||||||
|
|
||||||
|
1. Ejecuta `./omarchy-setup.sh` para ver el menú interactivo
|
||||||
|
2. Selecciona los módulos que deseas instalar
|
||||||
|
3. Revisa los mensajes durante la instalación
|
||||||
|
4. Reinicia o cierra sesión después de instalar servicios
|
||||||
|
5. Disfruta de tu configuración personalizada
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
🚀 **¡Disfruta tu nuevo setup modular de Omarchy!**
|
||||||
190
modules/apps.sh
Executable file
190
modules/apps.sh
Executable file
@@ -0,0 +1,190 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ===============================================================
|
||||||
|
# apps.sh - Instalación de aplicaciones esenciales
|
||||||
|
# ===============================================================
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "${SCRIPT_DIR}/common.sh"
|
||||||
|
|
||||||
|
install_apps() {
|
||||||
|
log_step "Instalación de Aplicaciones"
|
||||||
|
|
||||||
|
# Paquetes base esenciales
|
||||||
|
log_info "Instalando herramientas base..."
|
||||||
|
sudo pacman -S --noconfirm --needed \
|
||||||
|
git curl wget base-devel unzip \
|
||||||
|
neofetch htop fastfetch btop \
|
||||||
|
vim nano tmux \
|
||||||
|
xdg-utils xdg-user-dirs stow || {
|
||||||
|
log_error "Error al instalar herramientas base"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Aplicaciones multimedia
|
||||||
|
log_info "Instalando aplicaciones multimedia..."
|
||||||
|
sudo pacman -S --noconfirm --needed \
|
||||||
|
vlc vlc-plugins-all libdvdcss \
|
||||||
|
audacity inkscape \
|
||||||
|
ffmpeg gstreamer gst-plugins-good gst-plugins-bad gst-plugins-ugly \
|
||||||
|
yt-dlp || {
|
||||||
|
log_warning "Algunos paquetes multimedia no se pudieron instalar"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Configurar VLC como reproductor predeterminado
|
||||||
|
log_info "Configurando VLC como reproductor predeterminado..."
|
||||||
|
xdg-mime default vlc.desktop audio/mpeg 2>/dev/null || true
|
||||||
|
xdg-mime default vlc.desktop audio/mp4 2>/dev/null || true
|
||||||
|
xdg-mime default vlc.desktop audio/x-wav 2>/dev/null || true
|
||||||
|
xdg-mime default vlc.desktop video/mp4 2>/dev/null || true
|
||||||
|
xdg-mime default vlc.desktop video/x-matroska 2>/dev/null || true
|
||||||
|
xdg-mime default vlc.desktop video/x-msvideo 2>/dev/null || true
|
||||||
|
xdg-mime default vlc.desktop video/x-ms-wmv 2>/dev/null || true
|
||||||
|
xdg-mime default vlc.desktop video/webm 2>/dev/null || true
|
||||||
|
|
||||||
|
# Aplicaciones de red y transferencia de archivos
|
||||||
|
log_info "Instalando aplicaciones de red..."
|
||||||
|
sudo pacman -S --noconfirm --needed \
|
||||||
|
filezilla telegram-desktop scrcpy || {
|
||||||
|
log_warning "Algunos paquetes de red no se pudieron instalar"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Flatpak
|
||||||
|
log_info "Instalando Flatpak..."
|
||||||
|
sudo pacman -S --noconfirm --needed flatpak || {
|
||||||
|
log_warning "Flatpak no se pudo instalar"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Drivers y codecs para Intel Iris Xe
|
||||||
|
log_info "Instalando drivers y codecs para Intel Iris Xe..."
|
||||||
|
|
||||||
|
# Instalar headers del kernel si son necesarios
|
||||||
|
KVER="$(uname -r)"
|
||||||
|
if [[ ! -d "/usr/lib/modules/${KVER}/build" ]]; then
|
||||||
|
log_info "Instalando headers de kernel..."
|
||||||
|
sudo pacman -S --noconfirm --needed linux-headers || {
|
||||||
|
log_warning "No se pudieron instalar headers de kernel"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Drivers de gráficos Intel
|
||||||
|
log_info "Instalando drivers de gráficos Intel..."
|
||||||
|
sudo pacman -S --noconfirm --needed \
|
||||||
|
mesa vulkan-intel \
|
||||||
|
lib32-mesa lib32-vulkan-intel || {
|
||||||
|
log_warning "Algunos drivers de gráficos no se pudieron instalar"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Drivers de video y hardware acceleration
|
||||||
|
log_info "Instalando drivers de video Intel (VA-API/VDPAU)..."
|
||||||
|
sudo pacman -S --noconfirm --needed \
|
||||||
|
intel-media-driver \
|
||||||
|
libva-utils \
|
||||||
|
libvdpau-va-gl \
|
||||||
|
libva-mesa-driver || {
|
||||||
|
log_warning "Algunos drivers de video no se pudieron instalar"
|
||||||
|
}
|
||||||
|
|
||||||
|
# OpenCL para Intel
|
||||||
|
log_info "Instalando soporte OpenCL para Intel..."
|
||||||
|
sudo pacman -S --noconfirm --needed \
|
||||||
|
ocl-icd \
|
||||||
|
libclc \
|
||||||
|
clinfo || {
|
||||||
|
log_warning "Algunos paquetes OpenCL no se pudieron instalar"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Verificar e instalar helper AUR si es necesario
|
||||||
|
AUR_HELPER=$(ensure_aur_helper)
|
||||||
|
|
||||||
|
# Intel Compute Runtime desde AUR (necesario para OpenCL en Intel)
|
||||||
|
log_info "Instalando Intel Compute Runtime desde AUR..."
|
||||||
|
if [ "$AUR_HELPER" = "yay" ]; then
|
||||||
|
yay -S --noconfirm intel-compute-runtime || {
|
||||||
|
log_warning "No se pudo instalar intel-compute-runtime desde AUR"
|
||||||
|
}
|
||||||
|
elif [ "$AUR_HELPER" = "paru" ]; then
|
||||||
|
paru -S --noconfirm intel-compute-runtime || {
|
||||||
|
log_warning "No se pudo instalar intel-compute-runtime desde AUR"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configurar OpenCL para Intel
|
||||||
|
if [[ ! -f /etc/OpenCL/vendors/intel.icd ]] && [[ -f /usr/lib/intel-opencl/libigdrcl.so ]]; then
|
||||||
|
log_info "Configurando OpenCL para Intel..."
|
||||||
|
sudo mkdir -p /etc/OpenCL/vendors
|
||||||
|
echo "/usr/lib/intel-opencl/libigdrcl.so" | sudo tee /etc/OpenCL/vendors/intel.icd >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Actualizar cache de librerías
|
||||||
|
sudo ldconfig || true
|
||||||
|
|
||||||
|
# Verificar instalación de drivers
|
||||||
|
log_info "Verificando drivers Intel instalados..."
|
||||||
|
if command_exists vainfo; then
|
||||||
|
log_info "Información de VA-API:"
|
||||||
|
vainfo 2>/dev/null | head -5 || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command_exists clinfo; then
|
||||||
|
log_info "Información de OpenCL:"
|
||||||
|
clinfo 2>/dev/null | grep -E "Platform Name|Device Name" || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Aplicaciones desde AUR
|
||||||
|
log_info "Instalando aplicaciones desde AUR..."
|
||||||
|
AUR_PACKAGES=(
|
||||||
|
"visual-studio-code-bin"
|
||||||
|
"cursor-bin"
|
||||||
|
"keyd"
|
||||||
|
"fragments"
|
||||||
|
"logiops"
|
||||||
|
"ltunify"
|
||||||
|
"teamviewer"
|
||||||
|
)
|
||||||
|
|
||||||
|
for pkg in "${AUR_PACKAGES[@]}"; do
|
||||||
|
log_info "Instalando ${pkg}..."
|
||||||
|
if [ "$AUR_HELPER" = "yay" ]; then
|
||||||
|
yay -S --noconfirm "$pkg" || {
|
||||||
|
log_warning "No se pudo instalar ${pkg} desde AUR"
|
||||||
|
}
|
||||||
|
elif [ "$AUR_HELPER" = "paru" ]; then
|
||||||
|
paru -S --noconfirm "$pkg" || {
|
||||||
|
log_warning "No se pudo instalar ${pkg} desde AUR"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Configurar servicios
|
||||||
|
log_info "Configurando servicios..."
|
||||||
|
|
||||||
|
# Habilitar keyd si está instalado
|
||||||
|
if command_exists keyd; then
|
||||||
|
log_info "Habilitando servicio keyd..."
|
||||||
|
sudo systemctl enable keyd.service 2>/dev/null || true
|
||||||
|
sudo systemctl start keyd.service 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Habilitar logiops si está instalado
|
||||||
|
if command_exists logiops; then
|
||||||
|
log_info "Habilitando servicio logiops..."
|
||||||
|
sudo systemctl enable logiops.service 2>/dev/null || true
|
||||||
|
sudo systemctl start logiops.service 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Habilitar TeamViewer daemon si está instalado
|
||||||
|
if command_exists teamviewer; then
|
||||||
|
log_info "Habilitando servicio TeamViewer..."
|
||||||
|
sudo systemctl enable teamviewerd.service 2>/dev/null || true
|
||||||
|
sudo systemctl start teamviewerd.service 2>/dev/null || true
|
||||||
|
log_success "TeamViewer daemon habilitado e iniciado"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log_success "Aplicaciones instaladas correctamente"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ejecutar si se llama directamente
|
||||||
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
|
install_apps "$@"
|
||||||
|
fi
|
||||||
78
modules/common.sh
Executable file
78
modules/common.sh
Executable file
@@ -0,0 +1,78 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ===============================================================
|
||||||
|
# common.sh - Funciones comunes para los módulos
|
||||||
|
# ===============================================================
|
||||||
|
|
||||||
|
# Colores para output
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
BLUE='\033[0;34m'
|
||||||
|
MAGENTA='\033[0;35m'
|
||||||
|
CYAN='\033[0;36m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
BOLD='\033[1m'
|
||||||
|
|
||||||
|
# Funciones de logging
|
||||||
|
log_info() {
|
||||||
|
echo -e "${BLUE}▶${NC} ${BOLD}$1${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
log_success() {
|
||||||
|
echo -e "${GREEN}✓${NC} ${GREEN}$1${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
log_warning() {
|
||||||
|
echo -e "${YELLOW}⚠${NC} ${YELLOW}$1${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
log_error() {
|
||||||
|
echo -e "${RED}✗${NC} ${RED}$1${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
log_step() {
|
||||||
|
echo -e "\n${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||||
|
echo -e "${CYAN}${BOLD} $1${NC}"
|
||||||
|
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Función para verificar si un comando existe
|
||||||
|
command_exists() {
|
||||||
|
command -v "$1" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Función para instalar helper AUR si no existe
|
||||||
|
ensure_aur_helper() {
|
||||||
|
if command_exists yay; then
|
||||||
|
echo "yay"
|
||||||
|
return 0
|
||||||
|
elif command_exists paru; then
|
||||||
|
echo "paru"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
log_warning "No se detectó yay ni paru. Instalando yay..."
|
||||||
|
cd /tmp
|
||||||
|
git clone https://aur.archlinux.org/yay-bin.git
|
||||||
|
cd yay-bin
|
||||||
|
makepkg -si --noconfirm
|
||||||
|
echo "yay"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Función para actualizar sistema
|
||||||
|
update_system() {
|
||||||
|
log_step "Actualizando sistema"
|
||||||
|
log_info "Sincronizando repositorios y actualizando paquetes..."
|
||||||
|
sudo pacman -Syu --noconfirm
|
||||||
|
log_success "Sistema actualizado"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Función para limpiar paquetes huérfanos
|
||||||
|
cleanup_orphans() {
|
||||||
|
log_step "Limpieza de paquetes huérfanos"
|
||||||
|
log_info "Buscando paquetes huérfanos..."
|
||||||
|
sudo pacman -Rns $(pacman -Qtdq) --noconfirm 2>/dev/null || true
|
||||||
|
log_success "Limpieza completada"
|
||||||
|
}
|
||||||
|
|
||||||
233
modules/davinci-resolve.sh
Executable file
233
modules/davinci-resolve.sh
Executable file
@@ -0,0 +1,233 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ===============================================================
|
||||||
|
# davinci-resolve.sh - Instalador de DaVinci Resolve (Intel Edition)
|
||||||
|
# ===============================================================
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "${SCRIPT_DIR}/common.sh"
|
||||||
|
|
||||||
|
install_davinci_resolve() {
|
||||||
|
log_step "Instalación de DaVinci Resolve (Intel Edition)"
|
||||||
|
|
||||||
|
# Comprobar que el ZIP está en Downloads
|
||||||
|
ZIP_DIR="${HOME}/Downloads"
|
||||||
|
RESOLVE_ZIP="$(ls -1t "${ZIP_DIR}"/DaVinci_Resolve*_Linux.zip 2>/dev/null | head -n1 || true)"
|
||||||
|
|
||||||
|
if [[ -z "${RESOLVE_ZIP}" ]]; then
|
||||||
|
log_error "No se encontró ningún ZIP de DaVinci Resolve en ${ZIP_DIR}."
|
||||||
|
log_info "Ve al sitio de descargas de Blackmagic Design:"
|
||||||
|
log_info "https://www.blackmagicdesign.com/support/"
|
||||||
|
log_info "Descarga el archivo Linux ZIP y colócalo en ${ZIP_DIR}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log_info "Usando ZIP: ${RESOLVE_ZIP}"
|
||||||
|
|
||||||
|
# Instalación de paquetes básicos
|
||||||
|
log_info "Instalando paquetes básicos..."
|
||||||
|
sudo pacman -S --needed --noconfirm \
|
||||||
|
unzip patchelf libarchive xdg-user-dirs desktop-file-utils \
|
||||||
|
file gtk-update-icon-cache rsync clinfo qt5-base qt5-svg qt5-x11extras \
|
||||||
|
libpng libtiff libcurl || true
|
||||||
|
|
||||||
|
# Configurar OpenCL / Intel GPU
|
||||||
|
log_info "Configurando runtime OpenCL de Intel y drivers de video..."
|
||||||
|
|
||||||
|
# Eliminar posibles paquetes NVIDIA conflictivos
|
||||||
|
if pacman -Qi nvidia &>/dev/null; then
|
||||||
|
log_warning "Quitando paquetes NVIDIA para evitar conflictos..."
|
||||||
|
sudo pacman -Rns --noconfirm nvidia nvidia-utils nvidia-settings opencl-nvidia || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Instalar headers del kernel si son necesarios
|
||||||
|
KVER="$(uname -r)"
|
||||||
|
if [[ ! -d "/usr/lib/modules/${KVER}/build" ]]; then
|
||||||
|
log_info "Instalando headers de kernel..."
|
||||||
|
sudo pacman -S --needed --noconfirm linux-headers linux-zen-headers || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Instalar runtime OpenCL (compute runtime), desde AUR si es necesario
|
||||||
|
if ! pacman -Qi intel-compute-runtime &>/dev/null; then
|
||||||
|
log_info "Instalando intel-compute-runtime (puede venir del AUR)..."
|
||||||
|
AUR_HELPER=$(ensure_aur_helper)
|
||||||
|
if [ "$AUR_HELPER" = "yay" ]; then
|
||||||
|
yay -S --noconfirm intel-compute-runtime || {
|
||||||
|
log_error "No se pudo instalar intel-compute-runtime"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
elif [ "$AUR_HELPER" = "paru" ]; then
|
||||||
|
paru -S --noconfirm intel-compute-runtime || {
|
||||||
|
log_error "No se pudo instalar intel-compute-runtime"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if ! sudo pacman -S --needed --noconfirm intel-compute-runtime; then
|
||||||
|
log_error "No se pudo instalar intel-compute-runtime desde pacman."
|
||||||
|
log_error "Asegúrate de tener un helper AUR como yay o paru"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Instalar otros paquetes Intel / VA-API / OpenCL
|
||||||
|
log_info "Instalando paquetes Intel / VA-API / OpenCL..."
|
||||||
|
sudo pacman -S --needed --noconfirm \
|
||||||
|
intel-media-driver \
|
||||||
|
ocl-icd \
|
||||||
|
libxcrypt-compat \
|
||||||
|
ffmpeg \
|
||||||
|
glu \
|
||||||
|
gtk2 \
|
||||||
|
fuse2 \
|
||||||
|
libva-utils libvdpau-va-gl || true
|
||||||
|
|
||||||
|
# Asegurar el archivo ICD para OpenCL de Intel
|
||||||
|
if [[ ! -f /etc/OpenCL/vendors/intel.icd ]]; then
|
||||||
|
log_info "Creando vendor file de OpenCL para Intel..."
|
||||||
|
sudo mkdir -p /etc/OpenCL/vendors
|
||||||
|
echo "/usr/lib/intel-opencl/libigdrcl.so" | sudo tee /etc/OpenCL/vendors/intel.icd >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Crear enlace /etc/pki/tls si es necesario
|
||||||
|
if [[ ! -e /etc/pki/tls ]]; then
|
||||||
|
log_info "Creando enlace /etc/pki/tls → /etc/ssl"
|
||||||
|
sudo mkdir -p /etc/pki
|
||||||
|
sudo ln -sf /etc/ssl /etc/pki/tls
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo ldconfig || true
|
||||||
|
|
||||||
|
# Verificaciones
|
||||||
|
log_info "Verificando OpenCL instalado..."
|
||||||
|
clinfo | grep -E "Platform Name|Device Name" || true
|
||||||
|
|
||||||
|
log_info "Verificando soporte de decodificación VA-API para H264 / HEVC..."
|
||||||
|
vainfo | grep -E "H264|HEVC" || true
|
||||||
|
|
||||||
|
# Extraer DaVinci Resolve
|
||||||
|
log_info "Extrayendo DaVinci Resolve del ZIP..."
|
||||||
|
NEEDED_GB=10
|
||||||
|
FREE_KB=$(df --output=avail -k "${ZIP_DIR}" | tail -n1)
|
||||||
|
FREE_GB=$((FREE_KB / 1024 / 1024))
|
||||||
|
if (( FREE_GB < NEEDED_GB )); then
|
||||||
|
log_error "No hay suficiente espacio libre en ${ZIP_DIR}: ${FREE_GB} GiB < ${NEEDED_GB} GiB"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
WORKDIR="$(mktemp -d -p "${ZIP_DIR}" .resolve-extract-XXXXXXXX)"
|
||||||
|
trap 'rm -rf "${WORKDIR}"' EXIT
|
||||||
|
unzip -q "${RESOLVE_ZIP}" -d "${WORKDIR}"
|
||||||
|
|
||||||
|
RUN_FILE="$(find "${WORKDIR}" -maxdepth 2 -type f -name 'DaVinci_Resolve_*_Linux.run' | head -n1 || true)"
|
||||||
|
if [[ -z "${RUN_FILE}" ]]; then
|
||||||
|
log_error "No se encontró el archivo .run dentro del ZIP."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
chmod +x "${RUN_FILE}"
|
||||||
|
|
||||||
|
EX_DIR="$(dirname "${RUN_FILE}")"
|
||||||
|
( cd "${EX_DIR}" && "./$(basename "${RUN_FILE}")" --appimage-extract >/dev/null )
|
||||||
|
|
||||||
|
APPDIR="${EX_DIR}/squashfs-root"
|
||||||
|
if [[ ! -d "${APPDIR}" ]]; then
|
||||||
|
log_error "No se extrajo correctamente la carpeta squashfs-root."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod -R u+rwX,go+rX,go-w "${APPDIR}"
|
||||||
|
if [[ ! -s "${APPDIR}/bin/resolve" ]]; then
|
||||||
|
log_error "El binario resolve no existe o está vacío."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Reemplazar librerías glib/gio/gmodule
|
||||||
|
log_info "Ajustando bibliotecas glib/gio/gmodule para usar las del sistema..."
|
||||||
|
pushd "${APPDIR}" >/dev/null
|
||||||
|
rm -f libs/libglib-2.0.so.0 libs/libgio-2.0.so.0 libs/libgmodule-2.0.so.0 || true
|
||||||
|
ln -sf /usr/lib/libglib-2.0.so.0 libs/libglib-2.0.so.0
|
||||||
|
ln -sf /usr/lib/libgio-2.0.so.0 libs/libgio-2.0.so.0
|
||||||
|
ln -sf /usr/lib/libgmodule-2.0.so.0 libs/libgmodule-2.0.so.0
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
|
# Aplicar RPATH
|
||||||
|
log_info "Aplicando RPATH con patchelf..."
|
||||||
|
RPATH_DIRS=(
|
||||||
|
"libs"
|
||||||
|
"libs/plugins/sqldrivers"
|
||||||
|
"libs/plugins/xcbglintegrations"
|
||||||
|
"libs/plugins/imageformats"
|
||||||
|
"libs/plugins/platforms"
|
||||||
|
"libs/Fusion"
|
||||||
|
"plugins"
|
||||||
|
"bin"
|
||||||
|
)
|
||||||
|
RPATH_ABS=""
|
||||||
|
for p in "${RPATH_DIRS[@]}"; do
|
||||||
|
RPATH_ABS+="/opt/resolve/${p}:"
|
||||||
|
done
|
||||||
|
RPATH_ABS+="\$ORIGIN"
|
||||||
|
|
||||||
|
if command -v patchelf &>/dev/null; then
|
||||||
|
find "${APPDIR}" -type f -exec bash -c '
|
||||||
|
file -b "$1" | grep -q ELF && sudo patchelf --set-rpath "'"${RPATH_ABS}"'" "$1"
|
||||||
|
' _ {} \; || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Instalar en /opt/resolve
|
||||||
|
log_info "Instalando DaVinci Resolve en /opt/resolve..."
|
||||||
|
sudo rm -rf /opt/resolve
|
||||||
|
sudo mkdir -p /opt/resolve
|
||||||
|
sudo rsync -a --delete "${APPDIR}/" /opt/resolve/
|
||||||
|
sudo mkdir -p /opt/resolve/.license
|
||||||
|
|
||||||
|
# Enlazar libcrypt legado si es necesario
|
||||||
|
sudo pacman -S --needed --noconfirm libxcrypt-compat || true
|
||||||
|
sudo ldconfig || true
|
||||||
|
if [[ -e /usr/lib/libcrypt.so.1 ]]; then
|
||||||
|
sudo ln -sf /usr/lib/libcrypt.so.1 /opt/resolve/libs/libcrypt.so.1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Crear wrapper + acceso en escritorio
|
||||||
|
log_info "Creando wrapper y acceso para DaVinci Resolve..."
|
||||||
|
cat << 'EOF' | sudo tee /usr/local/bin/resolve-intel >/dev/null
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
find /tmp -maxdepth 1 -type f -name "qtsingleapp-DaVinci*lockfile" -delete 2>/dev/null || true
|
||||||
|
export QT_QPA_PLATFORM=xcb
|
||||||
|
export QT_AUTO_SCREEN_SCALE_FACTOR=1
|
||||||
|
export OCL_ICD_VENDORS=/etc/OpenCL/vendors
|
||||||
|
exec /opt/resolve/bin/resolve "$@"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo chmod +x /usr/local/bin/resolve-intel
|
||||||
|
|
||||||
|
mkdir -p "${HOME}/.local/share/applications"
|
||||||
|
cat > "${HOME}/.local/share/applications/davinci-resolve-wrapper.desktop" << EOF
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=DaVinci Resolve (Intel)
|
||||||
|
Comment=DaVinci Resolve usando OpenCL de Intel
|
||||||
|
Exec=/usr/local/bin/resolve-intel %U
|
||||||
|
TryExec=/usr/local/bin/resolve-intel
|
||||||
|
Terminal=false
|
||||||
|
Icon=davinci-resolve
|
||||||
|
Categories=AudioVideo;Video;Graphics;
|
||||||
|
StartupWMClass=resolve
|
||||||
|
X-GNOME-UsesNotifications=true
|
||||||
|
EOF
|
||||||
|
|
||||||
|
update-desktop-database "${HOME}/.local/share/applications" >/dev/null 2>&1 || true
|
||||||
|
sudo gtk-update-icon-cache -f /usr/share/icons/hicolor >/dev/null 2>&1 || true
|
||||||
|
|
||||||
|
log_success "DaVinci Resolve (Intel Edition) instalado en /opt/resolve"
|
||||||
|
log_info "Usa 'resolve-intel' para lanzar la aplicación"
|
||||||
|
log_info "Para verificar OpenCL: clinfo | grep -E 'Platform Name|Device Name'"
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ejecutar si se llama directamente
|
||||||
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
|
install_davinci_resolve "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
67
modules/docker.sh
Executable file
67
modules/docker.sh
Executable file
@@ -0,0 +1,67 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ===============================================================
|
||||||
|
# docker.sh - Configuración de Docker y Portainer
|
||||||
|
# ===============================================================
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "${SCRIPT_DIR}/common.sh"
|
||||||
|
|
||||||
|
install_docker() {
|
||||||
|
log_step "Configuración de Docker y Portainer"
|
||||||
|
|
||||||
|
# Instalar Docker
|
||||||
|
log_info "Instalando Docker y Docker Compose..."
|
||||||
|
sudo pacman -S --noconfirm --needed \
|
||||||
|
docker docker-compose || {
|
||||||
|
log_error "Error al instalar Docker"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Habilitar y iniciar Docker
|
||||||
|
log_info "Habilitando servicio de Docker..."
|
||||||
|
sudo systemctl enable docker.service
|
||||||
|
sudo systemctl enable containerd.service
|
||||||
|
sudo systemctl start docker.service
|
||||||
|
|
||||||
|
# Agregar usuario al grupo docker (si no está ya)
|
||||||
|
if ! groups "$USER" | grep -q docker; then
|
||||||
|
log_info "Agregando usuario al grupo docker..."
|
||||||
|
sudo usermod -aG docker "$USER"
|
||||||
|
log_warning "Necesitarás cerrar sesión y volver a iniciar para usar Docker sin sudo"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Instalar Portainer
|
||||||
|
log_info "Configurando Portainer..."
|
||||||
|
|
||||||
|
# Verificar si Portainer ya está corriendo
|
||||||
|
if sudo docker ps -a --format '{{.Names}}' | grep -q "^portainer$"; then
|
||||||
|
log_info "Portainer ya existe. Reiniciando contenedor..."
|
||||||
|
sudo docker stop portainer 2>/dev/null || true
|
||||||
|
sudo docker rm portainer 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Crear volumen y contenedor de Portainer
|
||||||
|
sudo docker volume create portainer_data 2>/dev/null || true
|
||||||
|
|
||||||
|
if sudo docker run -d -p 8000:8000 -p 9443:9443 \
|
||||||
|
--name portainer \
|
||||||
|
--restart=always \
|
||||||
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
|
-v portainer_data:/data \
|
||||||
|
portainer/portainer-ce:latest; then
|
||||||
|
log_success "Portainer instalado y ejecutándose"
|
||||||
|
log_info "Accede a Portainer en: https://localhost:9443"
|
||||||
|
else
|
||||||
|
log_error "Error al instalar Portainer"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log_success "Docker y Portainer configurados correctamente"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ejecutar si se llama directamente
|
||||||
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
|
install_docker "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
48
modules/printer.sh
Executable file
48
modules/printer.sh
Executable file
@@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ===============================================================
|
||||||
|
# printer.sh - Configuración de impresoras (CUPS)
|
||||||
|
# ===============================================================
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "${SCRIPT_DIR}/common.sh"
|
||||||
|
|
||||||
|
install_printer() {
|
||||||
|
log_step "Configuración de Impresoras (CUPS)"
|
||||||
|
|
||||||
|
# Instalar CUPS y drivers comunes
|
||||||
|
log_info "Instalando CUPS y drivers de impresora..."
|
||||||
|
sudo pacman -S --noconfirm --needed \
|
||||||
|
cups cups-pdf \
|
||||||
|
ghostscript gsfonts \
|
||||||
|
gutenprint foomatic-db-engine foomatic-db foomatic-db-ppds foomatic-db-nonfree-ppds foomatic-db-nonfree \
|
||||||
|
system-config-printer \
|
||||||
|
avahi || {
|
||||||
|
log_error "Error al instalar CUPS"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Habilitar y iniciar servicios
|
||||||
|
log_info "Habilitando servicios de impresora..."
|
||||||
|
sudo systemctl enable cups.service
|
||||||
|
sudo systemctl enable avahi-daemon.service
|
||||||
|
sudo systemctl start cups.service
|
||||||
|
sudo systemctl start avahi-daemon.service
|
||||||
|
|
||||||
|
# Agregar usuario al grupo lp (si no está ya)
|
||||||
|
if ! groups "$USER" | grep -q lp; then
|
||||||
|
log_info "Agregando usuario al grupo lp..."
|
||||||
|
sudo usermod -aG lp "$USER"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log_success "CUPS instalado y configurado"
|
||||||
|
log_info "Accede a la interfaz web de CUPS en: http://localhost:631"
|
||||||
|
log_info "O usa: system-config-printer para configurar impresoras"
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ejecutar si se llama directamente
|
||||||
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
|
install_printer "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
35
modules/zerotier.sh
Executable file
35
modules/zerotier.sh
Executable file
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ===============================================================
|
||||||
|
# zerotier.sh - Configuración de ZeroTier
|
||||||
|
# ===============================================================
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "${SCRIPT_DIR}/common.sh"
|
||||||
|
|
||||||
|
install_zerotier() {
|
||||||
|
log_step "Configuración de ZeroTier"
|
||||||
|
|
||||||
|
# Instalar ZeroTier
|
||||||
|
log_info "Instalando ZeroTier..."
|
||||||
|
sudo pacman -S --noconfirm --needed zerotier-one || {
|
||||||
|
log_error "Error al instalar ZeroTier"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Habilitar y iniciar servicio
|
||||||
|
log_info "Habilitando servicio de ZeroTier..."
|
||||||
|
sudo systemctl enable zerotier-one.service
|
||||||
|
sudo systemctl start zerotier-one.service
|
||||||
|
|
||||||
|
log_success "ZeroTier instalado y servicio iniciado"
|
||||||
|
log_info "Para unirte a una red, ejecuta: sudo zerotier-cli join <NETWORK_ID>"
|
||||||
|
log_info "Para ver tu ID de ZeroTier: sudo zerotier-cli info"
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ejecutar si se llama directamente
|
||||||
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
|
install_zerotier "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
76
modules/zsh-config.sh
Executable file
76
modules/zsh-config.sh
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ===============================================================
|
||||||
|
# zsh-config.sh - Configuración de Zsh y shell
|
||||||
|
# ===============================================================
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "${SCRIPT_DIR}/common.sh"
|
||||||
|
|
||||||
|
# Usar REPO_BASE si está definido, sino usar el valor por defecto
|
||||||
|
REPO_BASE="${REPO_BASE:-https://raw.githubusercontent.com/marcogll/scripts_mg/refs/heads/main/omarchy_zsh_setup}"
|
||||||
|
|
||||||
|
install_zsh() {
|
||||||
|
log_step "Configuración de Zsh"
|
||||||
|
|
||||||
|
# Instalar Zsh y plugins
|
||||||
|
log_info "Instalando Zsh y complementos..."
|
||||||
|
sudo pacman -S --noconfirm --needed \
|
||||||
|
zsh zsh-completions zsh-syntax-highlighting zsh-autosuggestions || {
|
||||||
|
log_error "Error al instalar Zsh"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Descargar configuración personalizada
|
||||||
|
log_info "Descargando configuración de Zsh desde GitHub..."
|
||||||
|
if curl -fsSL "${REPO_BASE}/.zshrc" -o ~/.zshrc; then
|
||||||
|
log_success "Configuración de Zsh descargada"
|
||||||
|
else
|
||||||
|
log_warning "No se pudo descargar .zshrc desde GitHub"
|
||||||
|
log_info "Creando configuración básica de Zsh..."
|
||||||
|
cat > ~/.zshrc << 'EOF'
|
||||||
|
# Zsh básico
|
||||||
|
autoload -U compinit
|
||||||
|
compinit
|
||||||
|
|
||||||
|
# Plugins
|
||||||
|
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||||
|
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||||
|
|
||||||
|
# Historial
|
||||||
|
HISTFILE=~/.zsh_history
|
||||||
|
HISTSIZE=10000
|
||||||
|
SAVEHIST=10000
|
||||||
|
setopt SHARE_HISTORY
|
||||||
|
setopt HIST_IGNORE_DUPS
|
||||||
|
|
||||||
|
# Aliases útiles
|
||||||
|
alias ll='ls -lah'
|
||||||
|
alias la='ls -A'
|
||||||
|
alias l='ls -CF'
|
||||||
|
alias ..='cd ..'
|
||||||
|
alias ...='cd ../..'
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configurar Zsh como shell predeterminada
|
||||||
|
if [ "$SHELL" != "/bin/zsh" ] && [ "$SHELL" != "/usr/bin/zsh" ]; then
|
||||||
|
log_info "Configurando Zsh como shell predeterminada..."
|
||||||
|
if chsh -s /bin/zsh 2>/dev/null || chsh -s /usr/bin/zsh 2>/dev/null; then
|
||||||
|
log_success "Zsh configurado como shell predeterminada"
|
||||||
|
log_warning "Los cambios surtirán efecto en la próxima sesión"
|
||||||
|
else
|
||||||
|
log_warning "No se pudo cambiar la shell. Ejecuta manualmente: chsh -s /bin/zsh"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log_success "Zsh ya es la shell predeterminada"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log_success "Configuración de Zsh completada"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ejecutar si se llama directamente
|
||||||
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
|
install_zsh "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
220
omarchy-setup.sh
Executable file
220
omarchy-setup.sh
Executable file
@@ -0,0 +1,220 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ===============================================================
|
||||||
|
# 🌀 Omarchy Setup Script — Configuración modular para Arch Linux
|
||||||
|
# ===============================================================
|
||||||
|
|
||||||
|
set -uo pipefail
|
||||||
|
|
||||||
|
# Directorio del script
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
MODULES_DIR="${SCRIPT_DIR}/modules"
|
||||||
|
REPO_BASE="https://raw.githubusercontent.com/marcogll/scripts_mg/refs/heads/main/omarchy_zsh_setup"
|
||||||
|
|
||||||
|
# Verificar que los módulos existen
|
||||||
|
if [[ ! -d "${MODULES_DIR}" ]] || [[ ! -f "${MODULES_DIR}/common.sh" ]]; then
|
||||||
|
echo -e "\033[0;31m✗ Error: Módulos no encontrados\033[0m"
|
||||||
|
echo ""
|
||||||
|
echo "Este script requiere que los módulos estén presentes localmente."
|
||||||
|
echo "Por favor, clona el repositorio completo:"
|
||||||
|
echo ""
|
||||||
|
echo " git clone https://github.com/marcogll/scripts_mg.git"
|
||||||
|
echo " cd scripts_mg/omarchy_zsh_setup"
|
||||||
|
echo " ./omarchy-setup.sh"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Cargar funciones comunes
|
||||||
|
source "${MODULES_DIR}/common.sh"
|
||||||
|
|
||||||
|
# Función para mostrar el menú
|
||||||
|
show_menu() {
|
||||||
|
clear
|
||||||
|
echo -e "${CYAN}╔════════════════════════════════════════════════════════════╗${NC}"
|
||||||
|
echo -e "${CYAN}║${NC} ${BOLD}🌀 Omarchy Setup Script — Configuración Modular${NC} ${CYAN}║${NC}"
|
||||||
|
echo -e "${CYAN}╚════════════════════════════════════════════════════════════╝${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${BOLD}Selecciona las opciones que deseas instalar:${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e " ${GREEN}1)${NC} 📦 Instalar Aplicaciones (VS Code, Cursor, VLC, herramientas)"
|
||||||
|
echo -e " ${GREEN}2)${NC} 🐚 Configurar Zsh (shell, plugins, configuración personalizada)"
|
||||||
|
echo -e " ${GREEN}3)${NC} 🐳 Instalar Docker y Portainer"
|
||||||
|
echo -e " ${GREEN}4)${NC} 🌐 Instalar ZeroTier"
|
||||||
|
echo -e " ${GREEN}5)${NC} 🖨️ Configurar Impresoras (CUPS)"
|
||||||
|
echo -e " ${GREEN}6)${NC} 🎬 Instalar DaVinci Resolve (Intel Edition)"
|
||||||
|
echo -e " ${GREEN}7)${NC} 🔄 Actualizar Sistema"
|
||||||
|
echo -e " ${GREEN}8)${NC} 🧹 Limpiar Paquetes Huérfanos"
|
||||||
|
echo -e " ${GREEN}9)${NC} ✅ Instalar Todo (opciones 1-5)"
|
||||||
|
echo -e " ${GREEN}0)${NC} 🚪 Salir"
|
||||||
|
echo ""
|
||||||
|
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||||
|
echo -ne "${BOLD}Selecciona opción [0-9]: ${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Función para ejecutar módulo
|
||||||
|
run_module() {
|
||||||
|
local module_name=$1
|
||||||
|
local module_file="${MODULES_DIR}/${module_name}.sh"
|
||||||
|
|
||||||
|
if [[ ! -f "${module_file}" ]]; then
|
||||||
|
log_error "Módulo ${module_name} no encontrado"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Exportar REPO_BASE para que los módulos lo puedan usar
|
||||||
|
export REPO_BASE
|
||||||
|
|
||||||
|
# Cargar y ejecutar el módulo
|
||||||
|
source "${module_file}"
|
||||||
|
|
||||||
|
case "${module_name}" in
|
||||||
|
"apps")
|
||||||
|
install_apps
|
||||||
|
;;
|
||||||
|
"zsh-config")
|
||||||
|
install_zsh
|
||||||
|
;;
|
||||||
|
"docker")
|
||||||
|
install_docker
|
||||||
|
;;
|
||||||
|
"zerotier")
|
||||||
|
install_zerotier
|
||||||
|
;;
|
||||||
|
"printer")
|
||||||
|
install_printer
|
||||||
|
;;
|
||||||
|
"davinci-resolve")
|
||||||
|
install_davinci_resolve
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
log_error "Función no definida para el módulo ${module_name}"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# Función para instalar todo
|
||||||
|
install_all() {
|
||||||
|
log_step "Instalación Completa de Omarchy"
|
||||||
|
|
||||||
|
local modules=("apps" "zsh-config" "docker" "zerotier" "printer")
|
||||||
|
local failed=()
|
||||||
|
|
||||||
|
for module in "${modules[@]}"; do
|
||||||
|
log_info "Procesando módulo: ${module}"
|
||||||
|
if run_module "${module}"; then
|
||||||
|
log_success "Módulo ${module} completado"
|
||||||
|
else
|
||||||
|
log_error "Error en el módulo ${module}"
|
||||||
|
failed+=("${module}")
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ ${#failed[@]} -eq 0 ]]; then
|
||||||
|
log_success "Todas las instalaciones se completaron correctamente"
|
||||||
|
else
|
||||||
|
log_warning "Algunos módulos fallaron: ${failed[*]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Función principal
|
||||||
|
main() {
|
||||||
|
# Verificar que estamos en Arch Linux
|
||||||
|
if [[ ! -f /etc/arch-release ]]; then
|
||||||
|
log_error "Este script está diseñado para Arch Linux"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verificar permisos de sudo
|
||||||
|
if ! sudo -n true 2>/dev/null; then
|
||||||
|
log_info "Este script requiere permisos de sudo"
|
||||||
|
sudo -v
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Mantener sudo activo en background
|
||||||
|
(while true; do
|
||||||
|
sudo -n true
|
||||||
|
sleep 60
|
||||||
|
kill -0 "$$" || exit
|
||||||
|
done 2>/dev/null) &
|
||||||
|
|
||||||
|
# Bucle principal del menú
|
||||||
|
while true; do
|
||||||
|
show_menu
|
||||||
|
read -r choice
|
||||||
|
choice="${choice// /}" # Eliminar espacios
|
||||||
|
|
||||||
|
case "${choice}" in
|
||||||
|
1)
|
||||||
|
run_module "apps"
|
||||||
|
echo ""
|
||||||
|
read -p "Presiona Enter para continuar..."
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
run_module "zsh-config"
|
||||||
|
echo ""
|
||||||
|
read -p "Presiona Enter para continuar..."
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
run_module "docker"
|
||||||
|
echo ""
|
||||||
|
read -p "Presiona Enter para continuar..."
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
run_module "zerotier"
|
||||||
|
echo ""
|
||||||
|
read -p "Presiona Enter para continuar..."
|
||||||
|
;;
|
||||||
|
5)
|
||||||
|
run_module "printer"
|
||||||
|
echo ""
|
||||||
|
read -p "Presiona Enter para continuar..."
|
||||||
|
;;
|
||||||
|
6)
|
||||||
|
log_warning "DaVinci Resolve requiere el ZIP de instalación en ~/Downloads"
|
||||||
|
echo -ne "${BOLD}¿Continuar con la instalación? [s/N]: ${NC}"
|
||||||
|
read -r confirm
|
||||||
|
if [[ "${confirm}" =~ ^[Ss]$ ]]; then
|
||||||
|
run_module "davinci-resolve"
|
||||||
|
else
|
||||||
|
log_info "Instalación cancelada"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
read -p "Presiona Enter para continuar..."
|
||||||
|
;;
|
||||||
|
7)
|
||||||
|
update_system
|
||||||
|
echo ""
|
||||||
|
read -p "Presiona Enter para continuar..."
|
||||||
|
;;
|
||||||
|
8)
|
||||||
|
cleanup_orphans
|
||||||
|
echo ""
|
||||||
|
read -p "Presiona Enter para continuar..."
|
||||||
|
;;
|
||||||
|
9)
|
||||||
|
echo -ne "${BOLD}¿Instalar todas las opciones (1-5)? [s/N]: ${NC}"
|
||||||
|
read -r confirm
|
||||||
|
if [[ "${confirm}" =~ ^[Ss]$ ]]; then
|
||||||
|
install_all
|
||||||
|
else
|
||||||
|
log_info "Instalación cancelada"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
read -p "Presiona Enter para continuar..."
|
||||||
|
;;
|
||||||
|
0)
|
||||||
|
log_info "Saliendo..."
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
log_error "Opción inválida. Presiona Enter para continuar..."
|
||||||
|
read -r
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ejecutar función principal
|
||||||
|
main "$@"
|
||||||
Reference in New Issue
Block a user