Synchroniser les paquets de traduction sur son miroir local avec apt-mirror

Cet article fait suite à celui que j’avais déjà écrit sur la réalisation d’un miroir Debian local. Il va vous permettre de rapatrier les paquets de traduction (répertoire i18n) qu’apt-mirror ne synchronise pas par défaut. En effet lors d’un aptitude update vous recevez ce type de messages :

Err http://mirror wheezy/main Translation-en
  404  Not Found

Même si cela n’empêche pas la bonne installation des paquets, il peut arriver que cela pose problème.
Voici comment résoudre le souci. J’utilise désormais un script postmirror.sh qui est exécuté après chaque synchronisation du miroir. Ce script permet d’exécuter toutes les commandes que l’on veut une fois le mirroring quotidien achevé. Voici mon fichier de configuration d’apt-mirror avec la prise en compte de ce script, j’ai mis les lignes correspondantes en gras :

############# config ##################
#
set base_path    /mnt/miroirs
#
# if you change the base path you must create the directories below with write
privlages
#
set mirror_path  $base_path/mirror
set skel_path    $base_path/skel
set var_path     $base_path/var
#set cleanscript $var_path/clean.sh
set postmirror_script $base_path/var/postmirror.sh
set run_postmirror 1
#set defaultarch  
set nthreads     20
set _tilde 0
#
############# end config ##############
#Stable
deb-i386 http://mirror.ovh.net/debian/ stable main
deb-i386 http://security.debian.org/ stable/updates main
deb-i386 http://mirror.ovh.net/debian/ stable-updates main

deb-amd64 http://mirror.ovh.net/debian/ stable main
deb-amd64 http://security.debian.org/ stable/updates main
deb-amd64 http://mirror.ovh.net/debian/ stable-updates main

#Testing
deb-amd64 http://mirror.ovh.net/debian/ testing main contrib non-free
deb-amd64 http://security.debian.org/ testing/updates main contrib non-free

#SID
deb-amd64 http://mirror.ovh.net/debian/ sid main contrib non-free

#
clean http://mirror.ovh.net/debian
clean http://security.debian.org

Je n’utilise donc plus le script clean.sh directement mais par l’intermédiaire de postmirror.sh. C’est donc ce fichier que nous allons utiliser pour rapatrier les fichiers de traduction. Nous utiliserons rsync et il nous faut l’adresse d’un miroir rsync Debian. Ici j’utilise celui de l’Université de Bretagne.

#!/bin/sh

sh /mnt/miroirs/var/clean.sh

rsync --recursive --times --links --hard-links --delete --delete-after
 rsync://debian.med.univ-tours.fr/debian/dists/stable/main/i18n/ /mnt/miroirs/
mirror/mirror.ovh.net/debian/dists/stable/main/i18n/

rsync --recursive --times --links --hard-links --delete --delete-after
 rsync://debian.med.univ-tours.fr/debian/dists/testing/main/i18n/ /mnt/miroirs/
mirror/mirror.ovh.net/debian/dists/testing/main/i18n/

rsync --recursive --times --links --hard-links --delete --delete-after 
rsync://debian.med.univ-tours.fr/debian/dists/testing/contrib/i18n/ /mnt/miroirs/
mirror/mirror.ovh.net/debian/dists/testing/contrib/i18n/

rsync --recursive --times --links --hard-links --delete --delete-after 
rsync://debian.med.univ-tours.fr/debian/dists/testing/non-free/i18n/ /mnt/miroirs/
mirror/mirror.ovh.net/debian/dists/testing/non-free/i18n/

rsync --recursive --times --links --hard-links --delete --delete-after 
rsync://debian.med.univ-tours.fr/debian/dists/unstable/main/i18n/ /mnt/miroirs/
mirror/mirror.ovh.net/debian/dists/unstable/main/i18n/

rsync --recursive --times --links --hard-links --delete --delete-after 
rsync://debian.med.univ-tours.fr/debian/dists/unstable/contrib/i18n/ /mnt/miroirs/
mirror/mirror.ovh.net/debian/dists/unstable/contrib/i18n/

Attention aux retours à la ligne dans l’exemple ci-dessus. Il n’y a évidemment pas d’espace entre /mnt/miroirs/ et mirror, en revance il y en a un après delete-after.

Attention également à avoir préalablement créé les répertoires i18n dans les sections correspondantes de votre miroir.
Je vous donne également une dernière astuce qui concerne Aptitude ou Apt. De base aptitude va récupérer tous les fichiers de traduction possible sur les miroirs upstream (fr,en,ca,hu,km,ro …). Voici comment dire à Apt de ne synchroniser que les langues qui nous intéressent disons fr et en :

sudo vi /etc/apt/apt.conf.d/apt.conf
insérez la ligne suivante 
Acquire::Languages "fr,en";

Libre à vous sur votre miroir local de ne synchroniser que ces langues.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *