Obter url de pacotes instalados usando o apt

0

Como você deve saber, podemos usar apt-get install --print-uris -y package-name e nos mostra uma lista de URLs, hashsum, etc.

No entanto, se formos usá-lo para um pacote que já tenha sido instalado no sistema, ele não funcionará:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
package is already the newest version (x.x-x).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Então, como posso obter uma lista de URLs necessários usando apt ou outras ferramentas da CLI, como aptitude ?

PS: Eu não quero usar packages.ubuntu.com .

    
por Ravexina 29.06.2017 / 22:26

2 respostas

1

Nem todos os pacotes instalados terão um URL associado a eles, é claro. No entanto, você pode usar apt-get dowload :

$ apt-get download --print-uris wget
'http://archive.ubuntu.com/ubuntu/pool/main/w/wget/wget_1.15-1ubuntu1.14.04.2_amd64.deb' wget_1.15-1ubuntu1.14.04.2_amd64.deb 270522 SHA256:a3f3b049ea373402236a804a5a0952c6ef9b356ba8cc19fbc1f257db6e8f3052

Esta é a versão candidata, conforme mostrado por apt-cache policy , que pode não ser necessariamente a versão instalada.

    
por muru 30.06.2017 / 00:22
1

Parece ser suficiente adicionar o sinal --reinstall (pelo menos no meu sistema 16.04), por exemplo,

$ sudo apt-get install --print-uris wget
Reading package lists... Done
Building dependency tree
Reading state information... Done
wget is already the newest version (1.17.1-1ubuntu1.2).
wget set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 73 not upgraded.

mas

$ sudo apt-get install --reinstall --print-uris wget
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 73 not upgraded.
Need to get 298 kB of archives.
After this operation, 0 B of additional disk space will be used.
'http://ca.archive.ubuntu.com/ubuntu/pool/main/w/wget/wget_1.17.1-1ubuntu1.2_amd64.deb' wget_1.17.1-1ubuntu1.2_amd64.deb 298270 MD5Sum:09a54f8d74c78598f91c4b376f3d2f0e

NOTA: isso não funciona se o pacote estiver armazenado em cache:

$ sudo apt-get install --reinstall --download-only wget
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 73 not upgraded.
Need to get 298 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://ca.archive.ubuntu.com/ubuntu xenial-updates/main amd64 wget amd64 1.17.1-1ubuntu1.2 [298 kB]
Fetched 298 kB in 0s (382 kB/s)
Download complete and in download only mode

$ sudo apt-get install --reinstall --print-uris wget
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 73 not upgraded.
Need to get 0 B/298 kB of archives.
After this operation, 0 B of additional disk space will be used.

mas depois de limpar o cache

$ sudo apt-get clean
$ sudo apt-get install --reinstall --print-uris wget
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 73 not upgraded.
Need to get 298 kB of archives.
After this operation, 0 B of additional disk space will be used.
'http://ca.archive.ubuntu.com/ubuntu/pool/main/w/wget/wget_1.17.1-1ubuntu1.2_amd64.deb' wget_1.17.1-1ubuntu1.2_amd64.deb 298270 MD5Sum:09a54f8d74c78598f91c4b376f3d2f0e
    
por steeldriver 30.06.2017 / 20:58