You can (probably?) simplify that to
apt-get update ; DEBIAN_FRONTEND=noninteractive apt-get upgrade -yq. I don't thinkapt-get update prompts for anything, so it probably doesn't need DEBIAN_FRONTEND, and thus you don't really have to exportDEBIAN_FRONTEND and have it continue to exist through the rest of your environment. To whatever degree that matters to you.