From e8e72319aaf23f4b421af6fce865bdf6efdfc008 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 12 Jun 2019 12:29:45 +0800 Subject: [PATCH] qa/workunits/ceph-helpers-root: use /etc/os-release instead as lsb_release does not work on SUSE distros Signed-off-by: Kefu Chai --- qa/workunits/ceph-helpers-root.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/qa/workunits/ceph-helpers-root.sh b/qa/workunits/ceph-helpers-root.sh index d4558bba196..cd716a57e78 100755 --- a/qa/workunits/ceph-helpers-root.sh +++ b/qa/workunits/ceph-helpers-root.sh @@ -17,26 +17,30 @@ ####################################################################### +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 } -- 2.39.5