Compare commits

...
Sign in to create a new pull request.

50 commits

Author SHA1 Message Date
wesbarnett
dc227498f3 deploy: d58d047d2a 2021-10-04 14:11:08 +00:00
wesbarnett
f4f1c6bd9e deploy: 959bf2b102 2021-10-04 14:10:53 +00:00
wesbarnett
61fe99addc deploy: 6cfaa46fff 2021-05-16 23:32:16 +00:00
wesbarnett
99d807fe0d deploy: 759a2cc84c 2021-05-16 23:21:17 +00:00
wesbarnett
0b6aa41a9e deploy: 6dc564314c 2021-05-16 23:17:45 +00:00
wesbarnett
d79295eefb deploy: fad8cd676c 2021-05-09 20:59:23 +00:00
wesbarnett
33379056b2 deploy: 121f744ac6 2021-05-09 20:53:01 +00:00
wesbarnett
70d98509bc deploy: f38f7aa9e6 2021-05-09 20:52:34 +00:00
wesbarnett
cc9f9392bb deploy: 2f39f46ac0 2021-04-25 16:04:52 +00:00
wesbarnett
adef4c06bb deploy: 1159296a8a 2021-04-25 15:50:46 +00:00
wesbarnett
7ad98ca9cb deploy: e913d70b95 2021-04-16 00:33:12 +00:00
wesbarnett
1584773868 deploy: 95ad2669f6 2021-04-16 00:28:59 +00:00
wesbarnett
0655b59c70 deploy: b08afc0b942dd1bda6a02aeee596f9087c35040b 2021-04-16 00:28:29 +00:00
wesbarnett
475f5e6d1a deploy: ef889e198e 2021-04-15 23:37:22 +00:00
wesbarnett
a80b4a5e59 deploy: 2b9c0f6d2263fb194274720ef64ed5cad55e3081 2021-04-15 23:36:53 +00:00
wesbarnett
38ef97aa85 deploy: ea778aa380 2021-03-28 13:00:28 +00:00
wesbarnett
df3d340171 deploy: 3da59ac9d3 2021-03-28 12:57:10 +00:00
wesbarnett
85a99e004a deploy: c01ba154d0 2021-03-28 00:26:11 +00:00
wesbarnett
86235a0472 deploy: 53b5a34c18 2021-03-28 00:00:28 +00:00
wesbarnett
559da999c2 deploy: 22751b7d95 2021-03-27 23:21:08 +00:00
wesbarnett
2eee436699 deploy: d81f6f1f6f 2021-03-27 23:14:48 +00:00
wesbarnett
e4bba6e41c deploy: 559a8d7b54 2021-03-18 01:16:16 +00:00
wesbarnett
4cc783e111 deploy: a2704e5eda 2021-03-16 23:14:01 +00:00
wesbarnett
0728f94be4 deploy: 2aad72fb1a 2021-03-16 00:39:32 +00:00
wesbarnett
2e529cf971 deploy: ec959799b8 2021-03-15 12:03:54 +00:00
wesbarnett
f65654d7d8 deploy: b65cc3d261 2021-03-15 00:09:46 +00:00
wesbarnett
c5320a282e deploy: a455240b60 2021-03-14 22:11:48 +00:00
wesbarnett
b69920d80e deploy: c0224aed25 2021-03-14 22:00:27 +00:00
wesbarnett
1320a57893 deploy: 0636c02438 2021-03-14 14:45:11 +00:00
wesbarnett
3475a878e7 deploy: c382fbdbf8 2021-03-14 14:36:25 +00:00
wesbarnett
eb4a9d9ca3 deploy: 135e5a91d0 2021-03-14 14:02:05 +00:00
wesbarnett
8a07717b39 deploy: 0f86de6ade 2021-03-14 12:38:50 +00:00
wesbarnett
4a4e08a617 deploy: b66665a35e 2021-03-14 01:17:45 +00:00
wesbarnett
8bf383146a deploy: 0c6f8f769e 2021-03-13 21:10:59 +00:00
wesbarnett
ffb9be2564 deploy: cb47d1907d 2021-03-13 21:06:25 +00:00
wesbarnett
2abb606bc3 deploy: 2428ee46ca 2021-03-13 21:00:59 +00:00
wesbarnett
22364406ba deploy: da67ac9ac9 2021-03-13 20:38:27 +00:00
wesbarnett
7af95a4baa deploy: d8c8ae9b66 2021-03-13 19:02:37 +00:00
wesbarnett
0f18515e38 deploy: b3cbde97e3ed7816689a9b8f9c182465345cb8e6 2021-03-13 19:01:47 +00:00
wesbarnett
89aedd19b1 deploy: c50cd3b198bcff21b7744f5df20b416225baacaa 2021-03-13 17:57:59 +00:00
wesbarnett
7ea2f5f4c7 deploy: 3a7d7a92e368e923ab8a3de88ae385c3dc8c0d45 2021-03-13 17:44:32 +00:00
wesbarnett
b745a9618a deploy: 7b582f8e4eb48b11b0cfb0604a6b2c58fa3428fb 2021-03-13 12:28:48 +00:00
wesbarnett
c90df810ac deploy: 8a28734fe7ddd4088873b29c570b43cd7d740437 2021-03-13 12:26:42 +00:00
wesbarnett
e89da8d510 deploy: 796b0f790d 2021-03-13 10:23:32 +00:00
wesbarnett
1129f39f60 deploy: 17ca6c7519c5e5a673aa0604a6cf1bc8b005f5c1 2021-03-12 01:06:06 +00:00
Wes Barnett
ef2997cf17
update gh-pages 2021-03-11 20:04:45 -05:00
Wes Barnett
a93c96fae6
docs workflow 2021-03-11 19:54:50 -05:00
Wes Barnett
914ba1abcf
no jekyll 2021-03-11 19:51:45 -05:00
Wes Barnett
7b8404fdee
Set up pages 2021-03-11 19:51:08 -05:00
Wes Barnett
3e56f55087
Docs 2021-03-11 19:50:05 -05:00
55 changed files with 17503 additions and 1089 deletions

4
.buildinfo Normal file
View file

@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: afd20f0f5a86940f9585f16f95da4790
tags: 645f666f9bcd5a90fca523b33c5a78b7

Binary file not shown.

Binary file not shown.

BIN
.doctrees/examples.doctree Normal file

Binary file not shown.

BIN
.doctrees/faq.doctree Normal file

Binary file not shown.

BIN
.doctrees/index.doctree Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,24 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Additional context**
Add any other context about the problem here.

View file

@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View file

@ -1,24 +0,0 @@
name: Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: python -m pip install --upgrade pip pytest flake8
- name: Run linter
run: flake8 --max-line-length=120 scripts/
- name: Run tests
run: python -m pytest -v

2
.gitignore vendored
View file

@ -1,2 +0,0 @@
__pycache__
venv

0
.nojekyll Normal file
View file

339
LICENSE
View file

@ -1,339 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View file

