From: Kefu Chai Date: Wed, 12 Jun 2019 04:29:45 +0000 (+0800) Subject: qa/workunits/ceph-helpers-root: use /etc/os-release instead X-Git-Tag: v14.2.3~88^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=eeaa59ea2d4228dd5457b359a221969530e6d32d;p=ceph.git qa/workunits/ceph-helpers-root: use /etc/os-release instead as lsb_release does not work on SUSE distros Signed-off-by: Kefu Chai (cherry picked from commit e8e72319aaf23f4b421af6fce865bdf6efdfc008) --- 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 }