Skip to content

Commit ce76664

Browse files
committed
Use deb822-style APT repository configuration
Refactor Docker repository setup to support new deb822 format and provide warnings for existing configurations. Signed-off-by: merlinz01 <158784988+merlinz01@users.noreply.github.com>
1 parent 2687d91 commit ce76664

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

install.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,9 +556,27 @@ do_install() {
556556
# Run setup for each distro accordingly
557557
case "$lsb_dist" in
558558
ubuntu|debian|raspbian)
559+
use_deb822=true
560+
case "$lsb_dist.$dist_version" in
561+
debian.jessie|ubuntu.trusty)
562+
use_deb822=false
563+
;;
564+
esac
559565
pre_reqs="ca-certificates curl"
560-
apt_repo="deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] $DOWNLOAD_URL/linux/$lsb_dist $dist_version $CHANNEL"
561566
(
567+
if [ "$use_deb822" = true ]; then
568+
if [ -f /etc/apt/sources.list.d/docker.list ]; then
569+
echo
570+
echo "# WARNING: An existing Docker APT repository file using the sources.list format was found at /etc/apt/sources.list.d/docker.list."
571+
echo "# Please remove this file to avoid conflicting repository settings."
572+
echo
573+
fi
574+
apt_repo="Types: deb\nURIs: $DOWNLOAD_URL/linux/$lsb_dist\nSuites: $dist_version\nComponents: $CHANNEL\nArchitectures: $(dpkg --print-architecture)\nSigned-By: /etc/apt/keyrings/docker.asc"
575+
apt_repo_file="/etc/apt/sources.list.d/docker.sources"
576+
else
577+
apt_repo="deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] $DOWNLOAD_URL/linux/$lsb_dist $dist_version $CHANNEL"
578+
apt_repo_file="/etc/apt/sources.list.d/docker.list"
579+
fi
562580
if ! is_dry_run; then
563581
set -x
564582
fi
@@ -567,7 +585,7 @@ do_install() {
567585
$sh_c 'install -m 0755 -d /etc/apt/keyrings'
568586
$sh_c "curl -fsSL \"$DOWNLOAD_URL/linux/$lsb_dist/gpg\" -o /etc/apt/keyrings/docker.asc"
569587
$sh_c "chmod a+r /etc/apt/keyrings/docker.asc"
570-
$sh_c "echo \"$apt_repo\" > /etc/apt/sources.list.d/docker.list"
588+
$sh_c "echo \"$apt_repo\" > $apt_repo_file"
571589
$sh_c 'apt-get -qq update >/dev/null'
572590
)
573591

0 commit comments

Comments
 (0)