@ -1,34 +0,0 @@
# snap-pac
# https://github.com/wesbarnett/snap-pac
# Copyright (C) 2016-2021 James W. Barnett
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
PKGNAME = snap-pac
PREFIX ?= /usr
SHARE_DIR = $(DESTDIR)$(PREFIX)/share
.PHONY: install
install:
@install -Dm755 scripts/snap_pac.py $(SHARE_DIR)/libalpm/scripts/snap-pac
@install -Dm644 hooks/* -t $(SHARE_DIR)/libalpm/hooks/
@install -Dm644 LICENSE -t $(SHARE_DIR)/licenses/$(PKGNAME)/
@install -Dm644 man8/* -t $(SHARE_DIR)/man/man8/
@install -Dm644 README.md -t $(SHARE_DIR)/doc/$(PKGNAME)/
@install -Dm644 extra/snap-pac.ini $(DESTDIR)/etc/snap-pac.ini.example
test:
@python -m pytest -v .

View file

@ -1,50 +0,0 @@
# snap-pac
![Tests](https://github.com/wesbarnett/snap-pac/workflows/Tests/badge.svg)
## Synopsis
This is a set of pacman hooks and script that automatically causes snapper to
perform a pre and post snapshot before and after pacman transactions, similar to
how YaST does with OpenSuse. This provides a simple way to undo changes to a
system after a pacman transaction.
## Installation
Install the `snap-pac` package using pacman.
Alternatively [download the latest release] and signature , verify the download, and
then run `make install`.
I have signed the release tarball and commits with my PGP key. Starting with release
2.2, the tarballs are signed with my key with fingerprint
`F7B28C61944FE30DABEEB0B01070BCC98C18BD66`.
For previous releases, the key's fingerprint was
`8535CEF3F3C38EE69555BF67E4B5E45AA3B8C5C3`.
## Configuration
Most likely, configuration is not needed. By default, the snapper configuration named
`root` will have pre/post snapshots taken for every pacman transaction.
To configure, copy the example configuration file:
```bash
cp /etc/snap-pac.ini{.example,}
```
Then edit with your favorite editor. The file is commented and should be
self-explanatory.
## Documentation
Run `man 8 snap-pac` after installation.
## Troubleshooting
After reviewing the man page, [check the issues page] and file a new issue if your
problem is not covered.
[download the latest release]: https://github.com/wesbarnett/snap-pac/releases
[check the issues page]: https://github.com/wesbarnett/snap-pac/issues

View file

@ -0,0 +1,99 @@
Configuration
=============
.. toctree::
:maxdepth: 2
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 ``root`` snapper configuration is snapshotted.
A commented example configuration files is located at ``/etc/snap-pac.ini``.
Edit with your favorite editor. The file is commented and should be
self-explanatory.
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 ``DEFAULT`` with options that
apply to all snapper configurations unless overridden in a later section.
Each section can have the following entries:
* ``desc_limit`` - integer; maximum length of description string before being truncated.
Default: 72
* ``important_packages`` - list of strings; names of packages that if involved in a pacman
transaction will add ``important=yes`` to the snapper userdata for the pair of
snapshots. Default: []
* ``important_commands`` - list of strings; parent commands that will add
``important=yes`` to the snapper userdata for the pair of snapshots. Default: []
* ``pre_description`` - string; description for the pre snapshot. Default: the parent
command that called the pacman hook.
* ``post_description`` - string; description for the post snapshot. Default: space
separated list of packages that were installed, upgraded, or removed.
* ``snapshot`` - boolean; whether or not to snapshot the configuration. Default: True for
``root`` configuration; False otherwise.
* ``userdata`` - list of strings; key-value pairs that will be added to the userdata for
the pair of snapshots. Default: []
Examples
--------
Turn off snapshots for ``root`` configuration and turn on for ``home`` configuration:
.. code-block:: ini
[root]
snapshot = False
[home]
snapshot = True
Set the snapper to add the userdata ``important=yes`` for every snapshot in the ``root``
configuration when a system upgrade is performed:
.. code-block:: ini
[root]
important_commands = ["pacman -Syu"]
Set the snapper to add the userdata ``important=yes`` for every snapshot in the ``root``
configuration when a pacman transaction handles the packages ``linux`` and ``linux-lts``:
.. code-block:: ini
[root]
important_packages = ["linux", "linux-lts"]
Here's a fuller example, with several options set for different configurations. In this
case the ``root`` configuration snapshot will have ``important=yes`` when ``linux`` and
``linux-lts`` packages are part of the transaction. Additionally when full system
upgrades are performed ``root`` snapshots will be marked ``important=yes``. Note that
you don't have to add ``snapshot = True`` for the ``root`` configuration since that is
the default.
This file also turns one snapshots for the ``home`` snapper configuration and adds the
userdata ``requestid=42,user=arthur`` to all snapshots for that configuration.
Additionally the post snapshot description is overridden.
.. code-block:: ini
[root]
important_packages = ["linux", "linux-lts"]
important_commands = ["pacman -Syu"]
[home]
snapshot = True
userdata = ["requestid=42", "user=arthur"]
post_description = "pacman transaction post snapshot"
Environment Variables
=====================
To temporarily prevent snapshots from being performed for a single pacman
command, set the environment variable ``SNAP_PAC_SKIP``. For example:
.. code-block:: bash
sudo SNAP_PAC_SKIP=y pacman -Syu

91
_sources/examples.rst.txt Normal file
View file

@ -0,0 +1,91 @@
Example
=======
.. toctree::
:maxdepth: 2
Here is an example of how the snapshots are created and how to rollback and pacman
transaction. Here the nano package is installed:
.. code-block:: bash
pacman -S nano
.. code-block:: none
resolving dependencies...
looking for conflicting packages...
Packages (1) nano-2.5.3-1
Total Installed Size: 2.14 MiB
:: Proceed with installation? [Y/n] Y
(1/1) checking keys in keyring [######################################] 100%
(1/1) checking package integrity [######################################] 100%
(1/1) loading package files [######################################] 100%
(1/1) checking for file conflicts [######################################] 100%
(1/1) checking available disk space [######################################] 100%
:: Running pre-transaction hooks...
(1/1) Performing snapper pre snapshots for the following configurations...
=> root: 1033
:: Processing package changes...
(1/1) installing nano [######################################] 100%
:: Running post-transaction hooks...
(1/1) Performing snapper post snapshots for the following configurations...
=> root: 1034
The snapper snapshot number is given for each snapper configuration that is used. This
is also logged in pacman's log.
Here are the snapshots created before and after the pacman transaction:
.. code-block:: bash
snapper -c root list -t pre-post | tail -n 1
.. code-block:: none
1033 | 1034 | Fri 22 Apr 2016 01:54:13 PM CDT | Fri 22 Apr 2016 01:54:14 PM CDT | pacman -S nano |
Here is what changed during the transaction:
.. code-block:: bash
snapper -c root status 1033..1034
.. code-block:: none
+..... /etc/nanorc
c..... /etc/snapper/.snap-pac-pre
+..... /usr/bin/nano
+..... /usr/bin/rnano
+..... /usr/share/doc/nano
+..... /usr/share/doc/nano/faq.html
+..... /usr/share/doc/nano/fr
+..... /usr/share/doc/nano/fr/nano.1.html
+..... /usr/share/doc/nano/fr/nanorc.5.html
+..... /usr/share/doc/nano/fr/rnano.1.html
The above output is truncated, but it continues. See :manpage:`snapper(8)` to for what each
symbol means. You can also do ``snapper diff`` in the same way.
Then, to undo the pacman transaction:
.. code-block:: bash
snapper -c root undochange 1033..1034
.. code-block:: none
create:0 modify:3 delete:100
Now nano is no longer installed, along with all the files it changed:
.. code-block:: bash
pacman -Qi nano
.. code-block:: none
error: package 'nano' was not found

47
_sources/faq.rst.txt Normal file
View file

@ -0,0 +1,47 @@
FAQ
===
.. toctree::
:maxdepth: 2
**Does snap-pac backup non-btrfs /boot partitions?**
No, but you can add a hook that does it for you. It would be something like the following:
.. code-block:: none
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = linux
[Action]
Description = Backing up /boot...
When = PreTransaction
Exec = /usr/bin/rsync -avzq --delete /boot /.bootbackup
Note that you will probably want to name the file with a numbered prefix less than
``05`` so that it is run before the snap-pac pre snapshot takes place. That will ensure
that the snapshot taken will have the boot partition back-up corresponding with the
state of the system. For example, you could name it ``04-backupboot.hook``.
**How do I link old kernel modules automatically when the kernel is upgraded?**
This behavior is no longer a part of this package. Use a pacman hook like the following:
.. code-block:: none
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = linux
[Action]
Description = Symlinking old kernel modules...
When = PostTransaction
Exec = /usr/bin/bash -c "find /usr/lib/modules -xtype l -delete; ln -sv /.snapshots/$(snapper -c root list | awk 'END{print $1}')/snapshot/usr/lib/modules/$(uname -r) /usr/lib/modules/"

79
_sources/index.rst.txt Normal file
View file

@ -0,0 +1,79 @@
.. snap-pac documentation master file, created by
sphinx-quickstart on Thu Mar 11 19:49:12 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
snap-pac
========
This is a set of `pacman <https://archlinux.org/pacman/>`_ hooks and script that causes
`snapper <http://snapper.io/>`_ to automatically take a pre and post snapshot before and
after pacman transactions, similar to how `YaST <https://yast.opensuse.org/>`_ does with
OpenSuse. This provides a simple way to undo changes to a system after a pacman
transaction.
Because these are pacman hooks, it doesn't matter how you call pacman—whether
directly, through an AUR helper, or using an alias—snapper will create the snapshots
when pacman installs, upgrades, or removes a package. The pacman command used is
logged in the snapper description for the snapshots. Additionally the snapshot numbers
are output to the screen and to the pacman log for each snapper configuration during the
pacman transaction, so that the user can easily find which changes he or she may want to
revert.
.. code-block:: none
:caption: When you run pacman, the snapper pre/post snapshots are created automatically. For a fuller example see :doc:`examples`.
:emphasize-lines: 17,18,25,26
$ sudo pacman -S vim
resolving dependencies...
looking for conflicting packages...
Packages (1) vim-8.2.2489-1
Total Installed Size: 3.79 MiB
Net Upgrade Size: 0.00 MiB
:: Proceed with installation? [Y/n]
(1/1) checking keys in keyring [############] 100%
(1/1) checking package integrity [############] 100%
(1/1) loading package files [############] 100%
(1/1) checking for file conflicts [############] 100%
(1/1) checking available disk space [############] 100%
:: Running pre-transaction hooks...
(1/1) Performing snapper pre snapshots for the following configurations...
==> root: 7394
:: Processing package changes...
(1/1) installing vim [############] 100%
:: Running post-transaction hooks...
(1/4) Arming ConditionNeedsUpdate...
(2/4) Updating icon theme caches...
(3/4) Updating the desktop file MIME type cache...
(4/4) Performing snapper post snapshots for the following configurations...
==> root: 7395
To undo changes from a pacman transaction, use ``snapper undochange``. See the :manpage:`snapper(8)`
for more details as well as examples.
If you have severe breakage—like snapper is gone for some reason and you can't get it
back—you'll have to resort to more extreme methods, such as taking a snapshot of the pre
snapshot and making it the default subvolume or mounting it as /. Most likely you'll
need to use a live USB to get into a chroot environment to do any of these things.
Snapper has a ``snapper rollback`` feature, but your setup has to be properly configured to
use it. The exact procedure depends on your specific setup. Be careful.
Note that the pre transaction hooks occur before the pacman transaction but after the
pacman database is synced, if applicable. In other words, if you run `pacman -Syu` and
roll back the upgrade according to the above instructions, you will not have rolled back
the pacman database to the previous state. Thus, if, after upgrading and rolling back
the upgrade, you then install a package, it will possibly be a partial upgrade, which is
unsupported.
.. toctree::
:maxdepth: 1
installation
configuration
examples
troubleshooting
faq

View file

@ -0,0 +1,66 @@
Installation
============
Install the ``snap-pac`` package using pacman:
.. code-block:: bash
pacman -S snap-pac
Alternatively download the `latest release and signature
<https://github.com/wesbarnett/snap-pac/releases>`_. Then, verify the download:
.. code-block:: bash
gpg --verify snap-pac-<version>.tar.gz.sig
where ``<version>`` is the version number you downloaded.
Finally, run:
.. code-block:: bash
make install
I have signed the release tarball and commits with my PGP key. Starting with release
2.2, the tarballs are signed with my key with fingerprint
``F7B28C61944FE30DABEEB0B01070BCC98C18BD66``.
For previous releases, the key's fingerprint was
``8535CEF3F3C38EE69555BF67E4B5E45AA3B8C5C3``.
Dependencies
------------
``python``, ``pacman``, and ``snapper`` are all required.
Testing
-------
For testing, ``pytest`` is required. To run the tests do:
.. code-block:: bash
make test
Documentation
-------------
Typically, you will not need to build the documentation on your own and can simply
access it by visiting the `online documentation
<https://wesbarnett.github.io/snap-pac/>`_ or by accessing the manpage:
.. code-block:: bash
man 8 snap-pac
To build the documentation, ``sphinx`` is required. To build the documentation you can
do:
.. code-block:: bash
make docs
The resulting html documentation will then be located at ``docs/build/index.html``.
Additionally, this generates the manpage which will be located under ``man8``.

View file

@ -0,0 +1,23 @@
Troubleshooting
===============
.. toctree::
:maxdepth: 2
**snap-pac is only taking snapshots of the root configuration.**
That's the default behavior. See :doc:`configuration`.
**No snapshots are being taken when I run pacman.**
No snapper configurations are set up for snap-pac's pacman hooks. By default snap-pac
will take snapshots for the root configuration and any other configuration which has
SNAPSHOT set to yes in its configuration file. See :doc:`configuration`.
**After restoring snapshot from snap-pac, the pacman database is locked.**
The pre/post snaphots are taken while pacman is running, so this is expected. Follow
the instructions pacman gives you (*e.g.*, removing the lock file). You can add the
database lock file to a snapper filter so that snapper won't consider it when
performing snapper diff, snapper status, snapper undochange, etc. See the Filters
section in :manpage:`snapper(8)` for more information.

707
_static/alabaster.css Normal file
View file

@ -0,0 +1,707 @@
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: Georgia, serif;
font-size: 17px;
background-color: #fff;
color: #000;
margin: 0;
padding: 0;
}
div.document {
width: 940px;
margin: 30px auto 0 auto;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 220px;
}
div.sphinxsidebar {
width: 220px;
font-size: 14px;
line-height: 1.5;
}
hr {
border: 1px solid #B1B4B6;
}
div.body {
background-color: #fff;
color: #3E4349;
padding: 0 30px 0 30px;
}
div.body > .section {
text-align: left;
}
div.footer {
width: 940px;
margin: 20px auto 30px auto;
font-size: 14px;
color: #888;
text-align: right;
}
div.footer a {
color: #888;
}
p.caption {
font-family: inherit;
font-size: inherit;
}
div.relations {
display: none;
}
div.sphinxsidebar a {
color: #444;
text-decoration: none;
border-bottom: 1px dotted #999;
}
div.sphinxsidebar a:hover {
border-bottom: 1px solid #999;
}
div.sphinxsidebarwrapper {
padding: 18px 10px;
}
div.sphinxsidebarwrapper p.logo {
padding: 0;
margin: -10px 0 0 0px;
text-align: center;
}
div.sphinxsidebarwrapper h1.logo {
margin-top: -10px;
text-align: center;
margin-bottom: 5px;
text-align: left;
}
div.sphinxsidebarwrapper h1.logo-name {
margin-top: 0px;
}
div.sphinxsidebarwrapper p.blurb {
margin-top: 0;
font-style: normal;
}
div.sphinxsidebar h3,
div.sphinxsidebar h4 {
font-family: Georgia, serif;
color: #444;
font-size: 24px;
font-weight: normal;
margin: 0 0 5px 0;
padding: 0;
}
div.sphinxsidebar h4 {
font-size: 20px;
}
div.sphinxsidebar h3 a {
color: #444;
}
div.sphinxsidebar p.logo a,
div.sphinxsidebar h3 a,
div.sphinxsidebar p.logo a:hover,
div.sphinxsidebar h3 a:hover {
border: none;
}
div.sphinxsidebar p {
color: #555;
margin: 10px 0;
}
div.sphinxsidebar ul {
margin: 10px 0;
padding: 0;
color: #000;
}
div.sphinxsidebar ul li.toctree-l1 > a {
font-size: 120%;
}
div.sphinxsidebar ul li.toctree-l2 > a {
font-size: 110%;
}
div.sphinxsidebar input {
border: 1px solid #CCC;
font-family: Georgia, serif;
font-size: 1em;
}
div.sphinxsidebar hr {
border: none;
height: 1px;
color: #AAA;
background: #AAA;
text-align: left;
margin-left: 0;
width: 50%;
}
div.sphinxsidebar .badge {
border-bottom: none;
}
div.sphinxsidebar .badge:hover {
border-bottom: none;
}
/* To address an issue with donation coming after search */
div.sphinxsidebar h3.donation {
margin-top: 10px;
}
/* -- body styles ----------------------------------------------------------- */
a {
color: #004B6B;
text-decoration: underline;
}
a:hover {
color: #6D4100;
text-decoration: underline;
}
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: Georgia, serif;
font-weight: normal;
margin: 30px 0px 10px 0px;
padding: 0;
}
div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }
div.body h2 { font-size: 180%; }
div.body h3 { font-size: 150%; }
div.body h4 { font-size: 130%; }
div.body h5 { font-size: 100%; }
div.body h6 { font-size: 100%; }
a.headerlink {
color: #DDD;
padding: 0 4px;
text-decoration: none;
}
a.headerlink:hover {
color: #444;
background: #EAEAEA;
}
div.body p, div.body dd, div.body li {
line-height: 1.4em;
}
div.admonition {
margin: 20px 0px;
padding: 10px 30px;
background-color: #EEE;
border: 1px solid #CCC;
}
div.admonition tt.xref, div.admonition code.xref, div.admonition a tt {
background-color: #FBFBFB;
border-bottom: 1px solid #fafafa;
}
div.admonition p.admonition-title {
font-family: Georgia, serif;
font-weight: normal;
font-size: 24px;
margin: 0 0 10px 0;
padding: 0;
line-height: 1;
}
div.admonition p.last {
margin-bottom: 0;
}
div.highlight {
background-color: #fff;
}
dt:target, .highlight {
background: #FAF3E8;
}
div.warning {
background-color: #FCC;
border: 1px solid #FAA;
}
div.danger {
background-color: #FCC;
border: 1px solid #FAA;
-moz-box-shadow: 2px 2px 4px #D52C2C;
-webkit-box-shadow: 2px 2px 4px #D52C2C;
box-shadow: 2px 2px 4px #D52C2C;
}
div.error {
background-color: #FCC;
border: 1px solid #FAA;
-moz-box-shadow: 2px 2px 4px #D52C2C;
-webkit-box-shadow: 2px 2px 4px #D52C2C;
box-shadow: 2px 2px 4px #D52C2C;
}
div.caution {
background-color: #FCC;
border: 1px solid #FAA;
}
div.attention {
background-color: #FCC;
border: 1px solid #FAA;
}
div.important {
background-color: #EEE;
border: 1px solid #CCC;
}
div.note {
background-color: #EEE;
border: 1px solid #CCC;
}
div.tip {
background-color: #EEE;
border: 1px solid #CCC;
}
div.hint {
background-color: #EEE;
border: 1px solid #CCC;
}
div.seealso {
background-color: #EEE;
border: 1px solid #CCC;
}
div.topic {
background-color: #EEE;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre, tt, code {
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
font-size: 0.9em;
}
.hll {
background-color: #FFC;
margin: 0 -12px;
padding: 0 12px;
display: block;
}
img.screenshot {
}
tt.descname, tt.descclassname, code.descname, code.descclassname {
font-size: 0.95em;
}
tt.descname, code.descname {
padding-right: 0.08em;
}
img.screenshot {
-moz-box-shadow: 2px 2px 4px #EEE;
-webkit-box-shadow: 2px 2px 4px #EEE;
box-shadow: 2px 2px 4px #EEE;
}
table.docutils {
border: 1px solid #888;
-moz-box-shadow: 2px 2px 4px #EEE;
-webkit-box-shadow: 2px 2px 4px #EEE;
box-shadow: 2px 2px 4px #EEE;
}
table.docutils td, table.docutils th {
border: 1px solid #888;
padding: 0.25em 0.7em;
}
table.field-list, table.footnote {
border: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
table.footnote {
margin: 15px 0;
width: 100%;
border: 1px solid #EEE;
background: #FDFDFD;
font-size: 0.9em;
}
table.footnote + table.footnote {
margin-top: -15px;
border-top: none;
}
table.field-list th {
padding: 0 0.8em 0 0;
}
table.field-list td {
padding: 0;
}
table.field-list p {
margin-bottom: 0.8em;
}
/* Cloned from
* https://github.com/sphinx-doc/sphinx/commit/ef60dbfce09286b20b7385333d63a60321784e68
*/
.field-name {
-moz-hyphens: manual;
-ms-hyphens: manual;
-webkit-hyphens: manual;
hyphens: manual;
}
table.footnote td.label {
width: .1px;
padding: 0.3em 0 0.3em 0.5em;
}
table.footnote td {
padding: 0.3em 0.5em;
}
dl {
margin: 0;
padding: 0;
}
dl dd {
margin-left: 30px;
}
blockquote {
margin: 0 0 0 30px;
padding: 0;
}
ul, ol {
/* Matches the 30px from the narrow-screen "li > ul" selector below */
margin: 10px 0 10px 30px;
padding: 0;
}
pre {
background: #EEE;
padding: 7px 30px;
margin: 15px 0px;
line-height: 1.3em;
}
div.viewcode-block:target {
background: #ffd;
}
dl pre, blockquote pre, li pre {
margin-left: 0;
padding-left: 30px;
}
tt, code {
background-color: #ecf0f3;
color: #222;
/* padding: 1px 2px; */
}
tt.xref, code.xref, a tt {
background-color: #FBFBFB;
border-bottom: 1px solid #fff;
}
a.reference {
text-decoration: none;
border-bottom: 1px dotted #004B6B;
}
/* Don't put an underline on images */
a.image-reference, a.image-reference:hover {
border-bottom: none;
}
a.reference:hover {
border-bottom: 1px solid #6D4100;
}
a.footnote-reference {
text-decoration: none;
font-size: 0.7em;
vertical-align: top;
border-bottom: 1px dotted #004B6B;
}
a.footnote-reference:hover {
border-bottom: 1px solid #6D4100;
}
a:hover tt, a:hover code {
background: #EEE;
}
@media screen and (max-width: 870px) {
div.sphinxsidebar {
display: none;
}
div.document {
width: 100%;
}
div.documentwrapper {
margin-left: 0;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
}
div.bodywrapper {
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
}
ul {
margin-left: 0;
}
li > ul {
/* Matches the 30px from the "ul, ol" selector above */
margin-left: 30px;
}
.document {
width: auto;
}
.footer {
width: auto;
}
.bodywrapper {
margin: 0;
}
.footer {
width: auto;
}
.github {
display: none;
}
}
@media screen and (max-width: 875px) {
body {
margin: 0;
padding: 20px 30px;
}
div.documentwrapper {
float: none;
background: #fff;
}
div.sphinxsidebar {
display: block;
float: none;
width: 102.5%;
margin: -20px -30px 20px -30px;
padding: 10px 20px;
background: #333;
color: #FFF;
}
div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,
div.sphinxsidebar h3 a {
color: #fff;
}
div.sphinxsidebar a {
color: #AAA;
}
div.sphinxsidebar p.logo {
display: none;
}
div.document {
width: 100%;
margin: 0;
}
div.footer {
display: none;
}
div.bodywrapper {
margin: 0;
}
div.body {
min-height: 0;
padding: 0;
}
.rtd_doc_footer {
display: none;
}
.document {
width: auto;
}
.footer {
width: auto;
}
.footer {
width: auto;
}
.github {
display: none;
}
}
@media screen and (min-width: 876px) {
div.sphinxsidebar {
position: fixed;
margin-left: 0;
}
}
/* misc. */
.revsys-inline {
display: none!important;
}
/* Make nested-list/multi-paragraph items look better in Releases changelog
* pages. Without this, docutils' magical list fuckery causes inconsistent
* formatting between different release sub-lists.
*/
div#changelog > div.section > ul > li > p:only-child {
margin-bottom: 0;
}
/* Hide fugly table cell borders in ..bibliography:: directive output */
table.docutils.citation, table.docutils.citation td, table.docutils.citation th {
border: none;
/* Below needed in some edge cases; if not applied, bottom shadows appear */
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
/* relbar */
.related {
line-height: 30px;
width: 100%;
font-size: 0.9rem;
}
.related.top {
border-bottom: 1px solid #EEE;
margin-bottom: 20px;
}
.related.bottom {
border-top: 1px solid #EEE;
}
.related ul {
padding: 0;
margin: 0;
list-style: none;
}
.related li {
display: inline;
}
nav#rellinks {
float: right;
}
nav#rellinks li+li:before {
content: "|";
}
nav#breadcrumbs li+li:before {
content: "\00BB";
}
/* Hide certain items when printing */
@media print {
div.related {
display: none;
}
}

