I am trying to list available packages from a remote repository without accessing /etc/apt or /var.The following command doesn't return anything and exits with code zero. apt-cache dumpavail -o Dir::Etc=tmp/ -o Dir::Cache=tmp/ -o Dir::State=tmp/The command seems correct as per docs. Any idea what I am missing or how I could do it differently?I have my sources.list under /tmp with contents:deb http://br.archive.ubuntu.com/ubuntu/ precise main restrictedand the current apt config is default$apt-config dump...Dir /;Dir::State var/lib/apt/;Dir::State::lists lists/;Dir::State::cdroms cdroms.list;Dir::State::mirrors mirrors/;Dir::State::extended_states extended_states;Dir::State::status /var/lib/dpkg/status;Dir::Cache var/cache/apt/;Dir::Cache::archives archives/;Dir::Cache::srcpkgcache srcpkgcache.bin;Dir::Cache::pkgcache pkgcache.bin;Dir::Etc etc/apt/;Dir::Etc::sourcelist sources.list;Dir::Etc::sourceparts sources.list.d;
Why is this apt-cache dumpavail with overrides not working?
debian;apt
apt-cache dumpavail reads from /var/lib/apt/lists essentially, it does cat /var/lib/apt/lists/*_Packages. In fact, the whole apt-cache utility is designed to operate on the locally-cached data, it never queries the network.You need to run apt-get first, and make sure you have set a cache directory where it can operate.dir_cache=$(mktemp -d)mkdir $dir_cache/etc $dir_cache/var $dir_cache/stateecho 'deb http://br.archive.ubuntu.com/ubuntu/ precise main restricted' >$dir_cache/etc/apt/sources.listapt-get update -o Dir::Etc=$dir_cache/etc -o Dir::Cache=$dir_cache/var -o Dir::State=$dir_cache/stateapt-cache dumpavail -o Dir::Etc=$dir_cache/etc -o Dir::Cache=$dir_cache/var -o Dir::State=$dir_cache/staterm -r $dir_cache