From a014198bd4d5dd4616e9504de50038763865f0e8 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sun, 30 Jan 2022 19:29:51 +0000 Subject: [PATCH 1/2] kmod: trigger hook only on install/update The hook does nothing on remove, so drop the "Operation = Remove" line. While we're nere, we can simplify and inline the depmod.script all together. This makes it a bit cleaner, as we add actual depmod-remove hook with next commit. Signed-off-by: Emil Velikov --- repos/core-x86_64/PKGBUILD | 8 +++----- repos/core-x86_64/{depmod.hook => depmod-install.hook} | 3 +-- repos/core-x86_64/depmod.script | 9 --------- 3 files changed, 4 insertions(+), 16 deletions(-) rename repos/core-x86_64/{depmod.hook => depmod-install.hook} (75%) delete mode 100644 repos/core-x86_64/depmod.script diff --git a/repos/core-x86_64/PKGBUILD b/repos/core-x86_64/PKGBUILD index c7849a74..c38ae4d5 100644 --- a/repos/core-x86_64/PKGBUILD +++ b/repos/core-x86_64/PKGBUILD @@ -16,12 +16,11 @@ 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-install.hook') md5sums=('e81e63acd80697d001c8d85c1acb38a0' 'SKIP' 'dd62cbf62bd8f212f51ef8c43bec9a77' - 'e179ace75721e92b04b2e145b69dab29' - '18fb3d1f6024a5a84514c8276cb3ebff') + '34e3ad2918710781f04a9b6a684cb3df') build() { cd "$pkgname-$pkgver" @@ -69,8 +68,7 @@ package() { install -Dm644 "$srcdir/depmod-search.conf" "$pkgdir/usr/lib/depmod.d/search.conf" # 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/depmod-install.hook" "$pkgdir/usr/share/libalpm/hooks/60-depmod-install.hook" } # vim: ft=sh syn=sh et diff --git a/repos/core-x86_64/depmod.hook b/repos/core-x86_64/depmod-install.hook similarity index 75% rename from repos/core-x86_64/depmod.hook rename to repos/core-x86_64/depmod-install.hook index bbb39a95..ec5149fc 100644 --- a/repos/core-x86_64/depmod.hook +++ b/repos/core-x86_64/depmod-install.hook @@ -2,12 +2,11 @@ Type = Path Operation = Install Operation = Upgrade -Operation = Remove Target = usr/lib/modules/*/ Target = !usr/lib/modules/*/?* [Action] Description = Updating module dependencies... When = PostTransaction -Exec = /usr/share/libalpm/scripts/depmod +Exec = /bin/sh -c 'while read -r f; do depmod $(basename "$f"); done' NeedsTargets diff --git a/repos/core-x86_64/depmod.script b/repos/core-x86_64/depmod.script deleted file mode 100644 index 79f1ccd3..00000000 --- a/repos/core-x86_64/depmod.script +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -while read -r f; do - if [[ -e ${f}vmlinuz ]]; then - depmod $(basename "$f") - fi -done - -# vim:set ft=sh sw=2 et: -- 2.34.1 From ed0176de4ceef726e87994e5659b741575cacced Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sun, 30 Jan 2022 19:36:15 +0000 Subject: [PATCH 2/2] kmod: add depmod-remove hook Add a hook to balance the install/update actions. Currently they update the modules.foo files from the respective linux packages. Thus upon checking - say pacman -Qkk linux - we get handful or "Modification time mismatch" warnings. Add a simple "rm /usr/lib/modules/foo/modules.*` depmod-remove hook. 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. Signed-off-by: Emil Velikov --- repos/core-x86_64/PKGBUILD | 6 ++++-- repos/core-x86_64/depmod-remove.hook | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 repos/core-x86_64/depmod-remove.hook diff --git a/repos/core-x86_64/PKGBUILD b/repos/core-x86_64/PKGBUILD index c38ae4d5..66288cb3 100644 --- a/repos/core-x86_64/PKGBUILD +++ b/repos/core-x86_64/PKGBUILD @@ -16,11 +16,12 @@ 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-install.hook') + 'depmod-install.hook' 'depmod-remove.hook') md5sums=('e81e63acd80697d001c8d85c1acb38a0' 'SKIP' 'dd62cbf62bd8f212f51ef8c43bec9a77' - '34e3ad2918710781f04a9b6a684cb3df') + '34e3ad2918710781f04a9b6a684cb3df' + '12f844201fd338baa7adab2adb375219') build() { cd "$pkgname-$pkgver" @@ -69,6 +70,7 @@ package() { # hook install -Dm644 "$srcdir/depmod-install.hook" "$pkgdir/usr/share/libalpm/hooks/60-depmod-install.hook" + install -Dm644 "$srcdir/depmod-remove.hook" "$pkgdir/usr/share/libalpm/hooks/60-depmod-remove.hook" } # vim: ft=sh syn=sh et diff --git a/repos/core-x86_64/depmod-remove.hook b/repos/core-x86_64/depmod-remove.hook new file mode 100644 index 00000000..4fff7434 --- /dev/null +++ b/repos/core-x86_64/depmod-remove.hook @@ -0,0 +1,11 @@ +[Trigger] +Type = Path +Operation = Remove +Target = usr/lib/modules/*/ +Target = !usr/lib/modules/*/?* + +[Action] +Description = Removing module dependencies... +When = PreTransaction +Exec = /bin/sh -c 'while read -r f; do rm "$f"/modules.*; done' +NeedsTargets -- 2.34.1