read version from /etc/os-release

This commit is contained in:
Pratham Patel 2024-02-10 09:23:25 +05:30
parent fd1746ab6a
commit f420775701
No known key found for this signature in database
3 changed files with 8 additions and 8 deletions

View File

@ -10,7 +10,7 @@ fi
KICKSTART_BASE="Rocky"
TODAY="$(TZ='UTC' date +%Y.%m.%d)"
KICKSTART_FILE="${KICKSTART_BASE}.ks"
APPLIANCE_NAME="${KICKSTART_BASE}-$(dnf config-manager --dump-variables | grep releasever | awk '{print $3}')-$(uname -m)-minimal-${TODAY}"
APPLIANCE_NAME="${KICKSTART_BASE}-$(source <(grep VERSION_ID /etc/os-release) && awk -F '.' '{print $1}' <<< $VERSION_ID)-$(uname -m)-minimal-${TODAY}"
IMAGE_NAME="${APPLIANCE_NAME}.raw"
COMMANDS_TO_CHECK=('appliance-creator' 'hdparm' 'shasum' 'zstd')

View File

@ -2,17 +2,17 @@
set -x
MACHINE_ARCH="$(uname -m)"
DNF_RELEASEVER="$(dnf config-manager --dump-variables | grep 'releasever' | awk '{print $3}')"
VERSION_ID="$(source <(grep VERSION_ID /etc/os-release) && awk -F '.' '{print $1}' <<< $VERSION_ID)"
# This repository is a given since it provides 'uboot-images-armv8' and
# 'uboot-tools', which are **required**.
dnf config-manager --assumeyes --add-repo "https://download.rockylinux.org/pub/sig/${DNF_RELEASEVER}/altarch/${MACHINE_ARCH}/altarch-common"
if ! dnf repolist --enabled | grep "download.rockylinux.org_pub_sig_${DNF_RELEASEVER}_altarch_${MACHINE_ARCH}_altarch-common" > /dev/null; then
dnf config-manager --set-enabled "download.rockylinux.org_pub_sig_${DNF_RELEASEVER}_altarch_${MACHINE_ARCH}_altarch-common" || exit 1
dnf config-manager --assumeyes --add-repo "https://download.rockylinux.org/pub/sig/${VERSION_ID}/altarch/${MACHINE_ARCH}/altarch-common"
if ! dnf repolist --enabled | grep "download.rockylinux.org_pub_sig_${VERSION_ID}_altarch_${MACHINE_ARCH}_altarch-common" > /dev/null; then
dnf config-manager --set-enabled "download.rockylinux.org_pub_sig_${VERSION_ID}_altarch_${MACHINE_ARCH}_altarch-common" || exit 1
fi
# import the SIG/AltArch key manually, since it does not get automatically get imported...
wget "https://download.rockylinux.org/pub/sig/${DNF_RELEASEVER}/altarch/${MACHINE_ARCH}/altarch-common/RPM-GPG-KEY-Rocky-SIG-AltArch"
wget "https://download.rockylinux.org/pub/sig/${VERSION_ID}/altarch/${MACHINE_ARCH}/altarch-common/RPM-GPG-KEY-Rocky-SIG-AltArch"
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
rpm --import RPM-GPG-KEY-Rocky-SIG-AltArch
rm RPM-GPG-KEY-Rocky-SIG-AltArch
@ -31,7 +31,7 @@ if dnf list installed | grep '@epel' > /dev/null || dnf list installed | grep 'e
fi
# SIG/kernel's kernel-mainline-sbc
dnf copr enable --assumeyes prathampatel/kernel-rocky "rhel-${DNF_RELEASEVER}-${MACHINE_ARCH}"
dnf copr enable --assumeyes prathampatel/kernel-rocky "rhel-${VERSION_ID}-${MACHINE_ARCH}"
if ! dnf repolist --enabled | grep 'copr:copr.fedorainfracloud.org:prathampatel:kernel-rocky' > /dev/null; then
dnf config-manager --set-enabled 'copr:copr.fedorainfracloud.org:prathampatel:kernel-rocky' || exit 1
fi

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
KICKSTART_FILE='../Rocky.ks'
KICKSTART_VERSION="RHEL$(dnf config-manager --dump-variables | grep releasever | awk '{print $3}')"
KICKSTART_VERSION="RHEL$(source <(grep VERSION_ID /etc/os-release) && awk -F '.' '{print $1}' <<< $VERSION_ID)"
if ! command -v ksvalidator > /dev/null; then
>&2 echo "$0: error: unable to find command 'ksvalidator'"