From: George Dunlap Subject: [PATCH 4/5] raisin: Change update/release parsing OSes Date: Wed, 14 Oct 2015 17:21:46 +0100 Message-ID: <1444839707-2339-5-git-send-email-george.dunlap@eu.citrix.com> References: <1444839707-2339-1-git-send-email-george.dunlap@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1444839707-2339-1-git-send-email-george.dunlap@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: George Dunlap , Stefano Stabellini , George Dunlap List-Id: xen-devel@lists.xenproject.org At the moment, something like 7.1.1503 will be parsed as RELEASE=7.1 UPDATE=1503. Change the bash string so that RELEASE=7 UPDATE=1.1503 in this case. Also add an example CentOS 7 release string, and add the RELEASE / UPDATE parsing to lsb_release as well. Signed-off-by: George Dunlap --- lib/common-functions.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/common-functions.sh b/lib/common-functions.sh index a389054..1343dc8 100644 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -103,13 +103,15 @@ function get_distro() { os_VENDOR=`lsb_release -i -s` os_RELEASE=`lsb_release -r -s` os_CODENAME=`lsb_release -c -s` - os_UPDATE="" + os_UPDATE=${os_RELEASE#*.} + os_RELEASE=${os_RELEASE%%.*} elif [[ -r /etc/redhat-release ]] then # Red Hat Enterprise Linux Server release 5.5 (Tikanga) # Red Hat Enterprise Linux Server release 7.0 Beta (Maipo) # CentOS release 5.5 (Final) # CentOS Linux release 6.0 (Final) + # CentOS Linux release 7.1.1503 (Core) # Fedora release 16 (Verne) # XenServer release 6.2.0-70446c (xenenterprise) os_CODENAME="" @@ -120,8 +122,8 @@ function get_distro() { ver=`sed -e 's/^.* \([0-9].*\) (\(.*\)).*$/\1\|\2/' /etc/redhat-release` os_CODENAME=${ver#*|} os_RELEASE=${ver%|*} - os_UPDATE=${os_RELEASE##*.} - os_RELEASE=${os_RELEASE%.*} + os_UPDATE=${os_RELEASE#*.} + os_RELEASE=${os_RELEASE%%.*} break fi done -- 2.1.4