[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNARX==sMKVTGXutGMmMkfg1idGUYLhBLZvKZ0psdwmiUvQ@mail.gmail.com>
Date: Wed, 17 Jan 2024 10:32:04 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Jose Ignacio Tornos Martinez <jtornosm@...hat.com>
Cc: dcavalca@...a.com, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org, nathan@...nel.org, ndesaulniers@...gle.com,
nicolas@...sle.eu, stable@...r.kernel.org
Subject: Re: [PATCH V5 2/2] rpm-pkg: avoid install/remove the running kernel
On Sun, Jan 14, 2024 at 5:07 PM Jose Ignacio Tornos Martinez
<jtornosm@...hat.com> wrote:
>
> Normally, upper tools and scripts are checking if we want to modify the
> running kernel but not always. Check install and remove operation that
> affect the running kernel to avoid possible issues.
>
> Tested with Fedora 38, Fedora 39, RHEL 9, Oracle Linux 9.3,
> openSUSE Tumbleweed and openMandrive ROME, using dnf/zypper and rpm tools.
>
> cc: stable@...r.kernel.org
> Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@...hat.com>
> ---
> scripts/package/kernel.spec | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
> index 74542af8cbfe..216514cbf5f6 100644
> --- a/scripts/package/kernel.spec
> +++ b/scripts/package/kernel.spec
> @@ -69,6 +69,12 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
> %clean
> rm -rf %{buildroot}
>
> +%pre
> +if [ $(uname -r) == %{KERNELRELEASE} ];then
> +echo "same kernel release is running" > /dev/stderr
What is the problem with this?
> +exit 1
> +fi
> +
> %post
> if [ -x /usr/bin/kernel-install ]; then
> /usr/bin/kernel-install add %{KERNELRELEASE} /lib/modules/%{KERNELRELEASE}/vmlinuz
> @@ -85,6 +91,10 @@ fi
> done
>
> %preun
> +if [ $(uname -r) == %{KERNELRELEASE} ];then
> +echo "same kernel release is running" > /dev/stderr
> +exit 1
> +fi
> if [ -x /sbin/new-kernel-pkg ]; then
> new-kernel-pkg --remove %{KERNELRELEASE} --rminitrd --initrdfile=/boot/initramfs-%{KERNELRELEASE}.img
> elif [ -x /usr/bin/kernel-install ]; then
> --
> 2.43.0
>
>
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists