]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/ceph-helpers-root: use /etc/os-release instead
authorKefu Chai <kchai@redhat.com>
Wed, 12 Jun 2019 04:29:45 +0000 (12:29 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 12 Jun 2019 09:32:38 +0000 (17:32 +0800)
as lsb_release does not work on SUSE distros

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/workunits/ceph-helpers-root.sh

index d4558bba196a96a32ab06f0263c29de1a2cf7e3a..cd716a57e78d33f3af3e4e631aedfa72d35b7fe2 100755 (executable)
 
 #######################################################################
 
+function distro_id() {
+    source /etc/os-release
+    echo $ID
+}
+
 function install() {
     for package in "$@" ; do
         install_one $package
     done
-    return 0
 }
 
 function install_one() {
-    case $(lsb_release -si) in
-        Ubuntu|Debian|Devuan)
-            sudo apt-get install -y "$@"
+    case $(distro_id) in
+        ubuntu|debian|devuan)
+            sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y "$@"
             ;;
-        CentOS|Fedora|RedHatEnterpriseServer)
+        centos|fedora|rhel)
             sudo yum install -y "$@"
             ;;
-        *SUSE*)
+        opensuse*|suse|sles)
             sudo zypper --non-interactive install "$@"
             ;;
         *)
-            echo "$(lsb_release -si) is unknown, $@ will have to be installed manually."
+            echo "$(distro_id) is unknown, $@ will have to be installed manually."
             ;;
     esac
 }