Skip to content

Commit

Permalink
added support for amazon linux 2023 (#4973)
Browse files Browse the repository at this point in the history
* added support for al2023
  • Loading branch information
zackbradys authored Dec 13, 2023
1 parent d0b1b07 commit c1494f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 4 additions & 4 deletions bundle/bin/rke2-uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ check_target_ro() {
}

. /etc/os-release
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 ] || [ -r /etc/amazon-linux-release ]; then
# If redhat/oracle family os is detected, double check whether installation mode is yum or tar.
# yum method assumes installation root under /usr
# tar method assumes installation root under /usr/local
Expand Down Expand Up @@ -65,9 +65,9 @@ uninstall_disable_services()
}

uninstall_remove_files()
{
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 ] || [ -r /etc/amazon-linux-release ]; then
yum remove -y "rke2-*"

rm -f /etc/yum.repos.d/rancher-rke2*.repo
Expand Down
11 changes: 7 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ install_dev_rpm() {
# and calls yum to install the required packages.
do_install_rpm() {
. /etc/os-release
if [ -r /etc/redhat-release ] || [ -r /etc/centos-release ] || [ -r /etc/oracle-release ] || [ "${ID_LIKE%%[ ]*}" = "suse" ]; then
if [ -r /etc/redhat-release ] || [ -r /etc/centos-release ] || [ -r /etc/oracle-release ] || [ -r /etc/amazon-linux-release ] || [ "${ID_LIKE%%[ ]*}" = "suse" ]; then
repodir=/etc/yum.repos.d
if [ -d /etc/zypp/repos.d ]; then
repodir=/etc/zypp/repos.d
Expand All @@ -505,7 +505,10 @@ do_install_rpm() {
7|8|9)
:
;;
*) # In certain cases, like installing on Fedora, maj_ver will end up being something that is not 7 or 8
2023) # detect amazon linux 2023 distro
maj_ver="8"
;;
*) # set default distro to centos 7, for edge cases such as fedora
maj_ver="7"
;;
esac
Expand Down Expand Up @@ -560,7 +563,7 @@ gpgkey=https://${rpm_site}/public.key
EOF
fi

if rpm -q --quiet rke2-selinux; then
if rpm -q --quiet rke2-selinux; then
# remove rke2-selinux module in el9 before upgrade to allow container-selinux to upgrade safely
if check_available_upgrades container-selinux && check_available_upgrades rke2-selinux; then
MODULE_PRIORITY=$(semodule --list=full | grep rke2 | cut -f1 -d" ")
Expand Down Expand Up @@ -627,7 +630,7 @@ do_install_tar() {
}

setup_fapolicy_rules() {
if [ -r /etc/redhat-release ] || [ -r /etc/centos-release ] || [ -r /etc/oracle-release ] || [ -r /etc/rocky-release ]; then
if [ -r /etc/redhat-release ] || [ -r /etc/centos-release ] || [ -r /etc/oracle-release ] || [ -r /etc/rocky-release ] || [ -r /etc/amazon-linux-release ]; then
verify_fapolicyd || return 0
# setting rke2 fapolicyd rules
cat <<-EOF >>"/etc/fapolicyd/rules.d/80-rke2.rules"
Expand Down

0 comments on commit c1494f5

Please sign in to comment.