Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Debian Codename resolving #281

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 2 additions & 30 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -242,21 +242,7 @@ check_forked() {
# We're Debian and don't even know it!
lsb_dist=debian
fi
dist_version="$(sed 's/\/.*//' /etc/debian_version | sed 's/\..*//')"
case "$dist_version" in
11)
dist_version="bullseye"
;;
10)
dist_version="buster"
;;
9)
dist_version="stretch"
;;
8)
dist_version="jessie"
;;
esac
dist_version="$(sed -n 's/^VERSION_CODENAME=//p' < /etc/os-release )"
fi
fi
fi
Expand Down Expand Up @@ -330,21 +316,7 @@ do_install() {
;;

debian|raspbian)
dist_version="$(sed 's/\/.*//' /etc/debian_version | sed 's/\..*//')"
case "$dist_version" in
11)
dist_version="bullseye"
;;
10)
dist_version="buster"
;;
9)
dist_version="stretch"
;;
8)
dist_version="jessie"
;;
esac
dist_version="$(sed -n 's/^VERSION_CODENAME=//p' < /etc/os-release )"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could take the same approach as get_distribution();

docker-install/install.sh

Lines 163 to 172 in 0225270

get_distribution() {
lsb_dist=""
# Every system that we officially support has /etc/os-release
if [ -r /etc/os-release ]; then
lsb_dist="$(. /etc/os-release && echo "$ID")"
fi
# Returning an empty string here should be alright since the
# case statements don't act unless you provide an actual value
echo "$lsb_dist"
}

if [ -r /etc/os-release ]; then
	lsb_dist="$(. /etc/os-release && echo "$VERSION_CODENAME")"
fi

However, I'm not sure how reliable codename is here, taking sid into account (on Debian); not sure if raspbian also uses sid, but if so, then it's likely that the codename doesn't always match the version.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct. Sid does not set the VERSION_CODENAME in /etc/os-release.
raspbian uses the codename of the next release "bookworm" or "testing" instead of sid.
However these versions are not present at download.docker.com which would let the script fail at that point. (or is there a testing/unstable repo?)

I would mimic the "lsb_dist=" style with the debian dist_version. lsb_dist would be for getting the os type while dist_version would get the debian/raspbian codename as ubuntu still behaves drifferent.

Suggested change
dist_version="$(sed -n 's/^VERSION_CODENAME=//p' < /etc/os-release )"
dist_version="$(. /etc/os-release && echo "$VERSION_CODENAME")"

Would that be alright?

;;

centos|rhel|sles)
Expand Down