1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Fix for #14924. Seperates lsb_dist detection from dist_version detection

so that the latter can be distro specific.

Signed-off-by: Avi Miller <avi.miller@oracle.com>
This commit is contained in:
Avi Miller 2015-07-29 07:41:14 +10:00
parent 0f85fadb4e
commit 5c6446f335

View file

@ -132,54 +132,76 @@ do_install() {
dist_version='' dist_version=''
if command_exists lsb_release; then if command_exists lsb_release; then
lsb_dist="$(lsb_release -si)" lsb_dist="$(lsb_release -si)"
dist_version="$(lsb_release --codename | cut -f2)"
fi fi
if [ -z "$lsb_dist" ] && [ -r /etc/lsb-release ]; then if [ -z "$lsb_dist" ] && [ -r /etc/lsb-release ]; then
lsb_dist="$(. /etc/lsb-release && echo "$DISTRIB_ID")" lsb_dist="$(. /etc/lsb-release && echo "$DISTRIB_ID")"
dist_version="$(. /etc/lsb-release && echo "$DISTRIB_CODENAME")"
if [ -z "$dist_version" ]; then
dist_version="$(. /etc/lsb-release && echo "$DISTRIB_RELEASE")"
case "$lsb_dist" in
"Debian")
dist_version="$(get_debian_dist_version "$dist_version")"
;;
"Ubuntu")
case "$dist_version" in
"15.04")
dist_version="vivid"
;;
"14.04")
dist_version="trusty"
;;
"12.04")
dist_version="precise"
;;
esac
;;
esac
fi
fi fi
if [ -z "$lsb_dist" ] && [ -r /etc/debian_version ]; then if [ -z "$lsb_dist" ] && [ -r /etc/debian_version ]; then
lsb_dist='debian' lsb_dist='debian'
dist_version="$(cat /etc/debian_version | sed 's/\/.*//' | sed 's/\..*//')"
dist_version="$(get_debian_dist_version "$dist_version")"
fi fi
if [ -z "$lsb_dist" ] && [ -r /etc/fedora-release ]; then if [ -z "$lsb_dist" ] && [ -r /etc/fedora-release ]; then
lsb_dist='fedora' lsb_dist='fedora'
dist_version="$(rpm -q --whatprovides redhat-release --queryformat "%{VERSION}\n")" fi
if [ -z "$lsb_dist" ] && [ -r /etc/oracle-release ]; then
lsb_dist='oracleserver'
fi fi
if [ -z "$lsb_dist" ]; then if [ -z "$lsb_dist" ]; then
if [ -r /etc/centos-release ] || [ -r /etc/redhat-release ]; then if [ -r /etc/centos-release ] || [ -r /etc/redhat-release ]; then
lsb_dist='centos' lsb_dist='centos'
dist_version="$(rpm -q --whatprovides redhat-release --queryformat "%{VERSION}\n")"
fi fi
fi fi
if [ -z "$lsb_dist" ] && [ -r /etc/os-release ]; then if [ -z "$lsb_dist" ] && [ -r /etc/os-release ]; then
lsb_dist="$(. /etc/os-release && echo "$ID")" lsb_dist="$(. /etc/os-release && echo "$ID")"
dist_version="$(. /etc/os-release && echo "$VERSION_ID")"
fi fi
lsb_dist="$(echo "$lsb_dist" | tr '[:upper:]' '[:lower:]')" lsb_dist="$(echo "$lsb_dist" | tr '[:upper:]' '[:lower:]')"
case "$lsb_dist" in
ubuntu)
if command_exists lsb_release; then
dist_version="$(lsb_release --codename | cut -f2)"
fi
if [ -z "$dist_version" ] && [ -r /etc/lsb-release ]; then
dist_version="$(. /etc/lsb-release && echo "$DISTRIB_CODENAME")"
fi
;;
debian)
dist_version="$(cat /etc/debian_version | sed 's/\/.*//' | sed 's/\..*//')"
case "$dist_version" in
8)
dist_version="jessie"
;;
7)
dist_version="wheezy"
;;
esac
;;
oracleserver)
# need to switch lsb_dist to match yum repo URL
lsb_dist="oraclelinux"
dist_version="$(rpm -q --whatprovides redhat-release --queryformat "%{VERSION}\n" | sed 's/\/.*//' | sed 's/\..*//')"
;;
fedora|centos)
dist_version="$(rpm -q --whatprovides redhat-release --queryformat "%{VERSION}\n" | sed 's/\/.*//' | sed 's/\..*//')"
;;
*)
if command_exists lsb_release; then
dist_version="$(lsb_release --codename | cut -f2)"
fi
if [ -z "$dist_version" ] && [ -r /etc/os-release ]; then
dist_version="$(. /etc/os-release && echo "$VERSION_ID")"
fi
;;
esac
case "$lsb_dist" in case "$lsb_dist" in
amzn) amzn)
( (
@ -263,8 +285,8 @@ do_install() {
exit 0 exit 0
;; ;;
fedora|centos) fedora|centos|oraclelinux)
$sh_c "cat >/etc/yum.repos.d/docker-${repo}.repo" <<-EOF cat >/etc/yum.repos.d/docker-${repo}.repo <<-EOF
[docker-${repo}-repo] [docker-${repo}-repo]
name=Docker ${repo} Repository name=Docker ${repo} Repository
baseurl=https://yum.dockerproject.org/repo/${repo}/${lsb_dist}/${dist_version} baseurl=https://yum.dockerproject.org/repo/${repo}/${lsb_dist}/${dist_version}