Anything not EL7 is EL8

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson 2021-09-10 12:11:03 -07:00 committed by Brad Davidson
parent b4d8c641c6
commit 3d27804c77

View File

@ -465,9 +465,13 @@ setup_selinux() {
Please disable SELinux before installing k3s. Please disable SELinux before installing k3s.
" "
else else
maj_ver=$(echo "$VERSION_ID" | sed -E -e "s/^([0-9]+)\.?[0-9]*$/\1/")
if [ "${maj_ver:-7}" != 7 ]; then
maj_ver=8
fi
policy_hint="please install: policy_hint="please install:
yum install -y container-selinux selinux-policy-base yum install -y container-selinux selinux-policy-base
yum install -y https://${rpm_site}/k3s/${rpm_channel}/common/centos/${VERSION_ID:-7}/noarch/k3s-selinux-0.3-0.el${VERSION_ID:-7}.noarch.rpm yum install -y https://${rpm_site}/k3s/${rpm_channel}/common/centos/${maj_ver}/noarch/k3s-selinux-0.3-0.el${maj_ver}.noarch.rpm
" "
fi fi
@ -496,8 +500,7 @@ setup_selinux() {
# --- if on an el7/el8 system, install k3s-selinux # --- if on an el7/el8 system, install k3s-selinux
install_selinux_rpm() { install_selinux_rpm() {
if [ -r /etc/redhat-release ] || [ -r /etc/centos-release ] || [ -r /etc/oracle-release ]; then if [ -r /etc/redhat-release ] || [ -r /etc/centos-release ] || [ -r /etc/oracle-release ]; then
dist_version="$(. /etc/os-release && echo "$VERSION_ID")" maj_ver=$(echo "$VERSION_ID" | sed -E -e "s/^([0-9]+)\.?[0-9]*$/\1/")
maj_ver=$(echo "$dist_version" | sed -E -e "s/^([0-9]+)\.?[0-9]*$/\1/")
set +o noglob set +o noglob
$SUDO rm -f /etc/yum.repos.d/rancher-k3s-common*.repo $SUDO rm -f /etc/yum.repos.d/rancher-k3s-common*.repo
set -o noglob set -o noglob