Skip to contentSkip to conversation

kbuild: deb-pkg: do not include empty hook directories

PATCH In review Masahiro Yamada 1 participant 2 messages Dec 3, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: deb-pkg: do not include empty hook directories

The linux-image package currently includes empty hook directories (/etc/kernel/{pre,post}{inst,rm}.d/ by default).

These directories were perhaps intended as a fail-safe in case no hook scripts exist there.

However, they are unnecessary because the run-parts command is already guarded by the following check:

    test -d ${debhookdir}/${script}.d && run-parts ...

The only difference is that the run-parts command either runs for empty directories (resulting in a no-op) or is skipped entirely.

The maintainer scripts will succeed without these dummy directories.

---

 scripts/package/builddeb | 2 --
 1 file changed, 2 deletions(-)
scripts/package/builddeb +0 -2
index fb686fd3266f..e823742e17c4 100755
@@ -70,8 +70,6 @@ install_linux_image () {
 	# so do we; recent versions of dracut and initramfs-tools will obey this.
 	debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
 	for script in postinst postrm preinst prerm; do
-		mkdir -p "${pdir}${debhookdir}/${script}.d"
-
 		mkdir -p "${pdir}/DEBIAN"
 		cat <<-EOF > "${pdir}/DEBIAN/${script}"
 		#!/bin/sh
Signature · 1 line
2.43.0
#1 lore raw
Quoted 10 lines · Masahiro Yamada

The linux-image package currently includes empty hook directories (/etc/kernel/{pre,post}{inst,rm}.d/ by default).

These directories were perhaps intended as a fail-safe in case no hook scripts exist there.

However, they are unnecessary because the run-parts command is already guarded by the following check:

Quoted 6 lines
    test -d ${debhookdir}/${script}.d && run-parts ...

The only difference is that the run-parts command either runs for empty directories (resulting in a no-op) or is skipped entirely.

The maintainer scripts will succeed without these dummy directories.

The linux-image packages from the Debian kernel do not contain the /etc/kernel/*.d/ directories either.

(Please correct me if I'm wrong, Ben)

Quoted 20 lines

---

 scripts/package/builddeb | 2 --
 1 file changed, 2 deletions(-)
scripts/package/builddeb +0 -3
index fb686fd3266f..e823742e17c4 100755
@@ -70,8 +70,6 @@ install_linux_image () {
        # so do we; recent versions of dracut and initramfs-tools will obey this.
        debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
        for script in postinst postrm preinst prerm; do
-               mkdir -p "${pdir}${debhookdir}/${script}.d"
-
                mkdir -p "${pdir}/DEBIAN"
                cat <<-EOF > "${pdir}/DEBIAN/${script}"
                #!/bin/sh
--
Quoted 3 lines

2.43.0

--
Best Regards

Masahiro Yamada