mirror of https://github.com/zulip/zulip.git
provision: Add RHEL 7 support.
This commit is contained in:
parent
84c968ab36
commit
acbb174100
|
@ -3,9 +3,20 @@ set -x
|
|||
set -e
|
||||
|
||||
is_centos=false
|
||||
is_rhel=false
|
||||
is_rhel_registered=false
|
||||
if [ -e /etc/centos-release ]; then
|
||||
is_centos=true
|
||||
yum install -y epel-release
|
||||
elif grep -q "Red Hat" /etc/redhat-release; then
|
||||
is_rhel=true
|
||||
yum localinstall -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
||||
if subscription-manager status; then
|
||||
# See https://access.redhat.com/discussions/2217891#comment-1032701
|
||||
is_rhel_registered=true
|
||||
# libmemcached-devel can be installed directly if the machine is registered
|
||||
subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"
|
||||
fi
|
||||
fi
|
||||
yum update -y
|
||||
|
||||
|
@ -22,6 +33,13 @@ if [ "$is_centos" = true ]; then
|
|||
# PGroonga
|
||||
# https://pgroonga.github.io/install/centos.html
|
||||
yum localinstall -y https://packages.groonga.org/centos/groonga-release-latest.noarch.rpm
|
||||
elif [ "$is_rhel" = true ]; then
|
||||
if [ "$is_rhel_registered" = false ]; then
|
||||
echo "This machine is unregistered; installing libmemcached-devel from a CentOS mirror ..."
|
||||
yum localinstall -y http://mirror.centos.org/centos/7/os/x86_64/Packages/libmemcached-devel-1.0.16-5.el7.x86_64.rpm
|
||||
fi
|
||||
yum localinstall -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-latest-x86_64/pgdg-redhat10-10-2.noarch.rpm
|
||||
yum localinstall -y https://packages.groonga.org/centos/groonga-release-latest.noarch.rpm
|
||||
else
|
||||
# TODO only fedora29 for now
|
||||
dnf install -y "https://download.postgresql.org/pub/repos/yum/$PGVER/fedora/fedora-29-x86_64/pgdg-fedora$PGVER-$PGVER-4.noarch.rpm"
|
||||
|
|
|
@ -329,12 +329,16 @@ def parse_lsb_release():
|
|||
with open('/etc/redhat-release', 'r') as fp:
|
||||
info = fp.read().strip().split(' ')
|
||||
vendor = info[0]
|
||||
if os.path.exists("/etc/centos-release"):
|
||||
if vendor == 'Centos':
|
||||
# E.g. "CentOS Linux release 7.5.1804 (Core)"
|
||||
codename = vendor.lower() + info[3][0]
|
||||
else:
|
||||
elif vendor == 'Fedora':
|
||||
# E.g. "Fedora release 29 (Twenty Nine)"
|
||||
codename = vendor.lower() + info[2]
|
||||
elif vendor == 'Red':
|
||||
# E.g. "Red Hat Enterprise Linux Server release 7.6 (Maipo)"
|
||||
vendor = 'RedHat'
|
||||
codename = 'rhel' + info[6][0] # 7
|
||||
distro_info = dict(
|
||||
DISTRIB_CODENAME=codename,
|
||||
DISTRIB_ID=vendor
|
||||
|
|
|
@ -43,6 +43,9 @@ SUPPORTED_PLATFORMS = {
|
|||
],
|
||||
"Fedora": [
|
||||
"fedora29",
|
||||
],
|
||||
"RedHat": [
|
||||
"rhel7",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -116,7 +119,7 @@ if (not is_rhel_based) and (not os.path.exists("/usr/bin/lsb_release")):
|
|||
distro_info = parse_lsb_release()
|
||||
vendor = distro_info['DISTRIB_ID']
|
||||
codename = distro_info['DISTRIB_CODENAME']
|
||||
family = 'redhat' if vendor in ['CentOS', 'Fedora'] else 'debian'
|
||||
family = 'redhat' if vendor in ['CentOS', 'Fedora', 'RedHat'] else 'debian'
|
||||
if not (vendor in SUPPORTED_PLATFORMS and codename in SUPPORTED_PLATFORMS[vendor]):
|
||||
logging.critical("Unsupported platform: {} {}".format(vendor, codename))
|
||||
sys.exit(1)
|
||||
|
@ -128,6 +131,7 @@ POSTGRES_VERSION_MAP = {
|
|||
"bionic": "10",
|
||||
"centos7": "10",
|
||||
"fedora29": "10",
|
||||
"rhel7": "10",
|
||||
}
|
||||
POSTGRES_VERSION = POSTGRES_VERSION_MAP[codename]
|
||||
|
||||
|
@ -175,7 +179,7 @@ if vendor in ["Ubuntu", "Debian"]:
|
|||
"postgresql-{0}-pgroonga",
|
||||
]
|
||||
]
|
||||
elif vendor == "CentOS":
|
||||
elif vendor in ["CentOS", "RedHat"]:
|
||||
SYSTEM_DEPENDENCIES = COMMON_YUM_DEPENDENCIES + [
|
||||
pkg.format(POSTGRES_VERSION) for pkg in [
|
||||
"postgresql{0}-server",
|
||||
|
@ -265,7 +269,26 @@ def install_yum_deps(deps_to_install, retry=False):
|
|||
# type: (List[str], bool) -> None
|
||||
print(WARNING + "RedHat support is still experimental.")
|
||||
run(["sudo", "./scripts/lib/setup-yum-repo"])
|
||||
run(["sudo", "yum", "install", "-y"] + deps_to_install)
|
||||
|
||||
# Hack specific to unregistered RHEL system. The moreutils
|
||||
# package requires a perl module package, which isn't available in
|
||||
# the unregistered RHEL repositories.
|
||||
#
|
||||
# Error: Package: moreutils-0.49-2.el7.x86_64 (epel)
|
||||
# Requires: perl(IPC::Run)
|
||||
yum_extra_flags = [] # type: List[str]
|
||||
if vendor == 'RedHat':
|
||||
exitcode, subs_status = subprocess.getstatusoutput("sudo subscription-manager status")
|
||||
if exitcode == 1:
|
||||
# TODO this might overkill since `subscription-manager` is already
|
||||
# called in setup-yum-repo
|
||||
if 'Status' in subs_status:
|
||||
# The output is well-formed
|
||||
yum_extra_flags = ["--skip-broken"]
|
||||
else:
|
||||
print("Unrecognized output. `subscription-manager` might not be available")
|
||||
|
||||
run(["sudo", "yum", "install", "-y"] + yum_extra_flags + deps_to_install)
|
||||
postgres_dir = 'pgsql-%s' % (POSTGRES_VERSION,)
|
||||
for cmd in ['pg_config', 'pg_isready', 'psql']:
|
||||
# Our tooling expects these postgres scripts to be at
|
||||
|
|
Loading…
Reference in New Issue