Acabei usando grep
para verificar o sources.list
e também verificando em sources.list.d
a presença de um foo.list
.
Embora não seja tão limpa quanto eu esperava, ela faz o trabalho bem o suficiente para o que eu precisava.
Para 10.04 LTS e 12.04 LTS, existe uma maneira de verificar se uma fonte está em /etc/apt/sources.list a partir de um script bash, diferente do grep?
Acabei usando grep
para verificar o sources.list
e também verificando em sources.list.d
a presença de um foo.list
.
Embora não seja tão limpa quanto eu esperava, ela faz o trabalho bem o suficiente para o que eu precisava.
apt-cache policy
mostra todas as fontes disponíveis. Saída de exemplo (aparada):
Package files:
100 /var/lib/dpkg/status
release a=now
500 http://ppa.launchpad.net/lekensteyn/wacom-tablet/ubuntu/ precise/main i386 Packages
release v=12.04,o=LP-PPA-lekensteyn-wacom-tablet,a=precise,n=precise,l=Wacom Tablet Drivers,c=main
origin ppa.launchpad.net
500 http://ppa.launchpad.net/lekensteyn/wacom-tablet/ubuntu/ precise/main amd64 Packages
release v=12.04,o=LP-PPA-lekensteyn-wacom-tablet,a=precise,n=precise,l=Wacom Tablet Drivers,c=main
origin ppa.launchpad.net
500 http://ppa.launchpad.net/bumblebee/testing/ubuntu/ precise/main i386 Packages
release v=12.04,o=LP-PPA-bumblebee-testing,a=precise,n=precise,l=Bumblebee Developer releases,c=main
origin ppa.launchpad.net
500 http://ppa.launchpad.net/bumblebee/testing/ubuntu/ precise/main amd64 Packages
release v=12.04,o=LP-PPA-bumblebee-testing,a=precise,n=precise,l=Bumblebee Developer releases,c=main
origin ppa.launchpad.net
500 http://archive.canonical.com/ubuntu/ precise/partner i386 Packages
release v=12.04,o=Canonical,a=precise,n=precise,l=Partner archive,c=partner
origin archive.canonical.com
...
500 http://nl.archive.ubuntu.com/ubuntu/ precise/main Translation-nl
500 http://nl.archive.ubuntu.com/ubuntu/ precise/main Translation-en
500 http://nl.archive.ubuntu.com/ubuntu/ precise/multiverse i386 Packages
release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=multiverse
origin nl.archive.ubuntu.com
500 http://nl.archive.ubuntu.com/ubuntu/ precise/universe i386 Packages
release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=universe
origin nl.archive.ubuntu.com
500 http://nl.archive.ubuntu.com/ubuntu/ precise/restricted i386 Packages
release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=restricted
origin nl.archive.ubuntu.com
500 http://nl.archive.ubuntu.com/ubuntu/ precise/main i386 Packages
release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=main
origin nl.archive.ubuntu.com
500 http://nl.archive.ubuntu.com/ubuntu/ precise/multiverse amd64 Packages
release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=multiverse
origin nl.archive.ubuntu.com
500 http://nl.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=universe
origin nl.archive.ubuntu.com
500 http://nl.archive.ubuntu.com/ubuntu/ precise/restricted amd64 Packages
release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=restricted
origin nl.archive.ubuntu.com
500 http://nl.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=main
origin nl.archive.ubuntu.com
Pinned packages
Usando awk
para recuperar a fonte real (URL ou arquivo):
$ apt-cache policy | awk '/^ *[0-9]/{print " " }'
/var/lib/dpkg/status
http://ppa.launchpad.net/lekensteyn/wacom-tablet/ubuntu/ precise/main
http://ppa.launchpad.net/lekensteyn/wacom-tablet/ubuntu/ precise/main
http://ppa.launchpad.net/bumblebee/testing/ubuntu/ precise/main
http://ppa.launchpad.net/bumblebee/testing/ubuntu/ precise/main
...
http://nl.archive.ubuntu.com/ubuntu/ precise/universe
http://nl.archive.ubuntu.com/ubuntu/ precise/restricted
http://nl.archive.ubuntu.com/ubuntu/ precise/main