#! /bin/sh -e

# Move cached packages that aren't installed by default into the apt cache,
# so that installing them doesn't require the CD.
if [ -d /target/var/cache/archive-copier/ship ]; then
	chroot /target find /var/cache/archive-copier/ship -type f -print0 | \
		chroot /target xargs -0r mv -f \
			--target-directory /var/cache/apt/archives
	chroot /target rmdir --ignore-fail-on-non-empty \
		/var/cache/archive-copier/ship
	chroot /target rmdir --ignore-fail-on-non-empty \
		/var/cache/archive-copier
fi

exit 0
