]> git.proxmox.com Git - ceph.git/blob - ceph/qa/workunits/rados/version_number_sanity.sh
import 15.2.0 Octopus source
[ceph.git] / ceph / qa / workunits / rados / version_number_sanity.sh
1 #!/bin/bash -ex
2 #
3 # test that ceph RPM/DEB package version matches "ceph --version"
4 # (for a loose definition of "matches")
5 #
6 source /etc/os-release
7 case $ID in
8 debian|ubuntu)
9 RPMDEB='DEB'
10 dpkg-query --show ceph-common
11 PKG_NAME_AND_VERSION=$(dpkg-query --show ceph-common)
12 ;;
13 centos|fedora|rhel|opensuse*|suse|sles)
14 RPMDEB='RPM'
15 rpm -q ceph
16 PKG_NAME_AND_VERSION=$(rpm -q ceph)
17 ;;
18 *)
19 echo "Unsupported distro ->$ID<-! Bailing out."
20 exit 1
21 esac
22 PKG_CEPH_VERSION=$(perl -e '"'"$PKG_NAME_AND_VERSION"'" =~ m/(\d+(\.\d+)+)/; print "$1\n";')
23 echo "According to $RPMDEB package, the ceph version under test is ->$PKG_CEPH_VERSION<-"
24 test -n "$PKG_CEPH_VERSION"
25 ceph --version
26 BUFFER=$(ceph --version)
27 CEPH_CEPH_VERSION=$(perl -e '"'"$BUFFER"'" =~ m/ceph version (\d+(\.\d+)+)/; print "$1\n";')
28 echo "According to \"ceph --version\", the ceph version under test is ->$CEPH_CEPH_VERSION<-"
29 test -n "$CEPH_CEPH_VERSION"
30 test "$PKG_CEPH_VERSION" = "$CEPH_CEPH_VERSION"