Merge "Support DNF based OS"

This commit is contained in:
Zuul 2020-11-20 05:11:23 +00:00 committed by Gerrit Code Review
commit c9ba649e26

View File

@ -101,10 +101,19 @@ if [ -n "$(command -v apt-get)" ]; then
elif [ -n "$(command -v yum)" ]; then elif [ -n "$(command -v yum)" ]; then
# For yum-based distributions (RHEL, Centos) # For yum-based distributions (RHEL, Centos)
# If we run script in container we need sudo # If we run script in container we need sudo
DNF_COMMAND=yum
if [ ! -f sudo ]; then if [ ! -f sudo ]; then
yum -y install sudo ${DNF_COMMAND} -y install sudo
fi fi
sudo yum -y install git sudo ${DNF_COMMAND} -y install git
elif [ -n "$(command -v dnf)" ]; then
# For dnf-based distributions (Centos>8, Fedora)
# If we run script in container we need sudo
DNF_COMMAND=dnf
if [ ! -f sudo ]; then
${DNF_COMMAND} -y install sudo
fi
sudo ${DNF_COMMAND} -y install git
elif [ -n "$(command -v zypper)" ]; then elif [ -n "$(command -v zypper)" ]; then
# For zypper-based distributions (openSUSE, SELS) # For zypper-based distributions (openSUSE, SELS)
# If we run script in container we need sudo # If we run script in container we need sudo
@ -116,7 +125,7 @@ elif [ -n "$(command -v zypper)" ]; then
fi fi
sudo zypper --non-interactive install git sudo zypper --non-interactive install git
else else
echo "Neither apt-get, nor yum, nor zypper found" echo "Neither apt-get, nor yum, nor dnf, nor zypper found"
exit 1 exit 1
fi fi
@ -134,14 +143,14 @@ cd ${WORKDIR}
if [ -n "$(command -v apt-get)" ]; then if [ -n "$(command -v apt-get)" ]; then
# For apt-get-based Linux distributions (Ubuntu, Debian) # For apt-get-based Linux distributions (Ubuntu, Debian)
sudo apt-get -y install curl wget tar unzip python-dev build-essential libssl-dev libxslt-dev libsasl2-dev libffi-dev libbz2-dev libyaml-dev python3-dev sudo apt-get -y install curl wget tar unzip python-dev build-essential libssl-dev libxslt-dev libsasl2-dev libffi-dev libbz2-dev libyaml-dev python3-dev
elif [ -n "$(command -v yum)" ]; then elif [ -n "$DNF_COMMAND" -a -n "$(command -v ${DNF_COMMAND})" ]; then
# For yum-based distributions (RHEL, Centos) # For yum/dnf-based distributions (RHEL, Centos)
sudo yum -y install curl wget tar unzip make gcc gcc-c++ libffi-devel libxml2-devel bzip2-devel libxslt-devel openssl-devel sudo ${DNF_COMMAND} -y install curl wget tar unzip make gcc gcc-c++ libffi-devel libxml2-devel bzip2-devel libxslt-devel openssl-devel
if [[ ${PY_VERSION::1} == "2" ]]; then if [[ ${PY_VERSION::1} == "2" ]]; then
sudo yum -y install python-devel libyaml-devel sudo ${DNF_COMMAND} -y install python-devel libyaml-devel
else else
# python3 dependencies # python3 dependencies
sudo yum -y install python3-devel sudo ${DNF_COMMAND} -y install python3-devel
fi fi
elif [ -n "$(command -v zypper)" ]; then elif [ -n "$(command -v zypper)" ]; then
# For zypper-based distributions (openSUSE, SELS) # For zypper-based distributions (openSUSE, SELS)