[actions] never let an apt install wait on a prompt

Moving WSL package installs out of `setup-wsl`'s `additional-packages` lost its non-interactive setup:
on Ubuntu 18.04, upgrading `libssl1.1` asks whether to restart services,
and the job waited on that dialog until it was cancelled.
Set `DEBIAN_FRONTEND=noninteractive`,
keep existing config files without asking, and give apt no stdin.
This commit is contained in:
Jordan Harband
2026-10-08 11:10:27 -07:00
parent 50e73c4cd5
commit 077156e88f
2 changed files with 15 additions and 7 deletions
+4 -1
View File
@@ -20,11 +20,14 @@ if [ "$(id -u)" != '0' ]; then
fi
apt_get() {
# never prompt: an upgrade (e.g. libssl asking to restart services) would wait forever
$SUDO env DEBIAN_FRONTEND=noninteractive apt-get \
-o Acquire::Retries=5 \
-o Acquire::http::Timeout=30 \
-o Acquire::https::Timeout=30 \
"$@"
-o Dpkg::Options::=--force-confdef \
-o Dpkg::Options::=--force-confold \
"$@" < /dev/null
}
ATTEMPT=1