#!/bin/sh
#
#	purge, maintains the pen drive cache ... does an "apt-get
#	autoclean" to remove any packages no longer downloadable.
#	[while on either system]
#
set -ex

if [ ! -f bin/purge ]; then
    echo "aborted, we're not in an apt-walkabout instance"
    exit
fi

rm -f /tmp/srcpkgcache.bin /tmp/pkgcache.bin

apt-get \
    -o Dir::Etc::SourceList=${PWD}/etc/apt/sources.list \
    -o Dir::State::Lists=${PWD}/var/lib/apt/lists/ \
    -o Dir::Cache::Archives=${PWD}/var/cache/apt/archives \
    -o Dir::Cache::srcpkgcache=/tmp/srcpkgcache.bin \
    -o Dir::Cache::pkgcache=/tmp/pkgcache.bin \
    -o Debug::NoLocking=true \
    autoclean


