History

kbuild, deb-pkg: allow alternative hook scripts directory in .deb packages

Hook scripts in the default directory /etc/kernel are also executed by official Debian kernel packages as well as kernel packages created using make-kpkg. Allow to specify an alternative hook scripts directory by exporting the environment variable KDEB_HOOKDIR.

Frans Pop committed 17 years ago

Commit fe233cb1 parent c72c75d1 file · +8 −4Browse files

Showing the changes to scripts/package (1 of 1 file). Show all

Unified · Split

scripts/package/builddeb+8−4
@@ -6,8 +6,9 @@ · 5 unmodified lines
66 # Simple script to generate a deb package for a Linux kernel. All the
77 # complexity of what to do with a kernel after it is installed or removed
88 # is left to other scripts and packages: they can install scripts in the
9−# /etc/kernel/{pre,post}{inst,rm}.d/ directories that will be called on
10−# package install and removal.
9+# /etc/kernel/{pre,post}{inst,rm}.d/ directories (or an alternative location
10+# specified in KDEB_HOOKDIR) that will be called on package install and
11+# removal.
1112
1213 set -e
1314
@@ -73,8 +74,11 @@ if grep -q '^CONFIG_MODULES=y' .config ; then · 59 unmodified lines
7374 fi
7475
7576 # Install the maintainer scripts
77+# Note: hook scripts under /etc/kernel are also executed by official Debian
78+# kernel packages, as well as kernel packages built using make-kpkg
79+debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
7680 for script in postinst postrm preinst prerm ; do
77− mkdir -p "$tmpdir/etc/kernel/$script.d"
81+ mkdir -p "$tmpdir$debhookdir/$script.d"
7882 cat <<EOF > "$tmpdir/DEBIAN/$script"
7983 #!/bin/sh
8084
@@ -83,7 +87,7 @@ set -e · 2 unmodified lines
8387 # Pass maintainer script parameters to hook scripts
8488 export DEB_MAINT_PARAMS="\$@"
8589
86−test -d /etc/kernel/$script.d && run-parts --arg="$version" /etc/kernel/$script.d
90+test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d
8791 exit 0
8892 EOF
8993 chmod 755 "$tmpdir/DEBIAN/$script"