Skip to content

Commit bbed7c4

Browse files
committed
Add AlmaLinux support and fix file permissions for sudo execution
- Add AlmaLinux detection alongside RHEL and Rocky Linux - Add almalinux-release version detection for AlmaLinux systems - Fix file ownership when script runs as root via sudo to prevent permission issues Signed-off-by: kcaisley <[email protected]>
1 parent 3bbfc26 commit bbed7c4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

etc/DependencyInstaller.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,11 +933,13 @@ case "${os}" in
933933
_installOrTools "ubuntu" "${ubuntuVersion}" "amd64"
934934
fi
935935
;;
936-
"Red Hat Enterprise Linux" | "Rocky Linux")
936+
"Red Hat Enterprise Linux" | "Rocky Linux" | "AlmaLinux")
937937
if [[ "${os}" == "Red Hat Enterprise Linux" ]]; then
938938
rhelVersion=$(rpm -q --queryformat '%{VERSION}' redhat-release | cut -d. -f1)
939939
elif [[ "${os}" == "Rocky Linux" ]]; then
940940
rhelVersion=$(rpm -q --queryformat '%{VERSION}' rocky-release | cut -d. -f1)
941+
elif [[ "${os}" == "AlmaLinux" ]]; then
942+
rhelVersion=$(rpm -q --queryformat '%{VERSION}' almalinux-release | cut -d. -f1)
941943
fi
942944
if [[ "${rhelVersion}" != "8" ]] && [[ "${rhelVersion}" != "9" ]]; then
943945
echo "ERROR: Unsupported ${rhelVersion} version. Versions '8' and '9' are supported."
@@ -1018,4 +1020,8 @@ esac
10181020
if [[ ! -z ${saveDepsPrefixes} ]]; then
10191021
mkdir -p "$(dirname $saveDepsPrefixes)"
10201022
echo "$CMAKE_PACKAGE_ROOT_ARGS" > $saveDepsPrefixes
1023+
# Fix permissions if running as root to allow user access
1024+
if [[ $(id -u) == 0 && ! -z "$SUDO_USER" ]]; then
1025+
chown "$SUDO_USER:$(id -gn "$SUDO_USER")" "$saveDepsPrefixes" 2>/dev/null || true
1026+
fi
10211027
fi

0 commit comments

Comments
 (0)