From 05d1012eecf07ad62782ca98e2c63152aa95fa35 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 2 May 2022 10:33:32 +0000 Subject: [PATCH] add isUbuntu22 and isUbuntuVer --- linux/ubuntu/scripts/helpers/os.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/linux/ubuntu/scripts/helpers/os.sh b/linux/ubuntu/scripts/helpers/os.sh index 0ad0137..5338d1d 100755 --- a/linux/ubuntu/scripts/helpers/os.sh +++ b/linux/ubuntu/scripts/helpers/os.sh @@ -14,6 +14,17 @@ function isUbuntu20() { [[ "${VERSION_ID}" =~ ^20\.(.*)$ ]] } +function isUbuntu22() { + . /etc/os-release + [[ "${VERSION_ID}" =~ ^22\.(.*)$ ]] +} + +function isUbuntuVer() { + local ver=$1 + . /etc/os-release + [[ "${VERSION_ID}" =~ ^$ver\.(.*)$ ]] +} + function getOSVersionLabel() { . /etc/os-release echo "${VERSION_CODENAME}"