Como verificar se o repositório em sources.list.d suporta uma versão específica do Ubuntu

1

Assim, a nova versão do Ubuntu acabou de sair e antes de saltar para atualizar o bandwagon, você quer verificar se as fontes de repo (em /etc/apt/sources.list.d ) de seus aplicativos favoritos adicionaram suporte para o dito lançamento do Ubuntu

    
por Flint 22.10.2013 / 03:09

1 resposta

4

Aqui está um script simples para simplificar a tarefa

#!/bin/bash

# enter the codename of ubuntu dist that you're upgrading/updating to
TARGET_DIST="utopic"


[[ -f /etc/lsb-release ]] && . /etc/lsb-release || exit 1
echo "Checking support of your current 3rd party apt sources for dist: $TARGET_DIST"
for list in /etc/apt/sources.list.d/*.list; do
    # get repo uri and dist
    read -r uri dist <<< $(sed -rn '/^deb/{s/.*((ftp|http)[^ ]+) ([^ ]+).*/ /p}' $list)

    # in case uri is blank
    [[ -z "$uri" ]] && continue

    # some repo don't use proper target dist names but names like stable/unstable
    # so if $dist doesnt correspond to our current dist codename we assume they support all ubuntu releases
    if [[ "$dist" != "$DISTRIB_CODENAME" ]]; then
        status="assume200"
    else
        # Release files can either be in InRelease or Release (for older apt client)
        # See https://wiki.debian.org/RepositoryFormat#A.22Release.22_files
        status=$(curl -sLI -w "%{http_code}" -o /dev/null "$uri/dists/$TARGET_DIST/Release")
        if [[ "$status" != "200" ]]; then
            status=$(curl -sLI -w "%{http_code}" -o /dev/null "$uri/dists/$TARGET_DIST/InRelease")
        fi
    fi

    if [[ "$status" == "200" ]]; then
        result="OK"
    elif [[ "$status" == "assume200" ]]; then
        result="OK ($dist)"
    else
        result="Nope"
    fi
    # finally display formatted results
    printf "%-50s : %s\n" ${list##*/} "$result"
done

Saída:

Checking support of your current 3rd party apt sources for dist: utopic
alexx2000-doublecmd-svn-trusty.list                : Nope
b-eltzner-qpdfview-trusty.list                     : Nope
dropbox.list                                       : Nope
google-chrome.list                                 : OK (stable)
linrunner-tlp-trusty.list                          : Nope
nesthib-weechat-stable-trusty.list                 : Nope
rvm-smplayer-trusty.list                           : Nope
spotify-stable.list                                : OK (stable)
steam.list                                         : OK (precise)
ubuntu-wine-ppa-trusty.list                        : Nope
virtualbox.list                                    : Nope
    
por Flint 22.10.2013 / 03:09