#!/bin/sh # Usage: apt-file-update-installed # # Do a fake "apt-file update" which doesn't download anything but instead # builds a Contents file just from your locally installed packages, as # reported by "dpkg -S". # source=mirror.optus.net_debian_dists_unstable arch=`dpkg --print-architecture`; outname="/var/cache/apt/apt-file/${source}_Contents-$arch.gz" echo "generating $outname" tempfile=`mktemp /tmp/apt-file-update-installed.XXXXXX` || exit 1 chmod 644 $tempfile # trap 'rm -f "$tempfile"' 0 (echo "FILE LOCATION"; dpkg --search '*' \ | sed -n -e 's/, /,/g' \ -e 's%^\([^ :]*\): /\(.*\)%\2 \1%p' ) \ | gzip -1 - >>$tempfile mv $tempfile $outname ls -l $outname exit 0