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