Prefira um espelho local sem alterar o /etc/apt/sources.list?

2

Temos espelhos locais para o Ubuntu (Debian) no link ( link ). Eu quero configurar os clientes para preferir baixar / baixar apenas pacotes desses espelhos em vez de link ( link . Eu posso fazer isso com sucesso, substituindo as URLs em /etc/apt/sources.list , no entanto estou interessado em fazer isso sem alterar /etc/apt/sources.list para que a personalização seja óbvia e possa ser facilmente revertida.

Eu criei /etc/apt/sources.list.d/wikimedia-mirror.list com o conteúdo:

deb http://ubuntu.wikimedia.org/ubuntu/ trusty main universe
deb-src http://ubuntu.wikimedia.org/ubuntu/ trusty main universe

e /etc/apt/preferences.d/wikimedia-mirror.pref com:

Package: *
Pin: origin "ubuntu.wikimedia.org"
Pin-Priority: 501

Após apt-get update , isso fará com que os pacotes do espelho tenham prioridade 501, mas apt-get baixará esses pacotes das fontes originais:

scfc@toolsbeta-t68121-trusty:~$ apt-cache policy zsh-doc
zsh-doc:
  Installed: (none)
  Candidate: 5.0.2-3ubuntu6
  Version table:
     5.0.5-4ubuntu1~ubuntu14.04.1 0
        100 http://nova.clouds.archive.ubuntu.com/ubuntu/ trusty-backports/main amd64 Packages
     5.0.2-3ubuntu6 0
        500 http://nova.clouds.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        501 http://ubuntu.wikimedia.org/ubuntu/ trusty/main amd64 Packages
scfc@toolsbeta-t68121-trusty:~$ sudo apt-get install zsh-doc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  zsh-doc
0 upgraded, 1 newly installed, 0 to remove and 35 not upgraded.
Need to get 2,274 kB of archives.
After this operation, 5,856 kB of additional disk space will be used.
Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu/ trusty/main zsh-doc all 5.0.2-3ubuntu6 [2,274 kB]
Fetched 2,274 kB in 3s (631 kB/s)    
Selecting previously unselected package zsh-doc.
(Reading database ... 38984 files and directories currently installed.)
Preparing to unpack .../zsh-doc_5.0.2-3ubuntu6_all.deb ...
Unpacking zsh-doc (5.0.2-3ubuntu6) ...
Processing triggers for install-info (5.2.0.dfsg.1-2) ...
Setting up zsh-doc (5.0.2-3ubuntu6) ...
scfc@toolsbeta-t68121-trusty:~$

Esse comportamento é consistente com a documentação em apt_preferences(5) :

Several instances of the same version of a package may be available when the sources.list(5)' file contains references to more than one source. In this case apt-get downloads the instance listed earliest in the sources.list(5) file. The APT preferences do not affect the choice of instance, only the choice of version.

Existe alguma maneira de preferir o espelho sobre as origens originais sem alterar /etc/apt/sources.list ? Arquivos em /etc/apt/sources.list.d podem ser "anteriores" a /etc/apt/sources.list ? Existe talvez uma opção de configuração que poderia ser (ab) usada para "mapear" as URLs?

    
por Tim Landscheidt 20.12.2016 / 08:52

0 respostas

Tags