From cc5ae6221362c25d402ebe3b451dd0d42a986970 Mon Sep 17 00:00:00 2001 From: "Mauro Rosero P." Date: Sat, 15 Mar 2025 10:30:29 -0500 Subject: [PATCH] =?UTF-8?q?[IMPROVED]=20Priorizar=20instalaci=C3=B3n=20de?= =?UTF-8?q?=20GitLab=20CLI=20desde=20repositorios=20del=20sistema?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- bin/glcli_install.sh | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/bin/glcli_install.sh b/bin/glcli_install.sh index c492b17..ba7cb18 100755 --- a/bin/glcli_install.sh +++ b/bin/glcli_install.sh @@ -86,7 +86,21 @@ install_glab_debian() { apt update && apt install -y curl 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 echo "Agregando repositorio oficial de GitLab..." 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 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 echo "Usando script oficial de instalación..." curl -s https://gitlab.com/gitlab-org/cli/-/raw/main/scripts/install.sh | bash @@ -127,6 +153,19 @@ install_glab_redhat() { return 0 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 # Si los métodos anteriores fallan, probar con Homebrew