From e37ddadc3f601de2e0df32735c6e84808e288453 Mon Sep 17 00:00:00 2001 From: Nuno do Carmo Date: Thu, 29 Apr 2021 14:45:14 +0200 Subject: [PATCH 1/2] Handle CentOS forks Since CentOS 8 going into a rolling release mode with CentOS Stream, new forks have appeared for keeping the "stable release". The first one to be available is Almalinux and the current script does not support it. This PR addresses this gap, and as I don't yet the name/IDs of the future forks, I decided to go with a `case` statement, as it will be easier to manage in the long run. By adding the `case` statement in the `get_distribution()` function, this avoids any impact on the creation of the distribution URL used in the script. Signed-off-by: nunix corsair@hey.com --- install.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/install.sh b/install.sh index d8708bb3..6d6d9d4e 100755 --- a/install.sh +++ b/install.sh @@ -120,6 +120,13 @@ get_distribution() { if [ -r /etc/os-release ]; then lsb_dist="$(. /etc/os-release && echo "$ID")" fi + # Updates the "lsb_dist" variable for the CentOS forks + # new IDs will be updated in the future. + case "$lsb_dist" in + almalinux) + lsb_dist="centos" + ;; + esac # Returning an empty string here should be alright since the # case statements don't act unless you provide an actual value echo "$lsb_dist" From d4716364808e26093a8fde88ebc94cc99b5cef3f Mon Sep 17 00:00:00 2001 From: Nuno do Carmo Date: Sat, 1 May 2021 18:15:35 +0200 Subject: [PATCH 2/2] Changed the check for Red Hat forks Instead of checking for the new CentOS forks IDs, the check is made on the file "redhat-release". This should include any future fork without the need to update this script. I kept the check in the "get_distribution()" function, but let me know if it would make sense to have a "check_forked_redhat()" function instead, in order to stay aligned with the current script logic. --- install.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 6d6d9d4e..e6e0b808 100755 --- a/install.sh +++ b/install.sh @@ -121,12 +121,13 @@ get_distribution() { lsb_dist="$(. /etc/os-release && echo "$ID")" fi # Updates the "lsb_dist" variable for the CentOS forks - # new IDs will be updated in the future. - case "$lsb_dist" in - almalinux) + # by checking the file "redhat-release" present in the Red Hat based distros. + if [ -r /etc/redhat-release ]; then + if ! egrep -i "centos|redhat|red hat|fedora" /etc/redhat-release; then + echo "Forked distribution, switching to CentOS ID" lsb_dist="centos" - ;; - esac + fi + fi # Returning an empty string here should be alright since the # case statements don't act unless you provide an actual value echo "$lsb_dist"