[IMPROVED] Priorizar instalación de GitLab CLI desde repositorios del sistema

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Mauro Rosero P. 2025-03-15 10:30:29 -05:00
parent 53879c4475
commit cc5ae62213
Signed by: mrosero
GPG key ID: 83BD2A5F674B7E26

View file

@ -86,7 +86,21 @@ install_glab_debian() {
apt update && apt install -y curl apt update && apt install -y curl
fi fi
# Intentar primero usando apt # Intentar primero usando los paquetes del sistema si están disponibles
if command -v apt &> /dev/null; then
echo "Verificando si glab está disponible en los repositorios..."
apt-cache search --names-only "^glab$" 2>/dev/null | grep -q "^glab"
if [ $? -eq 0 ]; then
echo "GitLab CLI encontrado en los repositorios. Instalando..."
apt update && apt install -y glab
if [ $? -eq 0 ]; then
echo "GitLab CLI instalado correctamente desde los repositorios oficiales."
return 0
fi
fi
fi
# Si no está en los repositorios, usar el script oficial
if command -v gpg &> /dev/null; then if command -v gpg &> /dev/null; then
echo "Agregando repositorio oficial de GitLab..." echo "Agregando repositorio oficial de GitLab..."
curl -s https://gitlab.com/gitlab-org/cli/-/raw/main/scripts/install.sh | bash curl -s https://gitlab.com/gitlab-org/cli/-/raw/main/scripts/install.sh | bash
@ -108,7 +122,19 @@ install_glab_redhat() {
# Verificar si dnf está instalado # Verificar si dnf está instalado
if command -v dnf &> /dev/null; then if command -v dnf &> /dev/null; then
# Intentar primero usando el repositorio oficial # Verificar si glab está disponible en los repositorios
echo "Verificando si glab está disponible en los repositorios..."
dnf list glab &>/dev/null
if [ $? -eq 0 ]; then
echo "GitLab CLI encontrado en los repositorios. Instalando..."
dnf install -y glab
if [ $? -eq 0 ]; then
echo "GitLab CLI instalado correctamente desde los repositorios oficiales."
return 0
fi
fi
# Si no está en los repositorios, usar el script oficial
if command -v gpg &> /dev/null; then if command -v gpg &> /dev/null; then
echo "Usando script oficial de instalación..." echo "Usando script oficial de instalación..."
curl -s https://gitlab.com/gitlab-org/cli/-/raw/main/scripts/install.sh | bash curl -s https://gitlab.com/gitlab-org/cli/-/raw/main/scripts/install.sh | bash
@ -127,6 +153,19 @@ install_glab_redhat() {
return 0 return 0
fi fi
fi fi
# Si dnf no está disponible, pero yum sí
elif command -v yum &> /dev/null; then
# Verificar si glab está disponible en los repositorios
echo "Verificando si glab está disponible en los repositorios..."
yum list glab &>/dev/null
if [ $? -eq 0 ]; then
echo "GitLab CLI encontrado en los repositorios. Instalando..."
yum install -y glab
if [ $? -eq 0 ]; then
echo "GitLab CLI instalado correctamente desde los repositorios oficiales."
return 0
fi
fi
fi fi
# Si los métodos anteriores fallan, probar con Homebrew # Si los métodos anteriores fallan, probar con Homebrew