Linux iad1-shared-b7-18 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
Apache
: 67.205.6.31 | : 216.73.216.13
Cant Read [ /etc/named.conf ]
8.2.29
fernandoquevedo
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
debian-policy /
policy.html /
[ HOME SHELL ]
Name
Size
Permission
Action
_images
[ DIR ]
drwxr-xr-x
_sources
[ DIR ]
drwxr-xr-x
_static
[ DIR ]
drwxr-xr-x
ap-flowcharts.html
7.02
KB
-rw-r--r--
ap-license.html
4.8
KB
-rw-r--r--
ap-pkg-alternatives.html
6.79
KB
-rw-r--r--
ap-pkg-binarypkg.html
17.44
KB
-rw-r--r--
ap-pkg-conffiles.html
12.14
KB
-rw-r--r--
ap-pkg-controlfields.html
12.4
KB
-rw-r--r--
ap-pkg-diversions.html
11.4
KB
-rw-r--r--
ap-pkg-scope.html
7.81
KB
-rw-r--r--
ap-pkg-sourcepkg.html
33.32
KB
-rw-r--r--
ap-process.html
18.49
KB
-rw-r--r--
ch-archive.html
28.57
KB
-rw-r--r--
ch-binary.html
38.01
KB
-rw-r--r--
ch-controlfields.html
107.38
KB
-rw-r--r--
ch-customized-programs.html
53.09
KB
-rw-r--r--
ch-docs.html
33.97
KB
-rw-r--r--
ch-files.html
69.51
KB
-rw-r--r--
ch-maintainerscripts.html
40.34
KB
-rw-r--r--
ch-opersys.html
84.18
KB
-rw-r--r--
ch-relationships.html
67.18
KB
-rw-r--r--
ch-scope.html
18.54
KB
-rw-r--r--
ch-sharedlibs.html
88.6
KB
-rw-r--r--
ch-source.html
79.4
KB
-rw-r--r--
genindex.html
3.48
KB
-rw-r--r--
index.html
59.51
KB
-rw-r--r--
objects.inv
4.75
KB
-rw-r--r--
search.html
2.99
KB
-rw-r--r--
searchindex.js
58.77
KB
-rw-r--r--
upgrading-checklist.html
121.38
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : ap-pkg-diversions.html
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" /> <title>7. Diversions - overriding a package’s version of a file (from old Packaging Manual) — Debian Policy Manual v4.6.0.1</title> <link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/nature.css" /> <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script src="_static/jquery.js"></script> <script src="_static/underscore.js"></script> <script src="_static/doctools.js"></script> <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="next" title="8. Debian Policy changes process" href="ap-process.html" /> <link rel="prev" title="6. Alternative versions of an interface - update-alternatives (from old Packaging Manual)" href="ap-pkg-alternatives.html" /> </head><body> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="ap-process.html" title="8. Debian Policy changes process" accesskey="N">next</a> |</li> <li class="right" > <a href="ap-pkg-alternatives.html" title="6. Alternative versions of an interface - update-alternatives (from old Packaging Manual)" accesskey="P">previous</a> |</li> <li class="nav-item nav-item-0"><a href="index.html">Debian Policy Manual v4.6.0.1</a> »</li> <li class="nav-item nav-item-this"><a href=""><span class="section-number">7. </span>Diversions - overriding a package’s version of a file (from old Packaging Manual)</a></li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <section id="diversions-overriding-a-package-s-version-of-a-file-from-old-packaging-manual"> <h1><span class="section-number">7. </span>Diversions - overriding a package’s version of a file (from old Packaging Manual)<a class="headerlink" href="#diversions-overriding-a-package-s-version-of-a-file-from-old-packaging-manual" title="Permalink to this headline">¶</a></h1> <p>It is possible to have <code class="docutils literal notranslate"><span class="pre">dpkg</span></code> not overwrite a file when it reinstalls the package it belongs to, and to have it put the file from the package somewhere else instead.</p> <p>This can be used locally to override a package’s version of a file, or by one package to override another’s version (or provide a wrapper for it).</p> <p>Before deciding to use a diversion, read <a class="reference internal" href="ap-pkg-alternatives.html"><span class="doc">Alternative versions of an interface - update-alternatives (from old Packaging Manual)</span></a> to see if you really want a diversion rather than several alternative versions of a program.</p> <p>There is a diversion list, which is read by <code class="docutils literal notranslate"><span class="pre">dpkg</span></code>, and updated by a special program <code class="docutils literal notranslate"><span class="pre">dpkg-divert</span></code>. Please see <em class="manpage">dpkg-divert(8)</em> for full details of its operation.</p> <p>When a package wishes to divert a file from another, it should call <code class="docutils literal notranslate"><span class="pre">dpkg-divert</span></code> in its preinst to add the diversion and rename the existing file. For example, supposing that a <code class="docutils literal notranslate"><span class="pre">smailwrapper</span></code> package wishes to install a wrapper around <code class="docutils literal notranslate"><span class="pre">/usr/sbin/smail</span></code>:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">dpkg</span><span class="o">-</span><span class="n">divert</span> <span class="o">--</span><span class="n">package</span> <span class="n">smailwrapper</span> <span class="o">--</span><span class="n">add</span> <span class="o">--</span><span class="n">rename</span> \ <span class="o">--</span><span class="n">divert</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">sbin</span><span class="o">/</span><span class="n">smail</span><span class="o">.</span><span class="n">real</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">sbin</span><span class="o">/</span><span class="n">smail</span> </pre></div> </div> <p>The <code class="docutils literal notranslate"><span class="pre">--package</span> <span class="pre">smailwrapper</span></code> ensures that <code class="docutils literal notranslate"><span class="pre">smailwrapper</span></code>’s copy of <code class="docutils literal notranslate"><span class="pre">/usr/sbin/smail</span></code> can bypass the diversion and get installed as the true version. It’s safe to add the diversion unconditionally on upgrades since it will be left unchanged if it already exists, but <code class="docutils literal notranslate"><span class="pre">dpkg-divert</span></code> will display a message. To suppress that message, make the command conditional on the version from which the package is being upgraded:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>if [ upgrade != "$1 ] || dpkg --compare-versions "$2" lt 1.0-2; then dpkg-divert --package smailwrapper --add --rename \ --divert /usr/sbin/smail.real /usr/sbin/smail fi </pre></div> </div> <p>where <code class="docutils literal notranslate"><span class="pre">1.0-2</span></code> is the version at which the diversion was first added to the package. Running the command during abort-upgrade is pointless but harmless.</p> <p>The postrm has to do the reverse:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="p">[</span> <span class="n">remove</span> <span class="o">=</span> <span class="s2">"$1"</span> <span class="o">-</span><span class="n">o</span> <span class="n">abort</span><span class="o">-</span><span class="n">install</span> <span class="o">=</span> <span class="s2">"$1"</span> <span class="o">-</span><span class="n">o</span> <span class="n">disappear</span> <span class="o">=</span> <span class="s2">"$1 ]; then</span> <span class="n">dpkg</span><span class="o">-</span><span class="n">divert</span> <span class="o">--</span><span class="n">package</span> <span class="n">smailwrapper</span> <span class="o">--</span><span class="n">remove</span> <span class="o">--</span><span class="n">rename</span> \ <span class="o">--</span><span class="n">divert</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">sbin</span><span class="o">/</span><span class="n">smail</span><span class="o">.</span><span class="n">real</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">sbin</span><span class="o">/</span><span class="n">smail</span> <span class="n">fi</span> </pre></div> </div> <p>If the diversion was added at a particular version, the postrm should also handle the failure case of upgrading from an older version (unless the older version is so old that direct upgrades are no longer supported):</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>if [ abort-upgrade = "$1 ] && dpkg --compare-versions "$2" lt 1.0-2; then dpkg-divert --package smailwrapper --remove --rename \ --divert /usr/sbin/smail.real /usr/sbin/smail fi </pre></div> </div> <p>where <code class="docutils literal notranslate"><span class="pre">1.0-2</span></code> is the version at which the diversion was first added to the package. The postrm should not remove the diversion on upgrades both because there’s no reason to remove the diversion only to immediately re-add it and since the postrm of the old package is run after unpacking so the removal of the diversion will fail.</p> <p>Do not attempt to divert a file which is vitally important for the system’s operation - when using <code class="docutils literal notranslate"><span class="pre">dpkg-divert</span></code> there is a time, after it has been diverted but before <code class="docutils literal notranslate"><span class="pre">dpkg</span></code> has installed the new version, when the file does not exist.</p> <p>Do not attempt to divert a conffile, as <code class="docutils literal notranslate"><span class="pre">dpkg</span></code> does not handle it well.</p> </section> <div class="clearer"></div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="ap-pkg-alternatives.html" title="previous chapter"><span class="section-number">6. </span>Alternative versions of an interface - <code class="docutils literal notranslate"><span class="pre">update-alternatives</span></code> (from old Packaging Manual)</a></p> <h4>Next topic</h4> <p class="topless"><a href="ap-process.html" title="next chapter"><span class="section-number">8. </span>Debian Policy changes process</a></p> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/ap-pkg-diversions.rst.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3 id="searchlabel">Quick search</h3> <div class="searchformwrapper"> <form class="search" action="search.html" method="get"> <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> <input type="submit" value="Go" /> </form> </div> </div> <script>$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="ap-process.html" title="8. Debian Policy changes process" >next</a> |</li> <li class="right" > <a href="ap-pkg-alternatives.html" title="6. Alternative versions of an interface - update-alternatives (from old Packaging Manual)" >previous</a> |</li> <li class="nav-item nav-item-0"><a href="index.html">Debian Policy Manual v4.6.0.1</a> »</li> <li class="nav-item nav-item-this"><a href=""><span class="section-number">7. </span>Diversions - overriding a package’s version of a file (from old Packaging Manual)</a></li> </ul> </div> <div class="footer" role="contentinfo"> Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.2.0. </div> </body> </html>
Close