#!/bin/sh
#
#	apt-walkabout update
#
#	Run an "apt-get update" in the apt-walkabout instance, to
#	update the package lists.
#
#	Run this on any system with internet connectivity.
#
set -e

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

HERE=/tmp/apt-walkabout.$$
mkdir ${HERE}

apt-get \
    -o Dir="." \
    -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=${HERE}/srcpkgcache.bin \
    -o Dir::Cache::pkgcache=${HERE}/pkgcache.bin \
    -o Debug::NoLocking=true \
    update || true

rm -rf ${HERE}