904
_static/basic.css Normal file
View file

@ -0,0 +1,904 @@
/*
* basic.css
* ~~~~~~~~~
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
/* -- main layout ----------------------------------------------------------- */
div.clearer {
clear: both;
}
div.section::after {
display: block;
content: '';
clear: left;
}
/* -- relbar ---------------------------------------------------------------- */
div.related {
width: 100%;
font-size: 90%;
}
div.related h3 {
display: none;
}
div.related ul {
margin: 0;
padding: 0 0 0 10px;
list-style: none;
}
div.related li {
display: inline;
}
div.related li.right {
float: right;
margin-right: 5px;
}
/* -- sidebar --------------------------------------------------------------- */
div.sphinxsidebarwrapper {
padding: 10px 5px 0 10px;
}
div.sphinxsidebar {
float: left;
width: 230px;
margin-left: -100%;
font-size: 90%;
word-wrap: break-word;
overflow-wrap : break-word;
}
div.sphinxsidebar ul {
list-style: none;
}
div.sphinxsidebar ul ul,
div.sphinxsidebar ul.want-points {
margin-left: 20px;
list-style: square;
}
div.sphinxsidebar ul ul {
margin-top: 0;
margin-bottom: 0;
}
div.sphinxsidebar form {
margin-top: 10px;
}
div.sphinxsidebar input {
border: 1px solid #98dbcc;
font-family: sans-serif;
font-size: 1em;
}
div.sphinxsidebar #searchbox form.search {
overflow: hidden;
}
div.sphinxsidebar #searchbox input[type="text"] {
float: left;
width: 80%;
padding: 0.25em;
box-sizing: border-box;
}
div.sphinxsidebar #searchbox input[type="submit"] {
float: left;
width: 20%;
border-left: none;
padding: 0.25em;
box-sizing: border-box;
}
img {
border: 0;
max-width: 100%;
}
/* -- search page ----------------------------------------------------------- */
ul.search {
margin: 10px 0 0 20px;
padding: 0;
}
ul.search li {
padding: 5px 0 5px 20px;
background-image: url(file.png);
background-repeat: no-repeat;
background-position: 0 7px;
}
ul.search li a {
font-weight: bold;
}
ul.search li p.context {
color: #888;
margin: 2px 0 0 30px;
text-align: left;
}
ul.keywordmatches li.goodmatch a {
font-weight: bold;
}
/* -- index page ------------------------------------------------------------ */
table.contentstable {
width: 90%;
margin-left: auto;
margin-right: auto;
}
table.contentstable p.biglink {
line-height: 150%;
}
a.biglink {
font-size: 1.3em;
}
span.linkdescr {
font-style: italic;
padding-top: 5px;
font-size: 90%;
}
/* -- general index --------------------------------------------------------- */
table.indextable {
width: 100%;
}
table.indextable td {
text-align: left;
vertical-align: top;
}
table.indextable ul {
margin-top: 0;
margin-bottom: 0;
list-style-type: none;
}
table.indextable > tbody > tr > td > ul {
padding-left: 0em;
}
table.indextable tr.pcap {
height: 10px;
}
table.indextable tr.cap {
margin-top: 10px;
background-color: #f2f2f2;
}
img.toggler {
margin-right: 3px;
margin-top: 3px;
cursor: pointer;
}
div.modindex-jumpbox {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
margin: 1em 0 1em 0;
padding: 0.4em;
}
div.genindex-jumpbox {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
margin: 1em 0 1em 0;
padding: 0.4em;
}
/* -- domain module index --------------------------------------------------- */
table.modindextable td {
padding: 2px;
border-collapse: collapse;
}
/* -- general body styles --------------------------------------------------- */
div.body {
min-width: 450px;
max-width: 800px;
}
div.body p, div.body dd, div.body li, div.body blockquote {
-moz-hyphens: auto;
-ms-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}
a.headerlink {
visibility: hidden;
}
a.brackets:before,
span.brackets > a:before{
content: "[";
}
a.brackets:after,
span.brackets > a:after {
content: "]";
}
h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink,
dt:hover > a.headerlink,
caption:hover > a.headerlink,
p.caption:hover > a.headerlink,
div.code-block-caption:hover > a.headerlink {
visibility: visible;
}
div.body p.caption {
text-align: inherit;
}
div.body td {
text-align: left;
}
.first {
margin-top: 0 !important;
}
p.rubric {
margin-top: 30px;
font-weight: bold;
}
img.align-left, figure.align-left, .figure.align-left, object.align-left {
clear: left;
float: left;
margin-right: 1em;
}
img.align-right, figure.align-right, .figure.align-right, object.align-right {
clear: right;
float: right;
margin-left: 1em;
}
img.align-center, figure.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
img.align-default, figure.align-default, .figure.align-default {
display: block;
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left;
}
.align-center {
text-align: center;
}
.align-default {
text-align: center;
}
.align-right {
text-align: right;
}
/* -- sidebars -------------------------------------------------------------- */
div.sidebar,
aside.sidebar {
margin: 0 0 0.5em 1em;
border: 1px solid #ddb;
padding: 7px;
background-color: #ffe;
width: 40%;
float: right;
clear: right;
overflow-x: auto;
}
p.sidebar-title {
font-weight: bold;
}
div.admonition, div.topic, blockquote {
clear: left;
}
/* -- topics ---------------------------------------------------------------- */
div.topic {
border: 1px solid #ccc;
padding: 7px;
margin: 10px 0 10px 0;
}
p.topic-title {
font-size: 1.1em;
font-weight: bold;
margin-top: 10px;
}
/* -- admonitions ----------------------------------------------------------- */
div.admonition {
margin-top: 10px;
margin-bottom: 10px;
padding: 7px;
}
div.admonition dt {
font-weight: bold;
}
p.admonition-title {
margin: 0px 10px 5px 0px;
font-weight: bold;
}
div.body p.centered {
text-align: center;
margin-top: 25px;
}
/* -- content of sidebars/topics/admonitions -------------------------------- */
div.sidebar > :last-child,
aside.sidebar > :last-child,
div.topic > :last-child,
div.admonition > :last-child {
margin-bottom: 0;
}
div.sidebar::after,
aside.sidebar::after,
div.topic::after,
div.admonition::after,
blockquote::after {
display: block;
content: '';
clear: both;
}
/* -- tables ---------------------------------------------------------------- */
table.docutils {
margin-top: 10px;
margin-bottom: 10px;
border: 0;
border-collapse: collapse;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
table.align-default {
margin-left: auto;
margin-right: auto;
}
table caption span.caption-number {
font-style: italic;
}
table caption span.caption-text {
}
table.docutils td, table.docutils th {
padding: 1px 8px 1px 5px;
border-top: 0;
border-left: 0;
border-right: 0;
border-bottom: 1px solid #aaa;
}
table.footnote td, table.footnote th {
border: 0 !important;
}
th {
text-align: left;
padding-right: 5px;
}
table.citation {
border-left: solid 1px gray;
margin-left: 1px;
}
table.citation td {
border-bottom: none;
}
th > :first-child,
td > :first-child {
margin-top: 0px;
}
th > :last-child,
td > :last-child {
margin-bottom: 0px;
}
/* -- figures --------------------------------------------------------------- */
div.figure, figure {
margin: 0.5em;
padding: 0.5em;
}
div.figure p.caption, figcaption {
padding: 0.3em;
}
div.figure p.caption span.caption-number,
figcaption span.caption-number {
font-style: italic;
}
div.figure p.caption span.caption-text,
figcaption span.caption-text {
}
/* -- field list styles ----------------------------------------------------- */
table.field-list td, table.field-list th {
border: 0 !important;
}
.field-list ul {
margin: 0;
padding-left: 1em;
}
.field-list p {
margin: 0;
}
.field-name {
-moz-hyphens: manual;
-ms-hyphens: manual;
-webkit-hyphens: manual;
hyphens: manual;
}
/* -- hlist styles ---------------------------------------------------------- */
table.hlist {
margin: 1em 0;
}
table.hlist td {
vertical-align: top;
}
/* -- object description styles --------------------------------------------- */
.sig {
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
}
.sig-name, code.descname {
background-color: transparent;
font-weight: bold;
}
.sig-name {
font-size: 1.1em;
}
code.descname {
font-size: 1.2em;
}
.sig-prename, code.descclassname {
background-color: transparent;
}
.optional {
font-size: 1.3em;
}
.sig-paren {
font-size: larger;
}
.sig-param.n {
font-style: italic;
}
/* C++ specific styling */
.sig-inline.c-texpr,
.sig-inline.cpp-texpr {
font-family: unset;
}
.sig.c .k, .sig.c .kt,
.sig.cpp .k, .sig.cpp .kt {
color: #0033B3;
}
.sig.c .m,
.sig.cpp .m {
color: #1750EB;
}
.sig.c .s, .sig.c .sc,
.sig.cpp .s, .sig.cpp .sc {
color: #067D17;
}
/* -- other body styles ----------------------------------------------------- */
ol.arabic {
list-style: decimal;
}
ol.loweralpha {
list-style: lower-alpha;
}
ol.upperalpha {
list-style: upper-alpha;
}
ol.lowerroman {
list-style: lower-roman;
}
ol.upperroman {
list-style: upper-roman;
}
:not(li) > ol > li:first-child > :first-child,
:not(li) > ul > li:first-child > :first-child {
margin-top: 0px;
}
:not(li) > ol > li:last-child > :last-child,
:not(li) > ul > li:last-child > :last-child {
margin-bottom: 0px;
}
ol.simple ol p,
ol.simple ul p,
ul.simple ol p,
ul.simple ul p {
margin-top: 0;
}
ol.simple > li:not(:first-child) > p,
ul.simple > li:not(:first-child) > p {
margin-top: 0;
}
ol.simple p,
ul.simple p {
margin-bottom: 0;
}
dl.footnote > dt,
dl.citation > dt {
float: left;
margin-right: 0.5em;
}
dl.footnote > dd,
dl.citation > dd {
margin-bottom: 0em;
}
dl.footnote > dd:after,
dl.citation > dd:after {
content: "";
clear: both;
}
dl.field-list {
display: grid;
grid-template-columns: fit-content(30%) auto;
}
dl.field-list > dt {
font-weight: bold;
word-break: break-word;
padding-left: 0.5em;
padding-right: 5px;
}
dl.field-list > dt:after {
content: ":";
}
dl.field-list > dd {
padding-left: 0.5em;
margin-top: 0em;
margin-left: 0em;
margin-bottom: 0em;
}
dl {
margin-bottom: 15px;
}
dd > :first-child {
margin-top: 0px;
}
dd ul, dd table {
margin-bottom: 10px;
}
dd {
margin-top: 3px;
margin-bottom: 10px;
margin-left: 30px;
}
dl > dd:last-child,
dl > dd:last-child > :last-child {
margin-bottom: 0;
}
dt:target, span.highlighted {
background-color: #fbe54e;
}
rect.highlighted {
fill: #fbe54e;
}
dl.glossary dt {
font-weight: bold;
font-size: 1.1em;
}
.versionmodified {
font-style: italic;
}
.system-message {
background-color: #fda;
padding: 5px;
border: 3px solid red;
}
.footnote:target {
background-color: #ffa;
}
.line-block {
display: block;
margin-top: 1em;
margin-bottom: 1em;
}
.line-block .line-block {
margin-top: 0;
margin-bottom: 0;
margin-left: 1.5em;
}
.guilabel, .menuselection {
font-family: sans-serif;
}
.accelerator {
text-decoration: underline;
}
.classifier {
font-style: oblique;
}
.classifier:before {
font-style: normal;
margin: 0.5em;
content: ":";
}
abbr, acronym {
border-bottom: dotted 1px;
cursor: help;
}
/* -- code displays --------------------------------------------------------- */
pre {
overflow: auto;
overflow-y: hidden; /* fixes display issues on Chrome browsers */
}
pre, div[class*="highlight-"] {
clear: both;
}
span.pre {
-moz-hyphens: none;
-ms-hyphens: none;
-webkit-hyphens: none;
hyphens: none;
}
div[class*="highlight-"] {
margin: 1em 0;
}
td.linenos pre {
border: 0;
background-color: transparent;
color: #aaa;
}
table.highlighttable {
display: block;
}
table.highlighttable tbody {
display: block;
}
table.highlighttable tr {
display: flex;
}
table.highlighttable td {
margin: 0;
padding: 0;
}
table.highlighttable td.linenos {
padding-right: 0.5em;
}
table.highlighttable td.code {
flex: 1;
overflow: hidden;
}
.highlight .hll {
display: block;
}
div.highlight pre,
table.highlighttable pre {
margin: 0;
}
div.code-block-caption + div {
margin-top: 0;
}
div.code-block-caption {
margin-top: 1em;
padding: 2px 5px;
font-size: small;
}
div.code-block-caption code {
background-color: transparent;
}
table.highlighttable td.linenos,
span.linenos,
div.highlight span.gp { /* gp: Generic.Prompt */
user-select: none;
-webkit-user-select: text; /* Safari fallback only */
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
}
div.code-block-caption span.caption-number {
padding: 0.1em 0.3em;
font-style: italic;
}
div.code-block-caption span.caption-text {
}
div.literal-block-wrapper {
margin: 1em 0;
}
code.xref, a code {
background-color: transparent;
font-weight: bold;
}
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
background-color: transparent;
}
.viewcode-link {
float: right;
}
.viewcode-back {
float: right;
font-family: sans-serif;
}
div.viewcode-block:target {
margin: -1px -10px;
padding: 0 10px;
}
/* -- math display ---------------------------------------------------------- */
img.math {
vertical-align: middle;
}
div.body div.math p {
text-align: center;
}
span.eqno {
float: right;
}
span.eqno a.headerlink {
position: absolute;
z-index: 1;
}
div.math:hover a.headerlink {
visibility: visible;
}
/* -- printout stylesheet --------------------------------------------------- */
@media print {
div.document,
div.documentwrapper,
div.bodywrapper {
margin: 0 !important;
width: 100%;
}
div.sphinxsidebar,
div.related,
div.footer,
#top-link {
display: none;
}
}

