#!/bin/sh -e

. /usr/share/debconf/confmodule

if db_get anna/retriever && [ "$RET" ]; then
	# Install the requested modules immediately.
	exec anna install "$@"
fi

queue=/var/lib/anna-install/queue

mkdir -p /var/lib/anna-install
touch $queue
for pkg in $@ ; do
    if ! grep -q "^$pkg$" $queue; then
        echo "$pkg" >> $queue
    fi
done
