fix(install): match deb822 docker.sources across lines

In a deb822 .sources file the URIs and Suites fields are on separate
lines, so the single-line grep never matched and the broken Docker
repo was left in place. Match the URI and the distro id separately
across the whole file, and skip the check when the id is empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jackybabes
2026-11-21 15:53:05 +00:00
co-authored by Claude Opus 5.5
parent 61478bb90b
commit c90e2c980c
+6 -1
View File
@@ -61,9 +61,14 @@ install_docker_linux(){
|| die "automatic Docker install is not supported on '${id:-unknown}'; please install docker + the compose plugin yourself and retry"
info "'${id:-unknown}' (like: ${id_like:-n/a}) is not supported by get.docker.com; installing from the distro's apt repos"
# Drop a broken repo left by an earlier get.docker.com run (it fails every apt update).
# Match the URI and the distro id anywhere in the file: in a one-line .list entry
# they share a line, but in a deb822 .sources file the URIs and Suites fields are
# on separate lines. -w keeps "kali" matching inside "kali-rolling".
local f
for f in /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.sources; do
if [ -f "$f" ] && grep -q "download.docker.com/linux/debian.*${id}" "$f" 2>/dev/null; then
if [ -n "$id" ] && [ -f "$f" ] \
&& grep -qF "download.docker.com/linux/debian" "$f" 2>/dev/null \
&& grep -qwF "$id" "$f" 2>/dev/null; then
warn "removing broken Docker repo $f"
sudo rm -f "$f"
fi