#!/bin/sh

# d-i may have stashed some packages on the disk that it copied off the
# CD-ROM. Move them into the apt cache.
if [ -d /var/cache/archive-copier/desktop ]; then
	find /var/cache/archive-copier/desktop -type f -print0 | \
		xargs -0r mv --target-directory /var/cache/apt/archives
	rmdir --ignore-fail-on-non-empty /var/cache/archive-copier/desktop
fi

# Make cached packages that aren't installed by default visible to
# apt, but only symlink them so that 'apt-get clean' doesn't remove
# them.
if [ -d /var/cache/archive-copier/ship ]; then
	find /var/cache/archive-copier/ship -type f -print0 | \
		xargs -0r ln -sf --target-directory /var/cache/apt/archives
fi
