snap-pac/configuration.html
2021-03-14 14:02:05 +00:00

208 lines
No EOL
12 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Configuration &#8212; snap-pac documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
<script id="documentation_options" data-url_root="./" 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="Example" href="examples.html" />
<link rel="prev" title="Installation" href="installation.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head><body>
<div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">snap-pac</a></h1>
<p class="blurb">pacman hooks that use snapper to create pre/post btrfs snapshots</p>
<p>
<iframe src="https://ghbtns.com/github-btn.html?user=wesbarnett&repo=snap-pac&type=star&count=true&size=large&v=2"
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
</p>
<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="#environment-variables">Environment Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Example</a></li>
<li class="toctree-l1"><a class="reference internal" href="troubleshooting.html">Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">FAQ</a></li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="installation.html" title="previous chapter">Installation</a></li>
<li>Next: <a href="examples.html" title="next chapter">Example</a></li>
</ul></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" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="configuration">
<h1>Configuration<a class="headerlink" href="#configuration" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
</div>
<p>Configuration is done via Python ini configuration files. The defaults
should be suitable for most users, so you may not need to do any configuration at all.
By default only the <code class="docutils literal notranslate"><span class="pre">root</span></code> snapper configuration is snapshotted.</p>
<p>A commented example configuration files is located at <code class="docutils literal notranslate"><span class="pre">/etc/snap-pac.ini.example</span></code>.</p>
<p>To configure, copy the example configuration file:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>cp /etc/snap-pac.ini<span class="o">{</span>.example,<span class="o">}</span>
</pre></div>
</div>
<p>Then edit with your favorite editor. The file is commented and should be
self-explanatory.</p>
<p>Each section corresponds with a snapper configuration. Add additional sections to add
other snapper configurations to be snapshotted. By default, only the root configuration
is snapshotted. Additionally you can add a section named <code class="docutils literal notranslate"><span class="pre">DEFAULT</span></code> with options that
apply to all snapper configurations unless overridden in a later section.</p>
<p>Each section can have the following entries:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">desc_limit</span></code> - integer; maximum length of description string before being truncated.
Default: 72</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">important_packages</span></code> - list of strings; names of packages that if involved in a pacman
transaction will add <code class="docutils literal notranslate"><span class="pre">important=yes</span></code> to the snapper userdata for the pair of
snapshots. Default: []</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">important_commands</span></code> - list of strings; parent commands that will add
<code class="docutils literal notranslate"><span class="pre">important=yes</span></code> to the snapper userdata for the pair of snapshots. Default: []</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">pre_description</span></code> - string; description for the pre snapshot. Default: the parent
command that called the pacman hook.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">post_description</span></code> - string; description for the post snapshot. Default: space
separated list of packages that were installed, upgraded, or removed.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">snapshot</span></code> - boolean; whether or not to snapshot the configuration. Default: True for
<code class="docutils literal notranslate"><span class="pre">root</span></code> configuration; False otherwise.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">userdata</span></code> - list of strings; key-value pairs that will be added to the userdata for
the pair of snapshots. Default: []</p></li>
</ul>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<p>Turn off snapshots for <code class="docutils literal notranslate"><span class="pre">root</span></code> configuration and turn on for <code class="docutils literal notranslate"><span class="pre">home</span></code> configuration:</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[root]</span>
<span class="na">snapshot</span> <span class="o">=</span> <span class="s">False</span>
<span class="k">[home]</span>
<span class="na">snapshot</span> <span class="o">=</span> <span class="s">True</span>
</pre></div>
</div>
<p>Set the snapper to add the userdata <code class="docutils literal notranslate"><span class="pre">important=yes</span></code> for every snapshot in the <code class="docutils literal notranslate"><span class="pre">root</span></code>
configuration when a system upgrade is performed:</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[root]</span>
<span class="na">important_commands</span> <span class="o">=</span> <span class="s">[&quot;pacman -Syu&quot;]</span>
</pre></div>
</div>
<p>Set the snapper to add the userdata <code class="docutils literal notranslate"><span class="pre">important=yes</span></code> for every snapshot in the <code class="docutils literal notranslate"><span class="pre">root</span></code>
configuration when a pacman transaction handles the packages <code class="docutils literal notranslate"><span class="pre">linux</span></code> and <code class="docutils literal notranslate"><span class="pre">linux-lts</span></code>:</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[root]</span>
<span class="na">important_packages</span> <span class="o">=</span> <span class="s">[&quot;linux&quot;, &quot;linux-lts&quot;]</span>
</pre></div>
</div>
<p>Heres a fuller example, with several options set for different configurations. In this
case the <code class="docutils literal notranslate"><span class="pre">root</span></code> configuration snapshot will have <code class="docutils literal notranslate"><span class="pre">important=yes</span></code> when <code class="docutils literal notranslate"><span class="pre">linux</span></code> and
<code class="docutils literal notranslate"><span class="pre">linux-lts</span></code> packages are part of the transaction. Additionally when full system
upgrades are performed <code class="docutils literal notranslate"><span class="pre">root</span></code> snapshots will be marked <code class="docutils literal notranslate"><span class="pre">important=yes</span></code>. Note that
you dont have to add <code class="docutils literal notranslate"><span class="pre">snapshot</span> <span class="pre">=</span> <span class="pre">True</span></code> for the <code class="docutils literal notranslate"><span class="pre">root</span></code> configuration since that is
the default.</p>
<p>This file also turns one snapshots for the <code class="docutils literal notranslate"><span class="pre">home</span></code> snapper configuration and adds the
userdata <code class="docutils literal notranslate"><span class="pre">requestid=42,user=arthur</span></code> to all snapshots for that configuration.
Additionally he post snapshot description is overridden.</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[root]</span>
<span class="na">important_packages</span> <span class="o">=</span> <span class="s">[&quot;linux&quot;, &quot;linux-lts&quot;]</span>
<span class="na">important_commands</span> <span class="o">=</span> <span class="s">[&quot;pacman -Syu&quot;]</span>
<span class="k">[home]</span>
<span class="na">snapshot</span> <span class="o">=</span> <span class="s">True</span>
<span class="na">userdata</span> <span class="o">=</span> <span class="s">[&quot;requestid=42&quot;, &quot;user=arthur&quot;]</span>
<span class="na">post_description</span> <span class="o">=</span> <span class="s">&quot;pacman transaction post snapshot&quot;</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="environment-variables">
<h1>Environment Variables<a class="headerlink" href="#environment-variables" title="Permalink to this headline"></a></h1>
<p>To temporarily prevent snapshots from being performed for a single pacman
command, set the environment variable <code class="docutils literal notranslate"><span class="pre">SNAP_PAC_SKIP</span></code>. For example:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo <span class="nv">SNAP_PAC_SKIP</span><span class="o">=</span>y pacman -Syu
</pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2021, Wes Barnett, PhD.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 3.5.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/configuration.rst.txt"
rel="nofollow">Page source</a>
</div>
<a href="https://github.com/wesbarnett/snap-pac" class="github">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" class="github"/>
</a>
</body>
</html>