Merge pull request #319 from liranmauda/liran-fix-bootstrap-for-version-8

Fixing bootstap for RHEL/Centos 8
This commit is contained in:
Ali Maredia 2019-11-21 13:10:56 -05:00 committed by GitHub
commit 2bd8af524c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,8 +1,11 @@
#!/bin/sh #!/bin/sh
set -e set -e
virtualenv="virtualenv"
packages=(which)
if [ -f /etc/debian_version ]; then if [ -f /etc/debian_version ]; then
for package in python-pip python-virtualenv python-dev libevent-dev libffi-dev libxml2-dev libxslt-dev zlib1g-dev; do packages+=(python-pip python-virtualenv python-dev libevent-dev libffi-dev libxml2-dev libxslt-dev zlib1g-dev)
for package in ${packages[@]}; do
if [ "$(dpkg --status -- $package 2>/dev/null|sed -n 's/^Status: //p')" != "install ok installed" ]; then if [ "$(dpkg --status -- $package 2>/dev/null|sed -n 's/^Status: //p')" != "install ok installed" ]; then
# add a space after old values # add a space after old values
missing="${missing:+$missing }$package" missing="${missing:+$missing }$package"
@ -12,29 +15,34 @@ if [ -f /etc/debian_version ]; then
echo "$0: missing required DEB packages. Installing via sudo." 1>&2 echo "$0: missing required DEB packages. Installing via sudo." 1>&2
sudo apt-get -y install $missing sudo apt-get -y install $missing
fi fi
elif [ -f /etc/fedora-release ]; then else
for package in python2-pip python2-virtualenv python2-devel libevent-devel libffi-devel libxml2-devel libxslt-devel zlib-devel; do packages+=(libevent-devel libffi-devel libxml2-devel libxslt-devel zlib-devel)
if [ "$(rpm -qa $package 2>/dev/null)" == "" ]; then if [ -f /etc/fedora-release ]; then
missing="${missing:+$missing }$package" packages+=(python2-pip python2-virtualenv python2-devel)
fi elif [ -f /etc/redhat-release ]; then
done unset ${GREP_OPTIONS}
if [ -n "$missing" ]; then eval $(cat /etc/os-release | grep VERSION_ID)
echo "$0: missing required RPM packages. Installing via sudo." 1>&2 if [ ${VERSION_ID:0:1} -lt 8 ]; then
sudo yum -y install $missing packages+=(python-virtualenv python-devel)
fi else
elif [ -f /etc/redhat-release ]; then packages+=(python2-virtualenv python2-devel)
for package in python-virtualenv python-devel libevent-devel libffi-devel libxml2-devel libxslt-devel zlib-devel; do virtualenv="virtualenv-2"
fi
fi
for package in ${packages[@]}; do
if [ "$(rpm -qa $package 2>/dev/null)" == "" ]; then if [ "$(rpm -qa $package 2>/dev/null)" == "" ]; then
missing="${missing:+$missing }$package" missing="${missing:+$missing }$package"
fi fi
done done
if [ -n "$missing" ]; then if [ -n "$missing" ]; then
echo "$0: missing required RPM packages. Installing via sudo." 1>&2 echo "$0: missing required RPM packages. Installing via sudo." 1>&2
sudo yum -y install $missing sudo yum -y install $missing
fi fi
fi fi
virtualenv --python=$(which python2) --no-site-packages --distribute virtualenv ${virtualenv} --python=$(which python2) --no-site-packages --distribute virtualenv
# avoid pip bugs # avoid pip bugs
./virtualenv/bin/pip install --upgrade pip ./virtualenv/bin/pip install --upgrade pip