From 19763545958a86d38117d6c5d9339ac2024ce4fe Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sun, 30 Jan 2022 19:36:15 +0000 Subject: [PATCH v3] kmod: add modules-remove hook Add a hook to balance the generation of the mutable modules.foo files. Currently the depmod hook (re)generates the files, for a given linux package. Thus validating the file via `pacman -Qkk linux-foo` triggers a handful of "Modification time mismatch" warnings. With this we can have the complete ownership of the files generated by depmod. As follow-up we'll drop them from the respective linux packages. v2: Remove only the files we've generated. v3: Trigger on pkgbase (aka linux-foo) removal, rename s/depmod/modules/ Signed-off-by: Emil Velikov --- repos/core-x86_64/PKGBUILD | 9 +++++++-- repos/core-x86_64/modules-remove.hook | 10 ++++++++++ repos/core-x86_64/modules-remove.script | 10 ++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 repos/core-x86_64/modules-remove.hook create mode 100644 repos/core-x86_64/modules-remove.script diff --git a/repos/core-x86_64/PKGBUILD b/repos/core-x86_64/PKGBUILD index b9364aae..debab14b 100644 --- a/repos/core-x86_64/PKGBUILD +++ b/repos/core-x86_64/PKGBUILD @@ -16,12 +16,15 @@ replaces=('module-init-tools') validpgpkeys=('EAB33C9690013C733916AC839BA2A5A630CBEA53') # Lucas DeMarchi source=("https://www.kernel.org/pub/linux/utils/kernel/$pkgname/$pkgname-$pkgver.tar."{xz,sign} 'depmod-search.conf' - 'depmod.hook' 'depmod.script') + 'depmod.hook' 'depmod.script' + 'modules-remove.hook' 'modules-remove.script') md5sums=('e81e63acd80697d001c8d85c1acb38a0' 'SKIP' 'dd62cbf62bd8f212f51ef8c43bec9a77' 'e179ace75721e92b04b2e145b69dab29' - '18fb3d1f6024a5a84514c8276cb3ebff') + '18fb3d1f6024a5a84514c8276cb3ebff' + 'e0a533803d17166bf5c12f0a63fdcf1f' + 'effa2608b734649bc20bf783cc7f42cf') build() { cd "$pkgname-$pkgver" @@ -71,6 +74,8 @@ package() { # hook install -Dm644 "$srcdir/depmod.hook" "$pkgdir/usr/share/libalpm/hooks/60-depmod.hook" install -Dm755 "$srcdir/depmod.script" "$pkgdir/usr/share/libalpm/scripts/depmod" + install -Dm644 "$srcdir/modules-remove.hook" "$pkgdir/usr/share/libalpm/hooks/60-modules-remove.hook" + install -Dm755 "$srcdir/modules-remove.script" "$pkgdir/usr/share/libalpm/scripts/modules-remove" } # vim: ft=sh syn=sh et diff --git a/repos/core-x86_64/modules-remove.hook b/repos/core-x86_64/modules-remove.hook new file mode 100644 index 00000000..9adf89ee --- /dev/null +++ b/repos/core-x86_64/modules-remove.hook @@ -0,0 +1,10 @@ +[Trigger] +Type = Path +Operation = Remove +Target = usr/lib/modules/*/pkgbase + +[Action] +Description = Removing mutable module files... +When = PreTransaction +Exec = /usr/share/libalpm/scripts/modules-remove +NeedsTargets diff --git a/repos/core-x86_64/modules-remove.script b/repos/core-x86_64/modules-remove.script new file mode 100644 index 00000000..afe95eec --- /dev/null +++ b/repos/core-x86_64/modules-remove.script @@ -0,0 +1,10 @@ +#!/bin/bash + +while read -r line; do + moddir="${line%/pkgbase}" + for e in alias{,.bin} builtin{,.alias}.bin dep{,.bin} devname softdep symbols{,.bin}; do + rm -f "$moddir/modules.$e" + done +done + +# vim:set ft=sh sw=2 et: -- 2.35.1