This file is indexed.

/usr/share/doc/debian-kernel-handbook/kernel-handbook.html/ch-update-hooks.html is in debian-kernel-handbook 1.0.18.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 8. Package maintainer scripts and hooks</title><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="Debian Linux Kernel Handbook"><link rel="up" href="index.html" title="Debian Linux Kernel Handbook"><link rel="prev" href="ch-initramfs.html" title="Chapter 7. Managing the initial ramfs (initramfs) archive"><link rel="next" href="ch-bugs.html" title="Chapter 9. Reporting and handling bugs"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 8. Package maintainer scripts and hooks</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch-initramfs.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch-bugs.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="ch-update-hooks"></a>Chapter 8. Package maintainer scripts and hooks</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="ch-update-hooks.html#s-kernel-hooks">8.1. Kernel hooks</a></span></dt><dt><span class="section"><a href="ch-update-hooks.html#s-kernel-hooks-loader">8.2. Kernel hooks required for boot loaders</a></span></dt><dt><span class="section"><a href="ch-update-hooks.html#s-initramfs-hooks">8.3. Initramfs hooks</a></span></dt><dt><span class="section"><a href="ch-update-hooks.html#s-kernel-hooks-initramfs">8.4. Kernel hooks required for initramfs builders</a></span></dt><dt><span class="section"><a href="ch-update-hooks.html#s-loader-optimisation">8.5. Optimising boot loader updates</a></span></dt><dt><span class="section"><a href="ch-update-hooks.html#s-deprecation">8.6. Deprecated features</a></span></dt><dt><span class="section"><a href="ch-update-hooks.html#s-init-config">8.7. Initial configuration by the installer</a></span></dt></dl></div><p>
The following policy applies to Debian GNU/Linux.  Some parts may be
applicable to kernels other than Linux, but this policy does not set
any requirements for them.
</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="s-kernel-hooks"></a>8.1. Kernel hooks</h2></div></div></div><p>
The maintainer scripts in Linux kernel packages must use
<span class="command"><strong>run-parts</strong></span> to invoke hook scripts in the corresponding
subdirectory of <code class="filename">/etc/kernel</code>, e.g.  the
<code class="literal">postinst</code> script must invoke scripts in
<code class="filename">/etc/kernel/postinst.d</code>.
</p><p>
The arguments given to all kernel hook scripts are the kernel ABI version (the
string that <span class="command"><strong>uname -r</strong></span> reports) and, optionally, the absolute
path to the kernel image.  If the second argument is missing then the path is
either <code class="filename">/boot/vmlinuz-<em class="replaceable"><code>version</code></em></code> or
<code class="filename">/boot/vmlinux-<em class="replaceable"><code>version</code></em></code>, according to
architecture convention.  The environment variable
<code class="envar">DEB_MAINT_PARAMS</code> will contain the arguments given to the
kernel maintainer script, possibly single-quoted.  In a shell script, this
variable can be parsed using:
</p><pre class="literallayout">eval set -- "$DEB_MAINT_PARAMS"
</pre><p>
Kernel hook scripts may be run under debconf.  In this case they must not use
stdin and stdout, and should send all output to stderr (fd 2).  A shell script
can ensure that it does this using:
</p><pre class="literallayout">exec &lt;/dev/null &gt;&amp;2
</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="s-kernel-hooks-loader"></a>8.2. Kernel hooks required for boot loaders</h2></div></div></div><p>
Packages for boot loaders that need to be updated whenever the files they load
are modified (i.e.  those that store a block list) must install hook scripts in
<code class="filename">/etc/kernel/postinst.d</code> and
<code class="filename">/etc/kernel/postrm.d</code>.
</p><p>
Since these boot loaders should be updated as the last step during
installation/upgrade and removal, hook scripts for boot loaders must be named
using the prefix <code class="literal">zz-</code> and no other packages may use this
prefix or one that sorts later by the rules used by
<span class="command"><strong>run-parts</strong></span>.  A postrm hook script should warn but exit with
code 0 if the boot loader configuration file still refers to the kernel image
that has been removed.
</p><p>
These boot loader packages must be installable on the filesystem in a disabled
state where they will not write to the boot sector or other special storage.
While a boot loader is disabled, any kernel hooks it includes must do nothing
except (optionally) printing a warning that the boot loader is disabled, and
must exit successfully.
</p><p>
Packages for boot loaders that can provide a menu of kernel versions should
install kernel hook scripts in order to update that menu.
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="s-initramfs-hooks"></a>8.3. Initramfs hooks</h2></div></div></div><p>
Packages for boot loaders that need to be updated whenever the files they load
are modified must also install hook scripts in
<code class="filename">/etc/initramfs/post-update.d</code>.  Initramfs builders must call
these scripts using <span class="command"><strong>run-parts</strong></span> after they create, update or
delete an initramfs.  The arguments given to these hook scripts are the kernel
ABI version and the absolute path to the initramfs image.
</p><p>
While a boot loader is disabled, any initramfs hook it includes must do nothing
except (optionally) printing a warning that the boot loader is disabled, and
must exit successfully.
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="s-kernel-hooks-initramfs"></a>8.4. Kernel hooks required for initramfs builders</h2></div></div></div><p>
Initramfs builders must install hook scripts in
<code class="filename">/etc/kernel/postinst.d</code> and
<code class="filename">/etc/kernel/postrm.d</code>, to create/update and delete the
corresponding initramfs images.  The postinst hook script must complete its
work before returning.
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="s-loader-optimisation"></a>8.5. Optimising boot loader updates</h2></div></div></div><p>
During a kernel package installation, upgrade or removal, various boot loader
hooks may be invoked (in this order):
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
A <code class="literal">postinst_hook</code> or <code class="literal">postrm_hook</code> command
set by the user or the installer in <code class="filename">/etc/kernel-img.conf</code>
</p></li><li class="listitem"><p>
A hook script in <code class="filename">/etc/initramfs/post-update.d</code>
</p></li><li class="listitem"><p>
A hook script in <code class="filename">/etc/kernel/postinst.d</code> or
...<code class="filename">/postrm.d</code>
</p></li></ol></div><p>
To avoid unnecessary updates, the hooks invoked at steps 1 and 2 may check
whether <code class="envar">$DPKG_MAINTSCRIPT_PACKAGE</code> begins with
<code class="literal">linux-image-</code> and do nothing in this case.
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="s-deprecation"></a>8.6. Deprecated features</h2></div></div></div><p>
Kernel packages must not invoke boot loaders or initramfs builders
except via hooks.  If <code class="filename">/etc/kernel-img.conf</code> contains
<code class="literal">do_bootloader = yes</code> or equivalent, maintainer
scripts that previously acted on this must warn that they are ignoring
it.  <span class="package">linux-base</span> must also warn on upgrade that the
default has changed.
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="s-init-config"></a>8.7. Initial configuration by the installer</h2></div></div></div><p>
The installer must not define <code class="literal">do_bootloader</code>,
<code class="literal">postinst_hook</code> or <code class="literal">postrm_hook</code> in
<code class="filename">/etc/kernel-img.conf</code>.
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch-initramfs.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch-bugs.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 7. Managing the initial ramfs (initramfs) archive </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 9. Reporting and handling bugs</td></tr></table></div></body></html>