From d53e6742473ac0f34aa998f5d2ad13d1bfefd887 Mon Sep 17 00:00:00 2001 From: LukeZGD <26163116+LukeZGD@users.noreply.github.com> Date: Wed, 21 Jun 2023 15:32:17 +0800 Subject: [PATCH] Fix Ubuntu version detecting (fix #296) --- restore.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/restore.sh b/restore.sh index 4ffe3b7..087f962 100755 --- a/restore.sh +++ b/restore.sh @@ -115,7 +115,17 @@ set_tool_paths() { # version check if [[ -n $UBUNTU_CODENAME ]]; then - ubuntu_ver="$(echo "$VERSION_ID" | cut -c -2)" + case $UBUNTU_CODENAME in + "jammy" | "kinetic" ) ubuntu_ver=22;; + "lunar" | "mantic" ) ubuntu_ver=23;; + esac + if [[ -z $ubuntu_ver ]]; then + . /etc/upstream-release/lsb-release 2>/dev/null + ubuntu_ver="$(echo "$DISTRIB_RELEASE" | cut -c -2)" + fi + if [[ -z $ubuntu_ver ]]; then + ubuntu_ver="$(echo "$VERSION_ID" | cut -c -2)" + fi elif [[ -e /etc/debian_version ]]; then debian_ver=$(cat /etc/debian_version) if [[ $debian_ver == *"sid" ]]; then