Improve Linux Mint Docker repository detection using UBUNTU_CODENAME
- Use UBUNTU_CODENAME from /etc/os-release for accurate Ubuntu base detection - Fallback to version mapping if UBUNTU_CODENAME not available - Fixes Docker installation on Linux Mint 22.1 where UBUNTU_CODENAME=noble - More reliable than manual version mapping 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+23
-16
@@ -196,24 +196,31 @@ install_docker() {
|
|||||||
# Add Docker GPG key
|
# Add Docker GPG key
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
|
|
||||||
# Add Docker repository with proper Ubuntu codename mapping for Linux Mint
|
# Add Docker repository with proper Ubuntu codename detection for Linux Mint
|
||||||
local ubuntu_codename
|
local ubuntu_codename
|
||||||
if [[ "$(lsb_release -is)" == "LinuxMint" ]]; then
|
if [[ "$(lsb_release -is)" == "LinuxMint" ]]; then
|
||||||
# Map Linux Mint versions to Ubuntu base versions
|
# Linux Mint provides UBUNTU_CODENAME in /etc/os-release
|
||||||
case "$(lsb_release -rs)" in
|
if [[ -f /etc/os-release ]]; then
|
||||||
"22"|"22.1"|"22.2"|"22.3")
|
ubuntu_codename=$(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -d= -f2)
|
||||||
ubuntu_codename="noble" # Ubuntu 24.04
|
fi
|
||||||
;;
|
|
||||||
"21"|"21.1"|"21.2"|"21.3")
|
# Fallback to version mapping if UBUNTU_CODENAME not found
|
||||||
ubuntu_codename="jammy" # Ubuntu 22.04
|
if [[ -z "$ubuntu_codename" ]]; then
|
||||||
;;
|
case "$(lsb_release -rs)" in
|
||||||
"20"|"20.1"|"20.2"|"20.3")
|
"22"|"22.1"|"22.2"|"22.3")
|
||||||
ubuntu_codename="focal" # Ubuntu 20.04
|
ubuntu_codename="noble" # Ubuntu 24.04
|
||||||
;;
|
;;
|
||||||
*)
|
"21"|"21.1"|"21.2"|"21.3")
|
||||||
ubuntu_codename="noble" # Default to latest LTS
|
ubuntu_codename="jammy" # Ubuntu 22.04
|
||||||
;;
|
;;
|
||||||
esac
|
"20"|"20.1"|"20.2"|"20.3")
|
||||||
|
ubuntu_codename="focal" # Ubuntu 20.04
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
ubuntu_codename="noble" # Default to latest LTS
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
ubuntu_codename=$(lsb_release -cs)
|
ubuntu_codename=$(lsb_release -cs)
|
||||||
fi
|
fi
|
||||||
|
|||||||
+23
-16
@@ -40,24 +40,31 @@ install_docker() {
|
|||||||
# Add Docker GPG key
|
# Add Docker GPG key
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
|
|
||||||
# Add Docker repository with proper Ubuntu codename mapping for Linux Mint
|
# Add Docker repository with proper Ubuntu codename detection for Linux Mint
|
||||||
local ubuntu_codename
|
local ubuntu_codename
|
||||||
if [[ "$(lsb_release -is)" == "LinuxMint" ]]; then
|
if [[ "$(lsb_release -is)" == "LinuxMint" ]]; then
|
||||||
# Map Linux Mint versions to Ubuntu base versions
|
# Linux Mint provides UBUNTU_CODENAME in /etc/os-release
|
||||||
case "$(lsb_release -rs)" in
|
if [[ -f /etc/os-release ]]; then
|
||||||
"22"|"22.1"|"22.2"|"22.3")
|
ubuntu_codename=$(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -d= -f2)
|
||||||
ubuntu_codename="noble" # Ubuntu 24.04
|
fi
|
||||||
;;
|
|
||||||
"21"|"21.1"|"21.2"|"21.3")
|
# Fallback to version mapping if UBUNTU_CODENAME not found
|
||||||
ubuntu_codename="jammy" # Ubuntu 22.04
|
if [[ -z "$ubuntu_codename" ]]; then
|
||||||
;;
|
case "$(lsb_release -rs)" in
|
||||||
"20"|"20.1"|"20.2"|"20.3")
|
"22"|"22.1"|"22.2"|"22.3")
|
||||||
ubuntu_codename="focal" # Ubuntu 20.04
|
ubuntu_codename="noble" # Ubuntu 24.04
|
||||||
;;
|
;;
|
||||||
*)
|
"21"|"21.1"|"21.2"|"21.3")
|
||||||
ubuntu_codename="noble" # Default to latest LTS
|
ubuntu_codename="jammy" # Ubuntu 22.04
|
||||||
;;
|
;;
|
||||||
esac
|
"20"|"20.1"|"20.2"|"20.3")
|
||||||
|
ubuntu_codename="focal" # Ubuntu 20.04
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
ubuntu_codename="noble" # Default to latest LTS
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
ubuntu_codename=$(lsb_release -cs)
|
ubuntu_codename=$(lsb_release -cs)
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user