Skip to content

Commit

Permalink
Use newer kernel version when there are multiple available
Browse files Browse the repository at this point in the history
Signed-off-by: Javi Polo <[email protected]>
Signed-off-by: Mark McLoughlin <[email protected]>
  • Loading branch information
javipolo authored and markmc committed May 23, 2024
1 parent 7b691db commit e6f5997
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
12 changes: 7 additions & 5 deletions training/intel-bootc/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ RUN if [ "${OS_VERSION_MAJOR}" == "" ]; then \
export TARGET_ARCH=$(arch) ;\
fi \
&& if [ "${KERNEL_VERSION}" == "" ]; then \
RELEASE=$(dnf info --installed kernel-core | grep Release | awk -F: '{print $2}' | tr -d '[:blank:]') \
&& VERSION=$(dnf info --installed kernel-core | grep Version | awk -F: '{print $2}' | tr -d '[:blank:]') \
NEWER_KERNEL_CORE=$(dnf info kernel-core | awk -F: '/^Source/{gsub(/.src.rpm/, "", $2); print $2}' | sort -n | tail -n1) \
&& RELEASE=$(dnf info ${NEWER_KERNEL_CORE} | awk -F: '/^Release/{print $2}' | tr -d '[:blank:]') \
&& VERSION=$(dnf info ${NEWER_KERNEL_CORE} | awk -F: '/^Version/{print $2}' | tr -d '[:blank:]') \
&& export KERNEL_VERSION="${VERSION}-${RELEASE}" ;\
fi \
&& dnf install -y make git kernel-devel-${KERNEL_VERSION} \
Expand Down Expand Up @@ -62,9 +63,10 @@ ARG INSTRUCTLAB_IMAGE
ARG VLLM_IMAGE

RUN if [ "${KERNEL_VERSION}" == "" ]; then \
RELEASE=$(dnf info --installed kernel-core | grep Release | awk -F: '{print $2}' | tr -d '[:blank:]') \
&& VERSION=$(dnf info --installed kernel-core | grep Version | awk -F: '{print $2}' | tr -d '[:blank:]') \
&& export KERNEL_VERSION="${VERSION}-${RELEASE}" ;\
NEWER_KERNEL_CORE=$(dnf info kernel-core | awk -F: '/^Source/{gsub(/.src.rpm/, "", $2); print $2}' | sort -n | tail -n1) \
&& RELEASE=$(dnf info ${NEWER_KERNEL_CORE} | awk -F: '/^Release/{print $2}' | tr -d '[:blank:]') \
&& VERSION=$(dnf info ${NEWER_KERNEL_CORE} | awk -F: '/^Version/{print $2}' | tr -d '[:blank:]') \
&& export KERNEL_VERSION="${VERSION}-${RELEASE}" ;\
fi \
&& if [ "${TARGET_ARCH}" == "" ]; then \
export TARGET_ARCH=$(arch) ;\
Expand Down
5 changes: 3 additions & 2 deletions training/nvidia-bootc/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ COPY --chown=1001:0 x509-configuration.ini x509-configuration.ini
COPY build/usr /usr

RUN if [ "${KERNEL_VERSION}" == "" ]; then \
RELEASE=$(dnf info kernel-core | grep Release | awk -F: '{print $2}' | tr -d '[:blank:]') \
&& VERSION=$(dnf info kernel-core | grep Version | awk -F: '{print $2}' | tr -d '[:blank:]') \
NEWER_KERNEL_CORE=$(dnf info kernel-core | awk -F: '/^Source/{gsub(/.src.rpm/, "", $2); print $2}' | sort -n | tail -n1) \
&& RELEASE=$(dnf info ${NEWER_KERNEL_CORE} | awk -F: '/^Release/{print $2}' | tr -d '[:blank:]') \
&& VERSION=$(dnf info ${NEWER_KERNEL_CORE} | awk -F: '/^Version/{print $2}' | tr -d '[:blank:]') \
&& export KERNEL_VERSION="${VERSION}-${RELEASE}" ;\
fi \
&& if [ "${OS_VERSION_MAJOR}" == "" ]; then \
Expand Down
5 changes: 3 additions & 2 deletions training/nvidia-bootc/Containerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ ARG ENABLE_RT=''
USER root

RUN if [ "${KERNEL_VERSION}" == "" ]; then \
RELEASE=$(dnf info kernel-core | grep Release | awk -F: '{print $2}' | tr -d '[:blank:]') \
&& VERSION=$(dnf info kernel-core | grep Version | awk -F: '{print $2}' | tr -d '[:blank:]') \
NEWER_KERNEL_CORE=$(dnf info kernel-core | awk -F: '/^Source/{gsub(/.src.rpm/, "", $2); print $2}' | sort -n | tail -n1) \
&& RELEASE=$(dnf info ${NEWER_KERNEL_CORE} | awk -F: '/^Release/{print $2}' | tr -d '[:blank:]') \
&& VERSION=$(dnf info ${NEWER_KERNEL_CORE} | awk -F: '/^Version/{print $2}' | tr -d '[:blank:]') \
&& export KERNEL_VERSION="${VERSION}-${RELEASE}" ;\
fi \
&& echo "${KERNEL_VERSION}" \
Expand Down

0 comments on commit e6f5997

Please sign in to comment.