En guise de reminder personnel et pour faire croire que ce blog est vivant, je vous propose un petit script qui crée une arborescence apt temporaire et qui l'utilise pour récupérer des données. Le but premier du script est d'extraire les traductions firefox et xulrunner des paquets de langue Ubuntu. Tout ça sous GPL 2 (il faut au moins ça pour un tel script !).
#!/bin/sh HERE=$(pwd) # Drop the old datarm-rf$HERE/usr # Set the apt config# First create the needed directories and filesmkdir-p apt/archives/partial mkdir-p apt/lists/partial mkdir-p apt/preferences.d mkdir-p apt/tmp touch apt/status # Set the sources.listcat> apt/sources.list << EOF deb http:// archive.ubuntu.com/ubuntu karmic main deb http:// archive.ubuntu.com/ubuntu karmic-updates main deb http:// archive.ubuntu.com/ubuntu karmic-security main EOF# And the config filecat> apt.conf << EOF APT { // We don't want to install the package, just download the binaries Get::Download-Only "true"; // We don't want interaction Get::Assume-Yes "true"; Get::force-yes "true"; }; Dir { State "$HERE/apt/"; State::status "status"; Cache "$HERE/apt/tmp/"; Cache::archives "$HERE/apt/archives/"; Etc "$HERE/apt/"; }; EOF APT_GET="apt-get -c $HERE/apt.conf"APT_CACHE="apt-cache -c $HERE/apt.conf" $APT_GET update # Get the list of known langsLANGS=$($APT_CACHE search --names-only language-pack |egrep-v"(gnome|base|kde)"|cut-d''-f 1 |cut-d'-' -f3-) # Install the package (download only)for lang in$LANGS; do$APT_GETinstall language-pack-$langdpkg-x apt/archives/language-pack-"$lang"_*$HEREdone # Cleanup, we only want FF 3.5 and Xul 1.9.1 translationsrm-rf apt.conf lock apt/rm-rf usr/share rm-rf $(find usr -name"*firefox-3.0*")rm-rf $(find usr -name"*xulrunner-1.9.ubuntu*") exit0