mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sascha Silbe <x-linux@se-silbe.de>
To: Masahiro Yamada <masahiroy@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] kbuild: deb-pkg: invoke linux-base scripts if installed
Date: Sun, 24 Oct 2021 15:58:38 +0200	[thread overview]
Message-ID: <20211024135838.647689-3-x-linux@se-silbe.de> (raw)
In-Reply-To: <20211024135838.647689-1-x-linux@se-silbe.de>

From: Sascha Silbe <x-linux@infra-silbe.de>

Kernel images built from source can be installed and used manually. On
systems where "flash-kernel" is used, new versions will be picked up
automatically and used on next boot. However on systems relying on
symlinks this does not happen as the symlinks are not updated, unlike
with stock Debian kernels.

To fix this invoke the scripts from linux-base if they are installed
just like the maintainer scripts of the stock Debian kernel packages
do.

Signed-off-by: Sascha Silbe <x-linux@infra-silbe.de>
---
 scripts/package/builddeb | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 91a502bb97e8a..69e0c51d324e0 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -202,6 +202,28 @@ export DEB_MAINT_PARAMS="\$*"
 # Tell initramfs builder whether it's wanted
 export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No)
 
+# Call linux-base scripts if they are installed
+if command -v linux-update-symlinks > /dev/null; then
+    if [ $script = preinst ] && [ "\$1" = install ]; then
+        mkdir -p /lib/modules/$version
+        touch /lib/modules/$version/.fresh-install
+    elif [ $script = postinst ] && [ "\$1" = configure ]; then
+        if [ -f /lib/modules/$version/.fresh-install ]; then
+            linux-update-symlinks install $version /$installed_image_path
+            rm /lib/modules/$version/.fresh-install
+        else
+            linux-update-symlinks upgrade $version /$installed_image_path
+        fi
+    elif [ $script = prerm ] && [ "\$1" = remove ]; then
+        linux-check-removal $version
+    elif [ $script = postrm ]; then
+        rm -f /lib/modules/$version/.fresh-install
+        if [ "\$1" != upgrade ]; then
+            linux-update-symlinks remove $version /$installed_image_path
+        fi
+    fi
+fi
+
 test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
 exit 0
 EOF
-- 
2.30.2


      parent reply	other threads:[~2021-10-24 14:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-24 13:58 [PATCH 0/2] kbuild: deb-pkg: fixes for use on Debian systems Sascha Silbe
2021-10-24 13:58 ` [PATCH 1/2] kbuild: deb-pkg: set dependencies for kernel image package Sascha Silbe
2021-10-24 13:58 ` Sascha Silbe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211024135838.647689-3-x-linux@se-silbe.de \
    --to=x-linux@se-silbe.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=ndesaulniers@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®