From 4fd78ec40f4534d4fd1d9e1527ac7664d97afc8d Mon Sep 17 00:00:00 2001 From: Stephen Klein Date: Sat, 19 Jul 2025 22:23:17 -0400 Subject: [PATCH] Improve Linux Mint Docker repository detection using UBUNTU_CODENAME MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- lib/privileges.sh | 39 +++++++++++++++++++++++---------------- privileged-setup | 39 +++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 32 deletions(-) diff --git a/lib/privileges.sh b/lib/privileges.sh index 398a6a8..120cb28 100755 --- a/lib/privileges.sh +++ b/lib/privileges.sh @@ -196,24 +196,31 @@ install_docker() { # Add Docker GPG key 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 if [[ "$(lsb_release -is)" == "LinuxMint" ]]; then - # Map Linux Mint versions to Ubuntu base versions - case "$(lsb_release -rs)" in - "22"|"22.1"|"22.2"|"22.3") - ubuntu_codename="noble" # Ubuntu 24.04 - ;; - "21"|"21.1"|"21.2"|"21.3") - ubuntu_codename="jammy" # Ubuntu 22.04 - ;; - "20"|"20.1"|"20.2"|"20.3") - ubuntu_codename="focal" # Ubuntu 20.04 - ;; - *) - ubuntu_codename="noble" # Default to latest LTS - ;; - esac + # Linux Mint provides UBUNTU_CODENAME in /etc/os-release + if [[ -f /etc/os-release ]]; then + ubuntu_codename=$(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -d= -f2) + fi + + # Fallback to version mapping if UBUNTU_CODENAME not found + if [[ -z "$ubuntu_codename" ]]; then + case "$(lsb_release -rs)" in + "22"|"22.1"|"22.2"|"22.3") + ubuntu_codename="noble" # Ubuntu 24.04 + ;; + "21"|"21.1"|"21.2"|"21.3") + ubuntu_codename="jammy" # Ubuntu 22.04 + ;; + "20"|"20.1"|"20.2"|"20.3") + ubuntu_codename="focal" # Ubuntu 20.04 + ;; + *) + ubuntu_codename="noble" # Default to latest LTS + ;; + esac + fi else ubuntu_codename=$(lsb_release -cs) fi diff --git a/privileged-setup b/privileged-setup index 0e9bce6..c8a4407 100755 --- a/privileged-setup +++ b/privileged-setup @@ -40,24 +40,31 @@ install_docker() { # Add Docker GPG key 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 if [[ "$(lsb_release -is)" == "LinuxMint" ]]; then - # Map Linux Mint versions to Ubuntu base versions - case "$(lsb_release -rs)" in - "22"|"22.1"|"22.2"|"22.3") - ubuntu_codename="noble" # Ubuntu 24.04 - ;; - "21"|"21.1"|"21.2"|"21.3") - ubuntu_codename="jammy" # Ubuntu 22.04 - ;; - "20"|"20.1"|"20.2"|"20.3") - ubuntu_codename="focal" # Ubuntu 20.04 - ;; - *) - ubuntu_codename="noble" # Default to latest LTS - ;; - esac + # Linux Mint provides UBUNTU_CODENAME in /etc/os-release + if [[ -f /etc/os-release ]]; then + ubuntu_codename=$(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -d= -f2) + fi + + # Fallback to version mapping if UBUNTU_CODENAME not found + if [[ -z "$ubuntu_codename" ]]; then + case "$(lsb_release -rs)" in + "22"|"22.1"|"22.2"|"22.3") + ubuntu_codename="noble" # Ubuntu 24.04 + ;; + "21"|"21.1"|"21.2"|"21.3") + ubuntu_codename="jammy" # Ubuntu 22.04 + ;; + "20"|"20.1"|"20.2"|"20.3") + ubuntu_codename="focal" # Ubuntu 20.04 + ;; + *) + ubuntu_codename="noble" # Default to latest LTS + ;; + esac + fi else ubuntu_codename=$(lsb_release -cs) fi