Skip to content

Commit 87887ee

Browse files
committed
Fix bugs with 2-digit major RHEL versionsin rpmpkg-setup.sh
1 parent 2c14f89 commit 87887ee

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

rpmpkg-setup.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ set -x -e -o pipefail
33

44
TARGET=$1
55

6-
MAJOR=$(echo "${TARGET}" | grep -oP '(?<=almalinux:)[89]')
7-
MINOR=$(echo "${TARGET}" | grep -oP '(?<=almalinux:[89]\.)\d+')
6+
VERSION="${TARGET#*:}"
7+
MAJOR="${VERSION%%.*}"
8+
MINOR="${VERSION#*.}"
89

910
if [[ "${MAJOR}" == "8" ]]; then
1011
rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux
11-
elif [[ "${MAJOR}" == "9" ]]; then
12-
rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux-9
12+
else
13+
rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux-${MAJOR}
1314
fi
1415

1516
mkdir -p /run/user/${UID}
@@ -27,9 +28,9 @@ dnf config-manager --enable appstream
2728
if [[ "$MAJOR" == "8" ]]; then
2829
dnf config-manager --enable powertools || true
2930
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
30-
elif [[ "$MAJOR" == "9" ]]; then
31+
else
3132
dnf config-manager --enable crb || true
32-
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
33+
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-${MAJOR}.noarch.rpm
3334
fi
3435

3536
dnf group install -y "Development Tools"

0 commit comments

Comments
 (0)