#!/bin/sh
#
# Test-local-package: $package
#
# If it's a new install, show the task only if "$package" is
# available locally (ie. from the "cdrom").
# If it's not a new install, show the task unconditionally.
set -e

PACKAGE="$2"

if ! [ "$NEW_INSTALL" ]; then
	exit 3 # display task, not marked for installation
fi

found_in_cdrom=$(apt-cache madison "$PACKAGE" \
	| grep "^ *$PACKAGE " \
	| cut -d "|" -f 3 \
	| grep "^ *cdrom://")
if [ "$found_in_cdrom" ]; then
	exit 3 # display task, not marked for installation
else
	exit 1 # do not display task
fi
