Skip to content

Commit

Permalink
Merge pull request #516 from Oats87/el7el8-install
Browse files Browse the repository at this point in the history
Switch EL repo version based on detected EL version
  • Loading branch information
Oats87 authored Nov 4, 2020
2 parents c535497 + 16cb83f commit db31b3d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,29 @@ do_install_rpm() {
if [ "${1}" = "testing" ]; then
rpm_site="rpm-${1}.rancher.io"
fi
maj_ver="7"
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 "$dist_version" | sed -E -e "s/^([0-9]+)\.?[0-9]*$/\1/")
case ${maj_ver} in
7|8)
:
;;
*) # In certain cases, like installing on Fedora, maj_ver will end up being something that is not 7 or 8
maj_ver="7"
;;
esac
fi
cat <<-EOF >"/etc/yum.repos.d/rancher-rke2-${1}.repo"
[rancher-rke2-common-${1}]
name=Rancher RKE2 Common (${1})
baseurl=https://${rpm_site}/rke2/${1}/common/centos/7/noarch
baseurl=https://${rpm_site}/rke2/${1}/common/centos/${maj_ver}/noarch
enabled=1
gpgcheck=1
gpgkey=https://${rpm_site}/public.key
[rancher-rke2-1-18-${1}]
name=Rancher RKE2 1.18 (${1})
baseurl=https://${rpm_site}/rke2/${1}/1.18/centos/7/x86_64
baseurl=https://${rpm_site}/rke2/${1}/1.18/centos/${maj_ver}/x86_64
enabled=1
gpgcheck=1
gpgkey=https://${rpm_site}/public.key
Expand Down

0 comments on commit db31b3d

Please sign in to comment.