mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Add additional conditional logic to install.sh to prevent errors on Fedora or systems when run as non-root
Signed-off-by: Chris Kim <oats87g@gmail.com>
This commit is contained in:
parent
0521756dd9
commit
a8275838d5
20
install.sh
20
install.sh
@ -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
|
|||||||
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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user