1
_static/custom.css Normal file
View file

@ -0,0 +1 @@
/* This file intentionally left blank. */

323
_static/doctools.js Normal file
View file

@ -0,0 +1,323 @@
/*
* doctools.js
* ~~~~~~~~~~~
*
* Sphinx JavaScript utilities for all documentation.
*
* :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
/**
* select a different prefix for underscore
*/
$u = _.noConflict();
/**
* make the code below compatible with browsers without
* an installed firebug like debugger
if (!window.console || !console.firebug) {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir",
"dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace",
"profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i)
window.console[names[i]] = function() {};
}
*/
/**
* small helper function to urldecode strings
*
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
*/
jQuery.urldecode = function(x) {
if (!x) {
return x
}
return decodeURIComponent(x.replace(/\+/g, ' '));
};
/**
* small helper function to urlencode strings
*/
jQuery.urlencode = encodeURIComponent;
/**
* This function returns the parsed url parameters of the
* current request. Multiple values per key are supported,
* it will always return arrays of strings for the value parts.
*/
jQuery.getQueryParameters = function(s) {
if (typeof s === 'undefined')
s = document.location.search;
var parts = s.substr(s.indexOf('?') + 1).split('&');
var result = {};
for (var i = 0; i < parts.length; i++) {
var tmp = parts[i].split('=', 2);
var key = jQuery.urldecode(tmp[0]);
var value = jQuery.urldecode(tmp[1]);
if (key in result)
result[key].push(value);
else
result[key] = [value];
}
return result;
};
/**
* highlight a given string on a jquery object by wrapping it in
* span elements with the given class name.
*/
jQuery.fn.highlightText = function(text, className) {
function highlight(node, addItems) {
if (node.nodeType === 3) {
var val = node.nodeValue;
var pos = val.toLowerCase().indexOf(text);
if (pos >= 0 &&
!jQuery(node.parentNode).hasClass(className) &&
!jQuery(node.parentNode).hasClass("nohighlight")) {
var span;
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
if (isInSVG) {
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
} else {
span = document.createElement("span");
span.className = className;
}
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
document.createTextNode(val.substr(pos + text.length)),
node.nextSibling));
node.nodeValue = val.substr(0, pos);
if (isInSVG) {
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
var bbox = node.parentElement.getBBox();
rect.x.baseVal.value = bbox.x;
rect.y.baseVal.value = bbox.y;
rect.width.baseVal.value = bbox.width;
rect.height.baseVal.value = bbox.height;
rect.setAttribute('class', className);
addItems.push({
"parent": node.parentNode,
"target": rect});
}
}
}
else if (!jQuery(node).is("button, select, textarea")) {
jQuery.each(node.childNodes, function() {
highlight(this, addItems);
});
}
}
var addItems = [];
var result = this.each(function() {
highlight(this, addItems);
});
for (var i = 0; i < addItems.length; ++i) {
jQuery(addItems[i].parent).before(addItems[i].target);
}
return result;
};
/*
* backward compatibility for jQuery.browser
* This will be supported until firefox bug is fixed.
*/
if (!jQuery.browser) {
jQuery.uaMatch = function(ua) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
/(msie) ([\w.]+)/.exec(ua) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
jQuery.browser = {};
jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
}
/**
* Small JavaScript module for the documentation.
*/
var Documentation = {
init : function() {
this.fixFirefoxAnchorBug();
this.highlightSearchWords();
this.initIndexTable();
if (DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) {
this.initOnKeyListeners();
}
},
/**
* i18n support
*/
TRANSLATIONS : {},
PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; },
LOCALE : 'unknown',
// gettext and ngettext don't access this so that the functions
// can safely bound to a different name (_ = Documentation.gettext)
gettext : function(string) {
var translated = Documentation.TRANSLATIONS[string];
if (typeof translated === 'undefined')
return string;
return (typeof translated === 'string') ? translated : translated[0];
},
ngettext : function(singular, plural, n) {
var translated = Documentation.TRANSLATIONS[singular];
if (typeof translated === 'undefined')
return (n == 1) ? singular : plural;
return translated[Documentation.PLURALEXPR(n)];
},
addTranslations : function(catalog) {
for (var key in catalog.messages)
this.TRANSLATIONS[key] = catalog.messages[key];
this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');
this.LOCALE = catalog.locale;
},
/**
* add context elements like header anchor links
*/
addContextElements : function() {
$('div[id] > :header:first').each(function() {
$('<a class="headerlink">\u00B6</a>').
attr('href', '#' + this.id).
attr('title', _('Permalink to this headline')).
appendTo(this);
});
$('dt[id]').each(function() {
$('<a class="headerlink">\u00B6</a>').
attr('href', '#' + this.id).
attr('title', _('Permalink to this definition')).
appendTo(this);
});
},
/**
* workaround a firefox stupidity
* see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075
*/
fixFirefoxAnchorBug : function() {
if (document.location.hash && $.browser.mozilla)
window.setTimeout(function() {
document.location.href += '';
}, 10);
},
/**
* highlight the search words provided in the url in the text
*/
highlightSearchWords : function() {
var params = $.getQueryParameters();
var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
if (terms.length) {
var body = $('div.body');
if (!body.length) {
body = $('body');
}
window.setTimeout(function() {
$.each(terms, function() {
body.highlightText(this.toLowerCase(), 'highlighted');
});
}, 10);
$('<p class="highlight-link"><a href="javascript:Documentation.' +
'hideSearchWords()">' + _('Hide Search Matches') + '</a></p>')
.appendTo($('#searchbox'));
}
},
/**
* init the domain index toggle buttons
*/
initIndexTable : function() {
var togglers = $('img.toggler').click(function() {
var src = $(this).attr('src');
var idnum = $(this).attr('id').substr(7);
$('tr.cg-' + idnum).toggle();
if (src.substr(-9) === 'minus.png')
$(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
else
$(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
}).css('display', '');
if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) {
togglers.click();
}
},
/**
* helper function to hide the search marks again
*/
hideSearchWords : function() {
$('#searchbox .highlight-link').fadeOut(300);
$('span.highlighted').removeClass('highlighted');
},
/**
* make the url absolute
*/
makeURL : function(relativeURL) {
return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL;
},
/**
* get the current relative url
*/
getCurrentURL : function() {
var path = document.location.pathname;
var parts = path.split(/\//);
$.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
if (this === '..')
parts.pop();
});
var url = parts.join('/');
return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
},
initOnKeyListeners: function() {
$(document).keydown(function(event) {
var activeElementType = document.activeElement.tagName;
// don't navigate when in search box, textarea, dropdown or button
if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT'
&& activeElementType !== 'BUTTON' && !event.altKey && !event.ctrlKey && !event.metaKey
&& !event.shiftKey) {
switch (event.keyCode) {
case 37: // left
var prevHref = $('link[rel="prev"]').prop('href');
if (prevHref) {
window.location.href = prevHref;
return false;
}
break;
case 39: // right
var nextHref = $('link[rel="next"]').prop('href');
if (nextHref) {
window.location.href = nextHref;
return false;
}
break;
}
}
});
}
};
// quick alias for translations
_ = Documentation.gettext;
$(document).ready(function() {
Documentation.init();
});

View file

@ -0,0 +1,12 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
BUILDER: 'html',
FILE_SUFFIX: '.html',
LINK_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt',
NAVIGATION_WITH_KEYS: false
};

BIN
_static/file.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

10872
_static/jquery-3.5.1.js vendored Normal file

File diff suppressed because it is too large Load diff

2
_static/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

297
_static/language_data.js Normal file
View file

@ -0,0 +1,297 @@
/*
* language_data.js
* ~~~~~~~~~~~~~~~~
*
* This script contains the language-specific data used by searchtools.js,
* namely the list of stopwords, stemmer, scorer and splitter.
*
* :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"];
/* Non-minified version is copied as a separate JS file, is available */
/**
* Porter Stemmer
*/
var Stemmer = function() {
var step2list = {
ational: 'ate',
tional: 'tion',
enci: 'ence',
anci: 'ance',
izer: 'ize',
bli: 'ble',
alli: 'al',
entli: 'ent',
eli: 'e',
ousli: 'ous',
ization: 'ize',
ation: 'ate',
ator: 'ate',
alism: 'al',
iveness: 'ive',
fulness: 'ful',
ousness: 'ous',
aliti: 'al',
iviti: 'ive',
biliti: 'ble',
logi: 'log'
};
var step3list = {
icate: 'ic',
ative: '',
alize: 'al',
iciti: 'ic',
ical: 'ic',
ful: '',
ness: ''
};
var c = "[^aeiou]"; // consonant
var v = "[aeiouy]"; // vowel
var C = c + "[^aeiouy]*"; // consonant sequence
var V = v + "[aeiou]*"; // vowel sequence
var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
var s_v = "^(" + C + ")?" + v; // vowel in stem
this.stemWord = function (w) {
var stem;
var suffix;
var firstch;
var origword = w;
if (w.length < 3)
return w;
var re;
var re2;
var re3;
var re4;
firstch = w.substr(0,1);
if (firstch == "y")
w = firstch.toUpperCase() + w.substr(1);
// Step 1a
re = /^(.+?)(ss|i)es$/;
re2 = /^(.+?)([^s])s$/;
if (re.test(w))
w = w.replace(re,"$1$2");
else if (re2.test(w))
w = w.replace(re2,"$1$2");
// Step 1b
re = /^(.+?)eed$/;
re2 = /^(.+?)(ed|ing)$/;
if (re.test(w)) {
var fp = re.exec(w);
re = new RegExp(mgr0);
if (re.test(fp[1])) {
re = /.$/;
w = w.replace(re,"");
}
}
else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1];
re2 = new RegExp(s_v);
if (re2.test(stem)) {
w = stem;
re2 = /(at|bl|iz)$/;
re3 = new RegExp("([^aeiouylsz])\\1$");
re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
if (re2.test(w))
w = w + "e";
else if (re3.test(w)) {
re = /.$/;
w = w.replace(re,"");
}
else if (re4.test(w))
w = w + "e";
}
}
// Step 1c
re = /^(.+?)y$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(s_v);
if (re.test(stem))
w = stem + "i";
}
// Step 2
re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = new RegExp(mgr0);
if (re.test(stem))
w = stem + step2list[suffix];
}
// Step 3
re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = new RegExp(mgr0);
if (re.test(stem))
w = stem + step3list[suffix];
}
// Step 4
re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
re2 = /^(.+?)(s|t)(ion)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(mgr1);
if (re.test(stem))
w = stem;
}
else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1] + fp[2];
re2 = new RegExp(mgr1);
if (re2.test(stem))
w = stem;
}
// Step 5
re = /^(.+?)e$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(mgr1);
re2 = new RegExp(meq1);
re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
w = stem;
}
re = /ll$/;
re2 = new RegExp(mgr1);
if (re.test(w) && re2.test(w)) {
re = /.$/;
w = w.replace(re,"");
}
// and turn initial Y back to y
if (firstch == "y")
w = firstch.toLowerCase() + w.substr(1);
return w;
}
}
var splitChars = (function() {
var result = {};
var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648,
1748, 1809, 2416, 2473, 2481, 2526, 2601, 2609, 2612, 2615, 2653, 2702,
2706, 2729, 2737, 2740, 2857, 2865, 2868, 2910, 2928, 2948, 2961, 2971,
2973, 3085, 3089, 3113, 3124, 3213, 3217, 3241, 3252, 3295, 3341, 3345,
3369, 3506, 3516, 3633, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3761,
3781, 3912, 4239, 4347, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823,
4881, 5760, 5901, 5997, 6313, 7405, 8024, 8026, 8028, 8030, 8117, 8125,
8133, 8181, 8468, 8485, 8487, 8489, 8494, 8527, 11311, 11359, 11687, 11695,
11703, 11711, 11719, 11727, 11735, 12448, 12539, 43010, 43014, 43019, 43587,
43696, 43713, 64286, 64297, 64311, 64317, 64319, 64322, 64325, 65141];
var i, j, start, end;
for (i = 0; i < singles.length; i++) {
result[singles[i]] = true;
}
var ranges = [[0, 47], [58, 64], [91, 94], [123, 169], [171, 177], [182, 184], [706, 709],
[722, 735], [741, 747], [751, 879], [888, 889], [894, 901], [1154, 1161],
[1318, 1328], [1367, 1368], [1370, 1376], [1416, 1487], [1515, 1519], [1523, 1568],
[1611, 1631], [1642, 1645], [1750, 1764], [1767, 1773], [1789, 1790], [1792, 1807],
[1840, 1868], [1958, 1968], [1970, 1983], [2027, 2035], [2038, 2041], [2043, 2047],
[2070, 2073], [2075, 2083], [2085, 2087], [2089, 2307], [2362, 2364], [2366, 2383],
[2385, 2391], [2402, 2405], [2419, 2424], [2432, 2436], [2445, 2446], [2449, 2450],
[2483, 2485], [2490, 2492], [2494, 2509], [2511, 2523], [2530, 2533], [2546, 2547],
[2554, 2564], [2571, 2574], [2577, 2578], [2618, 2648], [2655, 2661], [2672, 2673],
[2677, 2692], [2746, 2748], [2750, 2767], [2769, 2783], [2786, 2789], [2800, 2820],
[2829, 2830], [2833, 2834], [2874, 2876], [2878, 2907], [2914, 2917], [2930, 2946],
[2955, 2957], [2966, 2968], [2976, 2978], [2981, 2983], [2987, 2989], [3002, 3023],
[3025, 3045], [3059, 3076], [3130, 3132], [3134, 3159], [3162, 3167], [3170, 3173],
[3184, 3191], [3199, 3204], [3258, 3260], [3262, 3293], [3298, 3301], [3312, 3332],
[3386, 3388], [3390, 3423], [3426, 3429], [3446, 3449], [3456, 3460], [3479, 3481],
[3518, 3519], [3527, 3584], [3636, 3647], [3655, 3663], [3674, 3712], [3717, 3718],
[3723, 3724], [3726, 3731], [3752, 3753], [3764, 3772], [3774, 3775], [3783, 3791],
[3802, 3803], [3806, 3839], [3841, 3871], [3892, 3903], [3949, 3975], [3980, 4095],
[4139, 4158], [4170, 4175], [4182, 4185], [4190, 4192], [4194, 4196], [4199, 4205],
[4209, 4212], [4226, 4237], [4250, 4255], [4294, 4303], [4349, 4351], [4686, 4687],
[4702, 4703], [4750, 4751], [4790, 4791], [4806, 4807], [4886, 4887], [4955, 4968],
[4989, 4991], [5008, 5023], [5109, 5120], [5741, 5742], [5787, 5791], [5867, 5869],
[5873, 5887], [5906, 5919], [5938, 5951], [5970, 5983], [6001, 6015], [6068, 6102],
[6104, 6107], [6109, 6111], [6122, 6127], [6138, 6159], [6170, 6175], [6264, 6271],
[6315, 6319], [6390, 6399], [6429, 6469], [6510, 6511], [6517, 6527], [6572, 6592],
[6600, 6607], [6619, 6655], [6679, 6687], [6741, 6783], [6794, 6799], [6810, 6822],
[6824, 6916], [6964, 6980], [6988, 6991], [7002, 7042], [7073, 7085], [7098, 7167],
[7204, 7231], [7242, 7244], [7294, 7400], [7410, 7423], [7616, 7679], [7958, 7959],
[7966, 7967], [8006, 8007], [8014, 8015], [8062, 8063], [8127, 8129], [8141, 8143],
[8148, 8149], [8156, 8159], [8173, 8177], [8189, 8303], [8306, 8307], [8314, 8318],
[8330, 8335], [8341, 8449], [8451, 8454], [8456, 8457], [8470, 8472], [8478, 8483],
[8506, 8507], [8512, 8516], [8522, 8525], [8586, 9311], [9372, 9449], [9472, 10101],
[10132, 11263], [11493, 11498], [11503, 11516], [11518, 11519], [11558, 11567],
[11622, 11630], [11632, 11647], [11671, 11679], [11743, 11822], [11824, 12292],
[12296, 12320], [12330, 12336], [12342, 12343], [12349, 12352], [12439, 12444],
[12544, 12548], [12590, 12592], [12687, 12689], [12694, 12703], [12728, 12783],
[12800, 12831], [12842, 12880], [12896, 12927], [12938, 12976], [12992, 13311],
[19894, 19967], [40908, 40959], [42125, 42191], [42238, 42239], [42509, 42511],
[42540, 42559], [42592, 42593], [42607, 42622], [42648, 42655], [42736, 42774],
[42784, 42785], [42889, 42890], [42893, 43002], [43043, 43055], [43062, 43071],
[43124, 43137], [43188, 43215], [43226, 43249], [43256, 43258], [43260, 43263],
[43302, 43311], [43335, 43359], [43389, 43395], [43443, 43470], [43482, 43519],
[43561, 43583], [43596, 43599], [43610, 43615], [43639, 43641], [43643, 43647],
[43698, 43700], [43703, 43704], [43710, 43711], [43715, 43738], [43742, 43967],
[44003, 44015], [44026, 44031], [55204, 55215], [55239, 55242], [55292, 55295],
[57344, 63743], [64046, 64047], [64110, 64111], [64218, 64255], [64263, 64274],
[64280, 64284], [64434, 64466], [64830, 64847], [64912, 64913], [64968, 65007],
[65020, 65135], [65277, 65295], [65306, 65312], [65339, 65344], [65371, 65381],
[65471, 65473], [65480, 65481], [65488, 65489], [65496, 65497]];
for (i = 0; i < ranges.length; i++) {
start = ranges[i][0];
end = ranges[i][1];
for (j = start; j <= end; j++) {
result[j] = true;
}
}
return result;
})();
function splitQuery(query) {
var result = [];
var start = -1;
for (var i = 0; i < query.length; i++) {
if (splitChars[query.charCodeAt(i)]) {
if (start !== -1) {
result.push(query.slice(start, i));
start = -1;
}
} else if (start === -1) {
start = i;
}
}
if (start !== -1) {
result.push(query.slice(start));
}
return result;
}

