Use a opção -y para o apt-get para que ele não pergunte. De man apt-get
:
-y, --yes, --assume-yes
Automatic yes to prompts; assume "yes" as answer to all prompts and
run non-interactively. If an undesirable situation, such as
changing a held package, trying to install a unauthenticated
package or removing an essential package occurs then apt-get will
abort. Configuration Item: APT::Get::Assume-Yes.
Você também pode definir a variável env de DEBIAN_FRONTEND
DEBIAN_FRONTEND=noninteractive apt-get -y upgrade