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