BIN
_static/minus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

BIN
_static/plus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

82
_static/pygments.css Normal file
View file

@ -0,0 +1,82 @@
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #f8f8f8; }
.highlight .c { color: #8f5902; font-style: italic } /* Comment */
.highlight .err { color: #a40000; border: 1px solid #ef2929 } /* Error */
.highlight .g { color: #000000 } /* Generic */
.highlight .k { color: #004461; font-weight: bold } /* Keyword */
.highlight .l { color: #000000 } /* Literal */
.highlight .n { color: #000000 } /* Name */
.highlight .o { color: #582800 } /* Operator */
.highlight .x { color: #000000 } /* Other */
.highlight .p { color: #000000; font-weight: bold } /* Punctuation */
.highlight .ch { color: #8f5902; font-style: italic } /* Comment.Hashbang */
.highlight .cm { color: #8f5902; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #8f5902 } /* Comment.Preproc */
.highlight .cpf { color: #8f5902; font-style: italic } /* Comment.PreprocFile */
.highlight .c1 { color: #8f5902; font-style: italic } /* Comment.Single */
.highlight .cs { color: #8f5902; font-style: italic } /* Comment.Special */
.highlight .gd { color: #a40000 } /* Generic.Deleted */
.highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */
.highlight .gr { color: #ef2929 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #00A000 } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #745334 } /* Generic.Prompt */
.highlight .gs { color: #000000; font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.highlight .gt { color: #a40000; font-weight: bold } /* Generic.Traceback */
.highlight .kc { color: #004461; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #004461; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #004461; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #004461; font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { color: #004461; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #004461; font-weight: bold } /* Keyword.Type */
.highlight .ld { color: #000000 } /* Literal.Date */
.highlight .m { color: #990000 } /* Literal.Number */
.highlight .s { color: #4e9a06 } /* Literal.String */
.highlight .na { color: #c4a000 } /* Name.Attribute */
.highlight .nb { color: #004461 } /* Name.Builtin */
.highlight .nc { color: #000000 } /* Name.Class */
.highlight .no { color: #000000 } /* Name.Constant */
.highlight .nd { color: #888888 } /* Name.Decorator */
.highlight .ni { color: #ce5c00 } /* Name.Entity */
.highlight .ne { color: #cc0000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #000000 } /* Name.Function */
.highlight .nl { color: #f57900 } /* Name.Label */
.highlight .nn { color: #000000 } /* Name.Namespace */
.highlight .nx { color: #000000 } /* Name.Other */
.highlight .py { color: #000000 } /* Name.Property */
.highlight .nt { color: #004461; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #000000 } /* Name.Variable */
.highlight .ow { color: #004461; font-weight: bold } /* Operator.Word */
.highlight .w { color: #f8f8f8; text-decoration: underline } /* Text.Whitespace */
.highlight .mb { color: #990000 } /* Literal.Number.Bin */
.highlight .mf { color: #990000 } /* Literal.Number.Float */
.highlight .mh { color: #990000 } /* Literal.Number.Hex */
.highlight .mi { color: #990000 } /* Literal.Number.Integer */
.highlight .mo { color: #990000 } /* Literal.Number.Oct */
.highlight .sa { color: #4e9a06 } /* Literal.String.Affix */
.highlight .sb { color: #4e9a06 } /* Literal.String.Backtick */
.highlight .sc { color: #4e9a06 } /* Literal.String.Char */
.highlight .dl { color: #4e9a06 } /* Literal.String.Delimiter */
.highlight .sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #4e9a06 } /* Literal.String.Double */
.highlight .se { color: #4e9a06 } /* Literal.String.Escape */
.highlight .sh { color: #4e9a06 } /* Literal.String.Heredoc */
.highlight .si { color: #4e9a06 } /* Literal.String.Interpol */
.highlight .sx { color: #4e9a06 } /* Literal.String.Other */
.highlight .sr { color: #4e9a06 } /* Literal.String.Regex */
.highlight .s1 { color: #4e9a06 } /* Literal.String.Single */
.highlight .ss { color: #4e9a06 } /* Literal.String.Symbol */
.highlight .bp { color: #3465a4 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #000000 } /* Name.Function.Magic */
.highlight .vc { color: #000000 } /* Name.Variable.Class */
.highlight .vg { color: #000000 } /* Name.Variable.Global */
.highlight .vi { color: #000000 } /* Name.Variable.Instance */
.highlight .vm { color: #000000 } /* Name.Variable.Magic */
.highlight .il { color: #990000 } /* Literal.Number.Integer.Long */

528
_static/searchtools.js Normal file
View file

@ -0,0 +1,528 @@
/*
* searchtools.js
* ~~~~~~~~~~~~~~~~
*
* Sphinx JavaScript utilities for the full-text search.
*
* :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
if (!Scorer) {
/**
* Simple result scoring code.
*/
var Scorer = {
// Implement the following function to further tweak the score for each result
// The function takes a result array [filename, title, anchor, descr, score]
// and returns the new score.
/*
score: function(result) {
return result[4];
},
*/
// query matches the full name of an object
objNameMatch: 11,
// or matches in the last dotted part of the object name
objPartialMatch: 6,
// Additive scores depending on the priority of the object
objPrio: {0: 15, // used to be importantResults
1: 5, // used to be objectResults
2: -5}, // used to be unimportantResults
// Used when the priority is not in the mapping.
objPrioDefault: 0,
// query found in title
title: 15,
partialTitle: 7,
// query found in terms
term: 5,
partialTerm: 2
};
}
if (!splitQuery) {
function splitQuery(query) {
return query.split(/\s+/);
}
}
/**
* Search Module
*/
var Search = {
_index : null,
_queued_query : null,
_pulse_status : -1,
htmlToText : function(htmlString) {
var virtualDocument = document.implementation.createHTMLDocument('virtual');
var htmlElement = $(htmlString, virtualDocument);
htmlElement.find('.headerlink').remove();
docContent = htmlElement.find('[role=main]')[0];
if(docContent === undefined) {
console.warn("Content block not found. Sphinx search tries to obtain it " +
"via '[role=main]'. Could you check your theme or template.");
return "";
}
return docContent.textContent || docContent.innerText;
},
init : function() {
var params = $.getQueryParameters();
if (params.q) {
var query = params.q[0];
$('input[name="q"]')[0].value = query;
this.performSearch(query);
}
},
loadIndex : function(url) {
$.ajax({type: "GET", url: url, data: null,
dataType: "script", cache: true,
complete: function(jqxhr, textstatus) {
if (textstatus != "success") {
document.getElementById("searchindexloader").src = url;
}
}});
},
setIndex : function(index) {
var q;
this._index = index;
if ((q = this._queued_query) !== null) {
this._queued_query = null;
Search.query(q);
}
},
hasIndex : function() {
return this._index !== null;
},
deferQuery : function(query) {
this._queued_query = query;
},
stopPulse : function() {
this._pulse_status = 0;
},
startPulse : function() {
if (this._pulse_status >= 0)
return;
function pulse() {
var i;
Search._pulse_status = (Search._pulse_status + 1) % 4;
var dotString = '';
for (i = 0; i < Search._pulse_status; i++)
dotString += '.';
Search.dots.text(dotString);
if (Search._pulse_status > -1)
window.setTimeout(pulse, 500);
}
pulse();
},
/**
* perform a search for something (or wait until index is loaded)
*/
performSearch : function(query) {
// create the required interface elements
this.out = $('#search-results');
this.title = $('<h2>' + _('Searching') + '</h2>').appendTo(this.out);
this.dots = $('<span></span>').appendTo(this.title);
this.status = $('<p class="search-summary">&nbsp;</p>').appendTo(this.out);
this.output = $('<ul class="search"/>').appendTo(this.out);
$('#search-progress').text(_('Preparing search...'));
this.startPulse();
// index already loaded, the browser was quick!
if (this.hasIndex())
this.query(query);
else
this.deferQuery(query);
},
/**
* execute search (requires search index to be loaded)
*/
query : function(query) {
var i;
// stem the searchterms and add them to the correct list
var stemmer = new Stemmer();
var searchterms = [];
var excluded = [];
var hlterms = [];
var tmp = splitQuery(query);
var objectterms = [];
for (i = 0; i < tmp.length; i++) {
if (tmp[i] !== "") {
objectterms.push(tmp[i].toLowerCase());
}
if ($u.indexOf(stopwords, tmp[i].toLowerCase()) != -1 || tmp[i] === "") {
// skip this "word"
continue;
}
// stem the word
var word = stemmer.stemWord(tmp[i].toLowerCase());
// prevent stemmer from cutting word smaller than two chars
if(word.length < 3 && tmp[i].length >= 3) {
word = tmp[i];
}
var toAppend;
// select the correct list
if (word[0] == '-') {
toAppend = excluded;
word = word.substr(1);
}
else {
toAppend = searchterms;
hlterms.push(tmp[i].toLowerCase());
}
// only add if not already in the list
if (!$u.contains(toAppend, word))
toAppend.push(word);
}
var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" "));
// console.debug('SEARCH: searching for:');
// console.info('required: ', searchterms);
// console.info('excluded: ', excluded);
// prepare search
var terms = this._index.terms;
var titleterms = this._index.titleterms;
// array of [filename, title, anchor, descr, score]
var results = [];
$('#search-progress').empty();
// lookup as object
for (i = 0; i < objectterms.length; i++) {
var others = [].concat(objectterms.slice(0, i),
objectterms.slice(i+1, objectterms.length));
results = results.concat(this.performObjectSearch(objectterms[i], others));
}
// lookup as search terms in fulltext
results = results.concat(this.performTermsSearch(searchterms, excluded, terms, titleterms));
// let the scorer override scores with a custom scoring function
if (Scorer.score) {
for (i = 0; i < results.length; i++)
results[i][4] = Scorer.score(results[i]);
}
// now sort the results by score (in opposite order of appearance, since the
// display function below uses pop() to retrieve items) and then
// alphabetically
results.sort(function(a, b) {
var left = a[4];
var right = b[4];
if (left > right) {
return 1;
} else if (left < right) {
return -1;
} else {
// same score: sort alphabetically
left = a[1].toLowerCase();
right = b[1].toLowerCase();
return (left > right) ? -1 : ((left < right) ? 1 : 0);
}
});
// for debugging
//Search.lastresults = results.slice(); // a copy
//console.info('search results:', Search.lastresults);
// print the results
var resultCount = results.length;
function displayNextItem() {
// results left, load the summary and display it
if (results.length) {
var item = results.pop();
var listItem = $('<li></li>');
var requestUrl = "";
var linkUrl = "";
if (DOCUMENTATION_OPTIONS.BUILDER === 'dirhtml') {
// dirhtml builder
var dirname = item[0] + '/';
if (dirname.match(/\/index\/$/)) {
dirname = dirname.substring(0, dirname.length-6);
} else if (dirname == 'index/') {
dirname = '';
}
requestUrl = DOCUMENTATION_OPTIONS.URL_ROOT + dirname;
linkUrl = requestUrl;
} else {
// normal html builders
requestUrl = DOCUMENTATION_OPTIONS.URL_ROOT + item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX;
linkUrl = item[0] + DOCUMENTATION_OPTIONS.LINK_SUFFIX;
}
listItem.append($('<a/>').attr('href',
linkUrl +
highlightstring + item[2]).html(item[1]));
if (item[3]) {
listItem.append($('<span> (' + item[3] + ')</span>'));
Search.output.append(listItem);
setTimeout(function() {
displayNextItem();
}, 5);
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
$.ajax({url: requestUrl,
dataType: "text",
complete: function(jqxhr, textstatus) {
var data = jqxhr.responseText;
if (data !== '' && data !== undefined) {
var summary = Search.makeSearchSummary(data, searchterms, hlterms);
if (summary) {
listItem.append(summary);
}
}
Search.output.append(listItem);
setTimeout(function() {
displayNextItem();
}, 5);
}});
} else {
// no source available, just display title
Search.output.append(listItem);
setTimeout(function() {
displayNextItem();
}, 5);
}
}
// search finished, update title and status message
else {
Search.stopPulse();
Search.title.text(_('Search Results'));
if (!resultCount)
Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
else
Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
Search.status.fadeIn(500);
}
}
displayNextItem();
},
/**
* search for object names
*/
performObjectSearch : function(object, otherterms) {
var filenames = this._index.filenames;
var docnames = this._index.docnames;
var objects = this._index.objects;
var objnames = this._index.objnames;
var titles = this._index.titles;
var i;
var results = [];
for (var prefix in objects) {
for (var name in objects[prefix]) {
var fullname = (prefix ? prefix + '.' : '') + name;
var fullnameLower = fullname.toLowerCase()
if (fullnameLower.indexOf(object) > -1) {
var score = 0;
var parts = fullnameLower.split('.');
// check for different match types: exact matches of full name or
// "last name" (i.e. last dotted part)
if (fullnameLower == object || parts[parts.length - 1] == object) {
score += Scorer.objNameMatch;
// matches in last name
} else if (parts[parts.length - 1].indexOf(object) > -1) {
score += Scorer.objPartialMatch;
}
var match = objects[prefix][name];
var objname = objnames[match[1]][2];
var title = titles[match[0]];
// If more than one term searched for, we require other words to be
// found in the name/title/description
if (otherterms.length > 0) {
var haystack = (prefix + ' ' + name + ' ' +
objname + ' ' + title).toLowerCase();
var allfound = true;
for (i = 0; i < otherterms.length; i++) {
if (haystack.indexOf(otherterms[i]) == -1) {
allfound = false;
break;
}
}
if (!allfound) {
continue;
}
}
var descr = objname + _(', in ') + title;
var anchor = match[3];
if (anchor === '')
anchor = fullname;
else if (anchor == '-')
anchor = objnames[match[1]][1] + '-' + fullname;
// add custom score for some objects according to scorer
if (Scorer.objPrio.hasOwnProperty(match[2])) {
score += Scorer.objPrio[match[2]];
} else {
score += Scorer.objPrioDefault;
}
results.push([docnames[match[0]], fullname, '#'+anchor, descr, score, filenames[match[0]]]);
}
}
}
return results;
},
/**
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
*/
escapeRegExp : function(string) {
return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
},
/**
* search for full-text terms in the index
*/
performTermsSearch : function(searchterms, excluded, terms, titleterms) {
var docnames = this._index.docnames;
var filenames = this._index.filenames;
var titles = this._index.titles;
var i, j, file;
var fileMap = {};
var scoreMap = {};
var results = [];
// perform the search on the required terms
for (i = 0; i < searchterms.length; i++) {
var word = searchterms[i];
var files = [];
var _o = [
{files: terms[word], score: Scorer.term},
{files: titleterms[word], score: Scorer.title}
];
// add support for partial matches
if (word.length > 2) {
var word_regex = this.escapeRegExp(word);
for (var w in terms) {
if (w.match(word_regex) && !terms[word]) {
_o.push({files: terms[w], score: Scorer.partialTerm})
}
}
for (var w in titleterms) {
if (w.match(word_regex) && !titleterms[word]) {
_o.push({files: titleterms[w], score: Scorer.partialTitle})
}
}
}
// no match but word was a required one
if ($u.every(_o, function(o){return o.files === undefined;})) {
break;
}
// found search word in contents
$u.each(_o, function(o) {
var _files = o.files;
if (_files === undefined)
return
if (_files.length === undefined)
_files = [_files];
files = files.concat(_files);
// set score for the word in each file to Scorer.term
for (j = 0; j < _files.length; j++) {
file = _files[j];
if (!(file in scoreMap))
scoreMap[file] = {};
scoreMap[file][word] = o.score;
}
});
// create the mapping
for (j = 0; j < files.length; j++) {
file = files[j];
if (file in fileMap && fileMap[file].indexOf(word) === -1)
fileMap[file].push(word);
else
fileMap[file] = [word];
}
}
// now check if the files don't contain excluded terms
for (file in fileMap) {
var valid = true;
// check if all requirements are matched
var filteredTermCount = // as search terms with length < 3 are discarded: ignore
searchterms.filter(function(term){return term.length > 2}).length
if (
fileMap[file].length != searchterms.length &&
fileMap[file].length != filteredTermCount
) continue;
// ensure that none of the excluded terms is in the search result
for (i = 0; i < excluded.length; i++) {
if (terms[excluded[i]] == file ||
titleterms[excluded[i]] == file ||
$u.contains(terms[excluded[i]] || [], file) ||
$u.contains(titleterms[excluded[i]] || [], file)) {
valid = false;
break;
}
}
// if we have still a valid result we can add it to the result list
if (valid) {
// select one (max) score for the file.
// for better ranking, we should calculate ranking by using words statistics like basic tf-idf...
var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]}));
results.push([docnames[file], titles[file], '', null, score, filenames[file]]);
}
}
return results;
},
/**
* helper function to return a node containing the
* search summary for a given text. keywords is a list
* of stemmed words, hlwords is the list of normal, unstemmed
* words. the first one is used to find the occurrence, the
* latter for highlighting it.
*/
makeSearchSummary : function(htmlText, keywords, hlwords) {
var text = Search.htmlToText(htmlText);
if (text == "") {
return null;
}
var textLower = text.toLowerCase();
var start = 0;
$.each(keywords, function() {
var i = textLower.indexOf(this.toLowerCase());
if (i > -1)
start = i;
});
start = Math.max(start - 120, 0);
var excerpt = ((start > 0) ? '...' : '') +
$.trim(text.substr(start, 240)) +
((start + 240 - text.length) ? '...' : '');
var rv = $('<p class="context"></p>').text(excerpt);
$.each(hlwords, function() {
rv = rv.highlightText(this, 'highlighted');
});
return rv;
}
};
$(document).ready(function() {
Search.init();
});

2042
_static/underscore-1.13.1.js Normal file

File diff suppressed because it is too large Load diff

6
_static/underscore.js Normal file

File diff suppressed because one or more lines are too long

205
configuration.html Normal file
View file

@ -0,0 +1,205 @@
<!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>Configuration &#8212; snap-pac documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.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="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" 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="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<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</span></code>.</p>
<p>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>
<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 the 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>
</section>
</section>
<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>
</section>
</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 4.2.0</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>

196
examples.html Normal file
View file

@ -0,0 +1,196 @@
<!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>Example &#8212; snap-pac documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.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="Troubleshooting" href="troubleshooting.html" />
<link rel="prev" title="Configuration" href="configuration.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"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html#environment-variables">Environment Variables</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">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="configuration.html" title="previous chapter">Configuration</a></li>
<li>Next: <a href="troubleshooting.html" title="next chapter">Troubleshooting</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" 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="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="example">
<h1>Example<a class="headerlink" href="#example" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
</div>
<p>Here is an example of how the snapshots are created and how to rollback and pacman
transaction. Here the nano package is installed:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pacman -S nano
</pre></div>
</div>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>resolving dependencies...
looking for conflicting packages...
Packages (1) nano-2.5.3-1
Total Installed Size: 2.14 MiB
:: Proceed with installation? [Y/n] Y
(1/1) checking keys in keyring [######################################] 100%
(1/1) checking package integrity [######################################] 100%
(1/1) loading package files [######################################] 100%
(1/1) checking for file conflicts [######################################] 100%
(1/1) checking available disk space [######################################] 100%
:: Running pre-transaction hooks...
(1/1) Performing snapper pre snapshots for the following configurations...
=&gt; root: 1033
:: Processing package changes...
(1/1) installing nano [######################################] 100%
:: Running post-transaction hooks...
(1/1) Performing snapper post snapshots for the following configurations...
=&gt; root: 1034
</pre></div>
</div>
<p>The snapper snapshot number is given for each snapper configuration that is used. This
is also logged in pacmans log.</p>
<p>Here are the snapshots created before and after the pacman transaction:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>snapper -c root list -t pre-post <span class="p">|</span> tail -n <span class="m">1</span>
</pre></div>
</div>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>1033 | 1034 | Fri 22 Apr 2016 01:54:13 PM CDT | Fri 22 Apr 2016 01:54:14 PM CDT | pacman -S nano |
</pre></div>
</div>
<p>Here is what changed during the transaction:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>snapper -c root status <span class="m">1033</span>..1034
</pre></div>
</div>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>+..... /etc/nanorc
c..... /etc/snapper/.snap-pac-pre
+..... /usr/bin/nano
+..... /usr/bin/rnano
+..... /usr/share/doc/nano
+..... /usr/share/doc/nano/faq.html
+..... /usr/share/doc/nano/fr
+..... /usr/share/doc/nano/fr/nano.1.html
+..... /usr/share/doc/nano/fr/nanorc.5.html
+..... /usr/share/doc/nano/fr/rnano.1.html
</pre></div>
</div>
<p>The above output is truncated, but it continues. See <em class="manpage"><a class="manpage reference external" href="https://man.archlinux.org/man/snapper.8">snapper(8)</a></em> to for what each
symbol means. You can also do <code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">diff</span></code> in the same way.</p>
<p>Then, to undo the pacman transaction:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>snapper -c root undochange <span class="m">1033</span>..1034
</pre></div>
</div>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>create:0 modify:3 delete:100
</pre></div>
</div>
<p>Now nano is no longer installed, along with all the files it changed:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pacman -Qi nano
</pre></div>
</div>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>error: package &#39;nano&#39; was not found
</pre></div>
</div>
</section>
</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 4.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/examples.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>

View file

@ -1,24 +0,0 @@
# snap-pac example configuration file
# Each section corresponds with a snapper configuration. Add additional sections to add
# other configurations to be snapshotted. By default, only the root configuration is snapshotted.
[root]
# How many characters to limit the description for snapper.
desc_limit = 72
# Whether or not to take snapshots of this snapper configuration
snapshot = True
# What snapper cleanup algorithm to use
cleanup_algorithm = number
# Pre snapshot description. Default is the pacman command that triggered the hook
#pre_description = pacman pre snapshot
# Post snapshot description. Default is the list of packages involved in the pacman transaction
#post_description = pacman post snapshot
# Example for another snapper configuration named "home"
# [home]
# snapshot = True

159
faq.html Normal file
View file

@ -0,0 +1,159 @@
<!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>FAQ &#8212; snap-pac documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.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="prev" title="Troubleshooting" href="troubleshooting.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"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html#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 current"><a class="current reference internal" href="#">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="troubleshooting.html" title="previous chapter">Troubleshooting</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" 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="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="faq">
<h1>FAQ<a class="headerlink" href="#faq" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
</div>
<p><strong>Does snap-pac backup non-btrfs /boot partitions?</strong></p>
<p>No, but you can add a hook that does it for you. It would be something like the following:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = linux
[Action]
Description = Backing up /boot...
When = PreTransaction
Exec = /usr/bin/rsync -avzq --delete /boot /.bootbackup
</pre></div>
</div>
<p>Note that you will probably want to name the file with a numbered prefix less than
<code class="docutils literal notranslate"><span class="pre">05</span></code> so that it is run before the snap-pac pre snapshot takes place. That will ensure
that the snapshot taken will have the boot partition back-up corresponding with the
state of the system. For example, you could name it <code class="docutils literal notranslate"><span class="pre">04-backupboot.hook</span></code>.</p>
<p><strong>How do I link old kernel modules automatically when the kernel is upgraded?</strong></p>
<p>This behavior is no longer a part of this package. Use a pacman hook like the following:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = linux
[Action]
Description = Symlinking old kernel modules...
When = PostTransaction
Exec = /usr/bin/bash -c &quot;find /usr/lib/modules -xtype l -delete; ln -sv /.snapshots/$(snapper -c root list | awk &#39;END{print $1}&#39;)/snapshot/usr/lib/modules/$(uname -r) /usr/lib/modules/&quot;
</pre></div>
</div>
</section>
</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 4.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/faq.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>

120
genindex.html Normal file
View file

@ -0,0 +1,120 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index &#8212; snap-pac documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.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="#" />
<link rel="search" title="Search" href="search.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>
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html#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>
</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" 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="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<h1 id="index">Index</h1>
<div class="genindex-jumpbox">
</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 4.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</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>

View file

@ -1,32 +0,0 @@
# snap-pac
# https://github.com/wesbarnett/snap-pac
# Copyright (C) 2016, 2017, 2018 James W. Barnett
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = *
[Action]
Description = Performing snapper pre snapshots for the following configurations...
Depends = snap-pac
When = PreTransaction
Exec = /usr/share/libalpm/scripts/snap-pac pre
NeedsTargets
AbortOnFail

View file

@ -1,28 +0,0 @@
# snap-pac
# https://github.com/wesbarnett/snap-pac
# Copyright (C) 2016, 2017, 2018 James W. Barnett
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
[Trigger]
Operation = Remove
Type = Package
Target = snap-pac
[Action]
Description = You are removing snap-pac. No post transaction snapshots will be taken.
Depends = snap-pac
When = PreTransaction
Exec = /usr/bin/bash -c "rm -f /tmp/snap-pac-pre_*"

View file

@ -1,31 +0,0 @@
# snap-pac
# https://github.com/wesbarnett/snap-pac
# Copyright (C) 2016, 2017, 2018 James W. Barnett
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = *
[Action]
Description = Performing snapper post snapshots for the following configurations...
Depends = snap-pac
When = PostTransaction
Exec = /usr/share/libalpm/scripts/snap-pac post
NeedsTargets

View file

@ -1,28 +0,0 @@
# snap-pac
# https://github.com/wesbarnett/snap-pac
# Copyright (C) 2016, 2017, 2018 James W. Barnett
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
[Trigger]
Operation = Install
Type = Package
Target = snap-pac
[Action]
Description = You are installing snap-pac, so no post transaction snapshots will be taken.
Depends = snap-pac
When = PostTransaction
Exec = /usr/bin/true

190
index.html Normal file
View file

@ -0,0 +1,190 @@
<!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>snap-pac &#8212; snap-pac documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.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="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="#">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>
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html#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="#">Documentation overview</a><ul>
<li>Next: <a href="installation.html" title="next chapter">Installation</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" 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="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="snap-pac">
<h1>snap-pac<a class="headerlink" href="#snap-pac" title="Permalink to this headline"></a></h1>
<p>This is a set of <a class="reference external" href="https://archlinux.org/pacman/">pacman</a> hooks and script that causes
<a class="reference external" href="http://snapper.io/">snapper</a> to automatically take a pre and post snapshot before and
after pacman transactions, similar to how <a class="reference external" href="https://yast.opensuse.org/">YaST</a> does with
OpenSuse. This provides a simple way to undo changes to a system after a pacman
transaction.</p>
<p>Because these are pacman hooks, it doesnt matter how you call pacman—whether
directly, through an AUR helper, or using an alias—snapper will create the snapshots
when pacman installs, upgrades, or removes a package. The pacman command used is
logged in the snapper description for the snapshots. Additionally the snapshot numbers
are output to the screen and to the pacman log for each snapper configuration during the
pacman transaction, so that the user can easily find which changes he or she may want to
revert.</p>
<div class="literal-block-wrapper docutils container" id="id1">
<div class="code-block-caption"><span class="caption-text">When you run pacman, the snapper pre/post snapshots are created automatically. For a fuller example see <a class="reference internal" href="examples.html"><span class="doc">Example</span></a>.</span><a class="headerlink" href="#id1" title="Permalink to this code"></a></div>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ sudo pacman -S vim
resolving dependencies...
looking for conflicting packages...
Packages (1) vim-8.2.2489-1
Total Installed Size: 3.79 MiB
Net Upgrade Size: 0.00 MiB
:: Proceed with installation? [Y/n]
(1/1) checking keys in keyring [############] 100%
(1/1) checking package integrity [############] 100%
(1/1) loading package files [############] 100%
(1/1) checking for file conflicts [############] 100%
(1/1) checking available disk space [############] 100%
:: Running pre-transaction hooks...
<span class="hll">(1/1) Performing snapper pre snapshots for the following configurations...
</span><span class="hll">==&gt; root: 7394
</span>:: Processing package changes...
(1/1) installing vim [############] 100%
:: Running post-transaction hooks...
(1/4) Arming ConditionNeedsUpdate...
(2/4) Updating icon theme caches...
(3/4) Updating the desktop file MIME type cache...
<span class="hll">(4/4) Performing snapper post snapshots for the following configurations...
</span><span class="hll">==&gt; root: 7395
</span></pre></div>
</div>
</div>
<p>To undo changes from a pacman transaction, use <code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">undochange</span></code>. See the <em class="manpage"><a class="manpage reference external" href="https://man.archlinux.org/man/snapper.8">snapper(8)</a></em>
for more details as well as examples.</p>
<p>If you have severe breakage—like snapper is gone for some reason and you cant get it
back—youll have to resort to more extreme methods, such as taking a snapshot of the pre
snapshot and making it the default subvolume or mounting it as /. Most likely youll
need to use a live USB to get into a chroot environment to do any of these things.
Snapper has a <code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">rollback</span></code> feature, but your setup has to be properly configured to
use it. The exact procedure depends on your specific setup. Be careful.</p>
<p>Note that the pre transaction hooks occur before the pacman transaction but after the
pacman database is synced, if applicable. In other words, if you run <cite>pacman -Syu</cite> and
roll back the upgrade according to the above instructions, you will not have rolled back
the pacman database to the previous state. Thus, if, after upgrading and rolling back
the upgrade, you then install a package, it will possibly be a partial upgrade, which is
unsupported.</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html#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>
</section>
</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 4.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/index.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>

169
installation.html Normal file
View file

@ -0,0 +1,169 @@
<!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>Installation &#8212; snap-pac documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.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="Configuration" href="configuration.html" />
<link rel="prev" title="snap-pac" href="index.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 current"><a class="current reference internal" href="#">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html#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="index.html" title="previous chapter">snap-pac</a></li>
<li>Next: <a href="configuration.html" title="next chapter">Configuration</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" 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="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="installation">
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this headline"></a></h1>
<p>Install the <code class="docutils literal notranslate"><span class="pre">snap-pac</span></code> package using pacman:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pacman -S snap-pac
</pre></div>
</div>
<p>Alternatively download the <a class="reference external" href="https://github.com/wesbarnett/snap-pac/releases">latest release and signature</a>. Then, verify the download:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>gpg --verify snap-pac-&lt;version&gt;.tar.gz.sig
</pre></div>
</div>
<p>where <code class="docutils literal notranslate"><span class="pre">&lt;version&gt;</span></code> is the version number you downloaded.</p>
<p>Finally, run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>make install
</pre></div>
</div>
<p>I have signed the release tarball and commits with my PGP key. Starting with release
2.2, the tarballs are signed with my key with fingerprint
<code class="docutils literal notranslate"><span class="pre">F7B28C61944FE30DABEEB0B01070BCC98C18BD66</span></code>.</p>
<p>For previous releases, the keys fingerprint was
<code class="docutils literal notranslate"><span class="pre">8535CEF3F3C38EE69555BF67E4B5E45AA3B8C5C3</span></code>.</p>
<section id="dependencies">
<h2>Dependencies<a class="headerlink" href="#dependencies" title="Permalink to this headline"></a></h2>
<p><code class="docutils literal notranslate"><span class="pre">python</span></code>, <code class="docutils literal notranslate"><span class="pre">pacman</span></code>, and <code class="docutils literal notranslate"><span class="pre">snapper</span></code> are all required.</p>
</section>
<section id="testing">
<h2>Testing<a class="headerlink" href="#testing" title="Permalink to this headline"></a></h2>
<p>For testing, <code class="docutils literal notranslate"><span class="pre">pytest</span></code> is required. To run the tests do:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>make <span class="nb">test</span>
</pre></div>
</div>
</section>
<section id="documentation">
<h2>Documentation<a class="headerlink" href="#documentation" title="Permalink to this headline"></a></h2>
<p>Typically, you will not need to build the documentation on your own and can simply
access it by visiting the <a class="reference external" href="https://wesbarnett.github.io/snap-pac/">online documentation</a> or by accessing the manpage:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>man <span class="m">8</span> snap-pac
</pre></div>
</div>
<p>To build the documentation, <code class="docutils literal notranslate"><span class="pre">sphinx</span></code> is required. To build the documentation you can
do:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>make docs
</pre></div>
</div>
<p>The resulting html documentation will then be located at <code class="docutils literal notranslate"><span class="pre">docs/build/index.html</span></code>.
Additionally, this generates the manpage which will be located under <code class="docutils literal notranslate"><span class="pre">man8</span></code>.</p>
</section>
</section>
</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 4.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/installation.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>

View file

@ -1,202 +0,0 @@
'\" t
.TH SNAP-PAC 8 2021-01-29 SNAP-PAC
.SH NAME
snap-pac \- Pacman hooks that use snapper to create pre/post btrfs snapshots
like openSUSE's YaST
.SH DESCRIPTION
This is a set of \fIpacman\fR hooks and script that causes \fIsnapper\fR to
automatically take a pre and post snapshot before and after pacman transactions,
similar to how YaST does with OpenSuse. This provides a simple way to undo
changes to a system after a pacman transaction.
Because these are pacman hooks, it doesn't matter how you call pacman—whether
directly, through an AUR helper, or using an alias—snapper will create the
snapshots when pacman installs, upgrades, or removes a package. The pacman
command used is logged in the snapper description for the snapshots.
Additionally the snapshot numbers are output to the screen and to the pacman log
for each snapper configuration during the pacman transaction, so that the user can
easily find which changes he or she may want to revert.
To undo changes from a pacman transaction, use \fIsnapper undochange\fR. See
\fBsnapper\fR(8) and \fBEXAMPLES\fR.
If you have severe breakage—like snapper is gone for some reason and you can't
get it back—you'll have to resort to more extreme methods, such as taking a
snapshot of the pre snapshot and making it the default subvolume or mounting it
as \fI/\fR. Most likely you'll need to use a live USB to get into a chroot
environment to do any of these things. Snapper has a snapper rollback feature,
but your setup has to be properly configured to use it. The exact procedure
depends on your specific setup. Be careful.
.SH CONFIGURATION
Configuration is done via Python ini configuration files. The defaults of the
should be suitable for most users, so you may not need to do any configuration at all.
By default only the "root" snapper configuration is snapshotted.
A commented example configuration files is located at \fI/etc/snap-pac.ini.example\fR.
.SH ENVIRONMENT VARIABLES
To temporarily prevent snapshots from being performed for a single
pacman command, set the environment variable \fISNAP_PAC_SKIP\fR. For
example:
.EX
$ sudo SNAP_PAC_SKIP=y pacman -Syu
.EE
.SH EXAMPLES
Here is an example of how the snapshots are created and how to rollback and pacman
transaction. Here the \fBnano\fR package is installed:
.EX
# pacman -S nano
resolving dependencies...
looking for conflicting packages...
Packages (1) nano-2.5.3-1
Total Installed Size: 2.14 MiB
:: Proceed with installation? [Y/n] Y
(1/1) checking keys in keyring [######################################] 100%
(1/1) checking package integrity [######################################] 100%
(1/1) loading package files [######################################] 100%
(1/1) checking for file conflicts [######################################] 100%
(1/1) checking available disk space [######################################] 100%
:: Running pre-transaction hooks...
(1/1) Performing snapper pre snapshots for the following configurations...
=> root: 1033
:: Processing package changes...
(1/1) installing nano [######################################] 100%
:: Running post-transaction hooks...
(1/1) Performing snapper post snapshots for the following configurations...
=> root: 1034
.EE
The snapper snapshot number is given for each snapper configuration that is
used. This is also logged in pacman's log.
Here are the snapshots created before and after the pacman transaction:
.EX
# snapper -c root list -t pre-post | tail -n 1
1033 | 1034 | Fri 22 Apr 2016 01:54:13 PM CDT | Fri 22 Apr 2016 01:54:14 PM CDT | pacman -S nano |
.EE
Here is what changed during the transaction:
.EX
# snapper -c root status 1033..1034
+..... /etc/nanorc
c..... /etc/snapper/.snap-pac-pre
+..... /usr/bin/nano
+..... /usr/bin/rnano
+..... /usr/share/doc/nano
+..... /usr/share/doc/nano/faq.html
+..... /usr/share/doc/nano/fr
+..... /usr/share/doc/nano/fr/nano.1.html
+..... /usr/share/doc/nano/fr/nanorc.5.html
+..... /usr/share/doc/nano/fr/rnano.1.html
.EE
The above output is truncated, but it continues. See the \fBsnapper\fR(8) to
for what each symbol means. You can also do \fBsnapper diff\fR in the same way.
Then, to undo the \fBpacman\fR transaction:
.EX
# snapper -c root undochange 1033..1034
create:0 modify:3 delete:100
.EE
Now nano is no longer installed, along with all the files it changed:
.EX
$ pacman -Qi nano
error: package 'nano' was not found
.EE
.SH TROUBLESHOOTING
.SS snap-pac is only taking snapshots of the root configuration.
That's the default behavior. See \fBCONFIGURATION\fR.
.SS No snapshots are being taken when I run pacman.
No snapper configurations are set up for snap-pac's pacman hooks. By default
snap-pac will take snapshots for the root configuration and any other
configuration which has SNAPSHOT set to yes in its configuration file.
See \fBCONFIGURATION\fR.
.SS After restoring snapshot from snap-pac, the pacman database is locked.
The pre/post snaphots are taken while pacman is running, so this is expected.
Follow the instructions pacman gives you (e.g., removing the lock file). You can add the
database lock file to a snapper filter so that snapper won't consider it when performing
\fBsnapper diff\fR, \fBsnapper status\fR, \fBsnapper undochange\fR, etc. See the
\fBFilters\fR section in \fBsnapper\fR(8) for more information.
.SH FAQ
.SS Does snap-pac backup non-btrfs /boot partitions?
No, but you can add a hook that does it for you. It would be
something like the following:
.EX
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = linux
[Action]
Description = Backing up /boot...
When = PreTransaction
Exec = /usr/bin/rsync -avzq --delete /boot /.bootbackup
.EE
.SS How do I link old kernel modules automatically when the kernel is upgraded?
This behavior is no longer a part of this package. Use a pacman hook like the following:
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = linux
[Action]
Description = Symlinking old kernel modules...
When = PostTransaction
Exec = /usr/bin/bash -c "find /usr/lib/modules -xtype l -delete; ln -sv /.snapshots/$(snapper -c root list | awk 'END{print $1}')/snapshot/usr/lib/modules/$(uname -r) /usr/lib/modules/"
.SH HOMEPAGE
https://github.com/wesbarnett/snap-pac
.SH AUTHORS
Wes Barnett <wes@wbarnett.us>
.SH SEE ALSO
.BR alpm-hooks (5),
.BR snapper (8),
.BR snapper-configs (5),
.BR pacman (8)

BIN
objects.inv Normal file

Binary file not shown.

View file

@ -1,145 +0,0 @@
#!/usr/bin/env python
# Copyright (C) 2021 Wes Barnett
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""Script for taking pre/post snapshots; run from pacman hooks."""
from argparse import ArgumentParser
from configparser import ConfigParser
import logging
from pathlib import Path
import os
import sys
import tempfile
logging.basicConfig(format="%(message)s", level=logging.INFO)
class SnapperCmd:
def __init__(self, config, snapshot_type, cleanup_algorithm, description="", nodbus=False, pre_number=None):
self.cmd = ["snapper"]
if nodbus:
self.cmd.append("--no-dbus")
self.cmd.append(f"--config {config} create")
self.cmd.append(f"--type {snapshot_type}")
self.cmd.append(f"--cleanup-algorithm {cleanup_algorithm}")
self.cmd.append("--print-number")
if description:
self.cmd.append(f"--description \"{description}\"")
if snapshot_type == "post":
if pre_number is not None:
self.cmd.append(f"--pre-number {pre_number}")
else:
raise ValueError("snapshot type specified as 'post' but no pre snapshot number passed.")
def __call__(self):
return os.popen(self.__str__()).read().rstrip("\n")
def __str__(self):
return " ".join(self.cmd)
def get_snapper_configs(conf_file):
"""Get the snapper configurations."""
for line in conf_file.read_text().split("\n"):
if line.startswith("SNAPPER_CONFIGS"):
line = line.rstrip("\n").rstrip("\"").split("=")
return line[1].lstrip("\"").split()
def setup_config_parser(ini_file, parent_cmd, packages):
"""Set up defaults for snap-pac configuration."""
config = ConfigParser()
config["DEFAULT"] = {
"snapshot": False,
"cleanup_algorithm": "number",
"pre_description": parent_cmd,
"post_description": packages,
"desc_limit": 72
}
config["root"] = {
"snapshot": True
}
config.read(ini_file)
return config
def get_description(snapshot_type, config, section):
desc_limit = config.getint(section, "desc_limit")
if snapshot_type == "pre":
return config.get(section, "pre_description")[:desc_limit]
else:
return config.get(section, "post_description")[:desc_limit]
def get_pre_number(snapshot_type, prefile):
if snapshot_type == "pre":
pre_number = None
else:
try:
pre_number = prefile.read_text()
except FileNotFoundError:
raise FileNotFoundError(f"prefile {prefile} not found. Ensure you have run the pre snapshot first.")
else:
prefile.unlink()
return pre_number
def main(snap_pac_ini, snapper_conf_file, args):
if os.getenv("SNAP_PAC_SKIP", "n").lower() in ["y", "yes", "true", "1"]:
return False
parent_cmd = os.popen(f"ps -p {os.getppid()} -o args=").read().strip()
packages = " ".join([line.rstrip("\n") for line in sys.stdin])
config = setup_config_parser(snap_pac_ini, parent_cmd, packages)
snapper_configs = get_snapper_configs(snapper_conf_file)
chroot = os.stat("/") != os.stat("/proc/1/root/.")
for snapper_config in snapper_configs:
if snapper_config not in config:
config.add_section(snapper_config)
if config.getboolean(snapper_config, "snapshot"):
prefile = tempfile.gettempdir() / Path(f"snap-pac-pre_{snapper_config}")
cleanup_algorithm = config.get(snapper_config, "cleanup_algorithm")
description = get_description(args.type, config, snapper_config)
pre_number = get_pre_number(args.type, prefile)
snapper_cmd = SnapperCmd(snapper_config, args.type, cleanup_algorithm, description, chroot, pre_number)
num = snapper_cmd()
logging.info(f"==> {snapper_config}: {num}")
if args.type == "pre":
prefile.write_text(num)
return True
if __name__ == "__main__":
snap_pac_ini = Path("/etc/snap-pac.ini")
snapper_conf_file = Path("/etc/conf.d/snapper")
parser = ArgumentParser(description="Script for taking pre/post snapper snapshots. Used with pacman hooks.")
parser.add_argument(dest="type", choices=["pre", "post"])
args = parser.parse_args()
main(snap_pac_ini, snapper_conf_file, args)

139
search.html Normal file
View file

@ -0,0 +1,139 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Search &#8212; snap-pac documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.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>
<script src="_static/searchtools.js"></script>
<script src="_static/language_data.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="#" />
<script src="searchindex.js" defer></script>
<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>
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html#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>
</ul></li>
</ul>
</div>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<h1 id="search-documentation">Search</h1>
<noscript>
<div class="admonition warning">
<p>
Please activate JavaScript to enable the search
functionality.
</p>
</div>
</noscript>
<p>
Searching for multiple words only shows matches that contain
all words.
</p>
<form action="" method="get">
<input type="text" name="q" aria-labelledby="search-documentation" value="" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="search" />
<span id="search-progress" style="padding-left: 10px"></span>
</form>
<div id="search-results">
</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 4.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</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>

1
searchindex.js Normal file
View file

@ -0,0 +1 @@
Search.setIndex({docnames:["configuration","examples","faq","index","installation","troubleshooting"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":4,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,sphinx:56},filenames:["configuration.rst","examples.rst","faq.rst","index.rst","installation.rst","troubleshooting.rst"],objects:{},objnames:{},objtypes:{},terms:{"0":[1,3],"00":3,"01":1,"04":2,"05":2,"1":[1,2,3],"100":[1,3],"1033":1,"1034":1,"13":1,"14":1,"2":[1,3,4],"2016":1,"22":1,"2489":3,"3":[1,3],"4":3,"42":0,"5":1,"54":1,"72":0,"7394":3,"7395":3,"79":3,"8":[1,3,4,5],"8535cef3f3c38ee69555bf67e4b5e45aa3b8c5c3":4,"boolean":0,"case":0,"default":[0,3,5],"do":[0,1,2,3,4],"final":4,"import":0,"true":0,"while":5,A:0,Be:3,By:[0,5],For:[0,2,3,4],If:3,In:[0,3],It:2,No:[2,5],That:[2,5],The:[0,1,3,4,5],Then:[1,4],To:[0,3,4],abov:[1,3],access:4,accord:3,action:2,ad:0,add:[0,2,5],addit:0,addition:[0,3,4],after:[1,3,5],alia:3,all:[0,1,4],along:1,also:[0,1],altern:4,an:[1,3],ani:[0,3,5],appli:0,applic:3,apr:1,ar:[0,1,3,4,5],arm:3,arthur:0,aur:3,automat:[2,3],avail:[1,3],avzq:2,awk:2,back:[2,3],backup:2,backupboot:2,bash:2,becaus:3,befor:[0,1,2,3],behavior:[2,5],being:[0,5],bin:[1,2],boot:2,bootbackup:2,breakag:3,btrf:2,build:4,c:[1,2],cach:3,call:[0,3],can:[0,1,2,3,4,5],care:3,caus:3,cdt:1,chang:[1,3],check:[1,3],chroot:3,command:[0,3],comment:0,commit:4,conditionneedsupd:3,configur:[1,3,5],conflict:[1,3],consid:5,continu:1,correspond:[0,2],could:2,creat:[1,3],databas:[3,5],delet:[1,2],depend:[1,3],desc_limit:0,descript:[0,2,3],desktop:3,detail:3,diff:[1,5],differ:0,directli:3,disk:[1,3],doc:[1,4],doe:[2,3],doesn:3,don:0,done:0,download:4,dure:[1,3],e:5,each:[0,1,3],easili:3,edit:0,editor:0,end:2,ensur:2,entri:0,environ:3,error:1,etc:[0,1,5],everi:0,exact:3,exampl:[2,3],exec:2,expect:5,explanatori:0,extrem:3,f7b28c61944fe30dabeeb0b01070bcc98c18bd66:4,fals:0,faq:[1,3],favorit:0,featur:3,file:[0,1,2,3,5],filter:5,find:[2,3],fingerprint:4,follow:[0,1,2,3,5],found:1,fr:1,fri:1,from:[0,3,5],full:0,fuller:[0,3],g:5,gener:4,get:3,give:5,given:1,gone:3,gpg:4,gz:4,ha:[3,5],handl:0,have:[0,2,3,4],he:3,helper:3,here:[0,1],home:0,hook:[0,1,2,3,5],how:[1,2,3],html:[1,4],i:[2,4,5],icon:3,important_command:0,important_packag:0,index:4,inform:5,ini:0,instal:[0,1,2,3],instruct:[3,5],integ:0,integr:[1,3],involv:0,its:5,kei:[0,1,3,4],kernel:2,keyr:[1,3],l:2,later:0,latest:4,length:0,less:2,lib:2,like:[2,3],link:2,linux:[0,2],list:[0,1,2],live:3,ll:3,ln:2,load:[1,3],locat:[0,4],lock:5,log:[1,3],longer:[1,2],look:[1,3],lt:0,mai:[0,3],make:[3,4],man8:4,man:4,manpag:4,mark:0,matter:3,maximum:0,mean:1,method:3,mib:[1,3],mime:3,modifi:1,modul:2,more:[3,5],most:[0,3],mount:3,my:4,n:[1,3],name:[0,2],nano:1,nanorc:1,need:[0,3,4],net:3,non:2,note:[0,2,3],now:1,number:[1,2,3,4],occur:3,off:0,old:2,one:0,onli:[0,5],onlin:4,opensus:3,oper:2,option:0,other:[0,3,5],otherwis:0,output:[1,3],overridden:0,own:4,pac:[0,1,2,4,5],packag:[0,1,2,3,4],pacman:[0,1,2,3,4,5],pair:0,parent:0,part:[0,2],partial:3,partit:2,perform:[0,1,3,5],pgp:4,place:2,pm:1,possibl:3,post:[0,1,3,5],post_descript:0,posttransact:2,pre:[0,1,2,3,5],pre_descript:0,prefix:2,pretransact:2,prevent:0,previou:[3,4],print:2,probabl:2,proce:[1,3],procedur:3,process:[1,3],properli:3,provid:3,pytest:4,python:[0,4],qi:1,r:2,reason:3,releas:4,remov:[0,2,3,5],requestid:0,requir:4,resolv:[1,3],resort:3,restor:5,result:4,revert:3,rnano:1,roll:3,rollback:[1,3],root:[0,1,2,3,5],rsync:2,run:[1,2,3,4,5],s:[0,1,3,4,5],same:1,screen:3,script:3,section:[0,5],see:[1,3,5],self:0,separ:0,set:[0,3,5],setup:3,sever:[0,3],share:1,she:3,should:0,sig:4,sign:4,signatur:4,similar:3,simpl:3,simpli:4,sinc:0,singl:0,size:[1,3],snap:[0,1,2,4,5],snap_pac_skip:0,snaphot:5,snapper:[0,1,2,3,4,5],snapshot:[0,1,2,3,5],so:[0,2,3,5],some:3,someth:2,space:[0,1,3],specif:3,sphinx:4,start:4,state:[2,3],statu:[1,5],string:0,subvolum:3,sudo:[0,3],suitabl:0,sv:2,symbol:1,symlink:2,sync:3,system:[0,2,3],syu:[0,3],t:[0,1,3,5],tail:1,take:[2,3,5],taken:[2,5],tar:4,tarbal:4,target:2,temporarili:0,than:2,theme:3,thi:[0,1,2,3,4,5],thing:3,through:3,thu:3,total:[1,3],transact:[0,1,3],trigger:2,troubleshoot:3,truncat:[0,1],turn:0,type:[2,3],typic:4,unam:2,under:4,undo:[1,3],undochang:[1,3,5],unless:0,unsupport:3,up:[2,5],updat:3,upgrad:[0,2,3],us:[1,2,3,4],usb:3,user:[0,3],userdata:0,usr:[1,2],valu:0,variabl:3,verifi:4,version:4,via:0,vim:3,visit:4,wa:[1,4],wai:[1,3],want:[2,3],well:3,were:0,what:1,when:[0,2,3,5],where:4,whether:[0,3],which:[3,4,5],won:5,word:3,would:2,xtype:2,y:[0,1,3],yast:3,ye:[0,5],you:[0,1,2,3,4,5],your:[0,3,4]},titles:["Configuration","Example","FAQ","snap-pac","Installation","Troubleshooting"],titleterms:{configur:0,depend:4,document:4,environ:0,exampl:[0,1],faq:2,instal:4,pac:3,snap:3,test:4,troubleshoot:5,variabl:0}})

View file

@ -1,106 +0,0 @@
from configparser import ConfigParser
import tempfile
from pathlib import Path
import os
import pytest
from scripts.snap_pac import (
SnapperCmd, get_pre_number, get_snapper_configs, main, setup_config_parser,
get_description
)
@pytest.fixture
def config():
config = ConfigParser()
config["DEFAULT"] = {
"snapshot": False,
"cleanup_algorithm": "number",
"pre_description": "foo",
"post_description": "bar",
"desc_limit": 72
}
config["root"] = {
"snapshot": True
}
config["home"] = {
"snapshot": True,
"desc_limit": 3,
"post_description": "a really long description"
}
return config
@pytest.fixture
def prefile():
with tempfile.NamedTemporaryFile("w", delete=False) as f:
f.write("1234")
name = f.name
return Path(name)
@pytest.mark.parametrize("snapper_cmd, actual_cmd", [
(
SnapperCmd("root", "pre", "number", "foo"),
"snapper --config root create --type pre --cleanup-algorithm number --print-number --description \"foo\""
),
(
SnapperCmd("root", "post", "number", "bar", False, 1234),
"snapper --config root create --type post --cleanup-algorithm number --print-number"
" --description \"bar\" --pre-number 1234"
),
(
SnapperCmd("root", "post", "number", "bar", True, 1234),
"snapper --no-dbus --config root create --type post --cleanup-algorithm number --print-number"
" --description \"bar\" --pre-number 1234"
)
])
def test_snapper_cmd(snapper_cmd, actual_cmd):
assert str(snapper_cmd) == actual_cmd
def test_get_snapper_configs():
with tempfile.NamedTemporaryFile("w", delete=False) as f:
f.write("## Path: System/Snapper\n")
f.write("\n")
f.write("## Type: string\n")
f.write("## Default: \"\"\n")
f.write("# List of snapper configurations.\n")
f.write("SNAPPER_CONFIGS=\"home root foo bar\"\n")
name = f.name
assert get_snapper_configs(Path(name)) == ["home", "root", "foo", "bar"]
def test_skip_snap_pac():
os.environ["SNAP_PAC_SKIP"] = "y"
assert main("foo", "bar", "yep") is False
def test_setup_config_parser(config):
with tempfile.NamedTemporaryFile("w", delete=False) as f:
f.write("[home]\n")
f.write("snapshot = True\n")
f.write("desc_limit = 3\n")
f.write("post_description = a really long description\n")
name = f.name
config2 = setup_config_parser(name, "foo", "bar")
assert config == config2
def test_get_pre_number_pre(prefile):
assert get_pre_number("pre", prefile) is None
def test_get_pre_number_post(prefile):
assert get_pre_number("post", prefile) == "1234"
def test_no_prefile():
with pytest.raises(FileNotFoundError):
get_pre_number("post", Path("/tmp/foo-pre-file-not-found"))
@pytest.mark.parametrize("snapshot_type, description", [("pre", "foo"), ("post", "a r")])
def test_get_description(snapshot_type, description, config):
assert get_description(snapshot_type, config, "home") == description

139
troubleshooting.html Normal file
View file

@ -0,0 +1,139 @@
<!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>Troubleshooting &#8212; snap-pac documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.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="FAQ" href="faq.html" />
<link rel="prev" title="Example" href="examples.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"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html#environment-variables">Environment Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Example</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">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="examples.html" title="previous chapter">Example</a></li>
<li>Next: <a href="faq.html" title="next chapter">FAQ</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" 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="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="troubleshooting">
<h1>Troubleshooting<a class="headerlink" href="#troubleshooting" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
</div>
<p><strong>snap-pac is only taking snapshots of the root configuration.</strong></p>
<p>Thats the default behavior. See <a class="reference internal" href="configuration.html"><span class="doc">Configuration</span></a>.</p>
<p><strong>No snapshots are being taken when I run pacman.</strong></p>
<p>No snapper configurations are set up for snap-pacs pacman hooks. By default snap-pac
will take snapshots for the root configuration and any other configuration which has
SNAPSHOT set to yes in its configuration file. See <a class="reference internal" href="configuration.html"><span class="doc">Configuration</span></a>.</p>
<p><strong>After restoring snapshot from snap-pac, the pacman database is locked.</strong></p>
<p>The pre/post snaphots are taken while pacman is running, so this is expected. Follow
the instructions pacman gives you (<em>e.g.</em>, removing the lock file). You can add the
database lock file to a snapper filter so that snapper wont consider it when
performing snapper diff, snapper status, snapper undochange, etc. See the Filters
section in <em class="manpage"><a class="manpage reference external" href="https://man.archlinux.org/man/snapper.8">snapper(8)</a></em> for more information.</p>
</section>
</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 4.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/troubleshooting.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>