From 3c97a575dd96b0d33b707ac738fcf32cfb45b576 Mon Sep 17 00:00:00 2001 From: Vitaly Chikunov Date: Sat, 9 Apr 2022 10:57:03 +0300 Subject: [PATCH] update-kernel: Allow to define system flavour for testing purposes For Docker CI test. Signed-off-by: Vitaly Chikunov --- Dockerfile | 6 ++++-- update-kernel | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9c35242..d79f198 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,8 @@ FROM alt:sisyphus # Trace execution. SHELL ["/bin/bash", "-xec"] +ENV UPDATE_KERNEL_SYS_FLAVOUR=std-def + ARG branch=sisyphus ARG repo=http://ftp.altlinux.org/pub/distributions/archive/$branch/date ARG a=2022/01/01 @@ -24,7 +26,7 @@ COPY update-kernel remove-old-kernels /usr/sbin/ # Install base kernel for upgrading later. # Check if the kernel appeared. RUN toilet -w 150 First install && \ - update-kernel -v -t std-def -f --headers && \ + update-kernel -v -f --headers && \ ls -l /boot/vmlinuz /boot/vmlinuz-std-def /boot/initrd.img /boot/initrd-std-def.img && \ ls -l /boot/$(readlink /boot/vmlinuz) @@ -40,7 +42,7 @@ RUN \ # Update kernel. RUN toilet Upgrading && \ - update-kernel -v -t std-def -f && \ + update-kernel -v -f && \ update-kernel -v -l && \ ls -la /boot diff --git a/update-kernel b/update-kernel index dafcf4e..34d445f 100755 --- a/update-kernel +++ b/update-kernel @@ -303,9 +303,13 @@ elif [[ "$release" =~ ^(kernel-image-)?.*[-=#][0-9:]+\.[0-9.]+-[^-]+$ ]]; then fi # set kernel flavour. if not defined with -t option, use current -current_kernel_flavour=$uname_r -current_kernel_flavour="${current_kernel_flavour#*-}" -current_kernel_flavour="${current_kernel_flavour%-*}" +if [ -n "$UPDATE_KERNEL_SYS_FLAVOUR" ]; then + current_kernel_flavour=$UPDATE_KERNEL_SYS_FLAVOUR +else + current_kernel_flavour=$uname_r + current_kernel_flavour="${current_kernel_flavour#*-}" + current_kernel_flavour="${current_kernel_flavour%-*}" +fi kernel_flavour="${kernel_flavour:-$current_kernel_flavour}" ###################################################################