Commit 851767b8 authored by Chris Kim's avatar Chris Kim

Add additional conditional logic to install.sh to prevent errors on Fedora or…

Add additional conditional logic to install.sh to prevent errors on Fedora or systems when run as non-root Signed-off-by: 's avatarChris Kim <oats87g@gmail.com>
parent f8a4547b
...@@ -469,11 +469,21 @@ install_selinux_rpm() { ...@@ -469,11 +469,21 @@ 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")" dist_version="$(. /etc/os-release && echo "$VERSION_ID")"
maj_ver=$(echo "$dist_version" | sed -E -e "s/^([0-9]+)\.?[0-9]*$/\1/") maj_ver=$(echo "$dist_version" | sed -E -e "s/^([0-9]+)\.?[0-9]*$/\1/")
if [ -r /etc/redhat-release ] && [ "${maj_ver}" = "7" ]; then if [ -r /etc/redhat-release ]; then
yum -y install yum-utils case ${maj_ver} in
yum-config-manager --enable rhel-7-server-extras-rpms 7)
$SUDO yum -y install yum-utils
$SUDO yum-config-manager --enable rhel-7-server-extras-rpms
;;
8)
:
;;
*)
return
;;
esac
fi fi
cat <<-EOF >"/etc/yum.repos.d/rancher-k3s-common-${INSTALL_K3S_CHANNEL}.repo" $SUDO tee /etc/yum.repos.d/rancher-k3s-common-${INSTALL_K3S_CHANNEL}.repo >/dev/null << EOF
[rancher-k3s-common-${INSTALL_K3S_CHANNEL}] [rancher-k3s-common-${INSTALL_K3S_CHANNEL}]
name=Rancher K3s Common (${INSTALL_K3S_CHANNEL}) name=Rancher K3s Common (${INSTALL_K3S_CHANNEL})
baseurl=https://${1}/k3s/${INSTALL_K3S_CHANNEL}/common/centos/${maj_ver}/noarch baseurl=https://${1}/k3s/${INSTALL_K3S_CHANNEL}/common/centos/${maj_ver}/noarch
...@@ -481,7 +491,7 @@ enabled=1 ...@@ -481,7 +491,7 @@ enabled=1
gpgcheck=1 gpgcheck=1
gpgkey=https://${1}/public.key gpgkey=https://${1}/public.key
EOF EOF
yum -y install "k3s-selinux" $SUDO yum -y install "k3s-selinux"
fi fi
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment