Как проверить, поддерживает ли репозиторий в sources.list.d определенную версию Ubuntu

Итак, новая версия Ubuntu только что вышла, и перед тем, как перейти к обновлению Bandwagon, вы хотите проверить, добавили ли источники репо (в /etc/apt/sources.list.d) ваших любимых приложений поддержку для упомянутой версии Ubuntu

1
задан 5 May 2014 в 17:47

1 ответ

Вот простой скрипт для упрощения задачи

#!/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)[^ ]+) ([^ ]+).*/\1 \3/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

Вывод:

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
0
ответ дан 5 May 2014 в 17:47

Другие вопросы по тегам:

Похожие вопросы: