Initialize for snapper

This commit is contained in:
zyppe 2024-02-05 14:58:17 +08:00
commit 96507abdcf
7 changed files with 954 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
snapper-0.8.16.tar.bz2

1
.snapper.metadata Normal file
View file

@ -0,0 +1 @@
ab526d0a3d12185ddcb1599012a3efc6120c7cf138bca6bd5cea1643c5ccf7aa snapper-0.8.16.tar.bz2

41
pr790.patch Normal file
View file

@ -0,0 +1,41 @@
diff --git a/snapper/BtrfsUtils.cc b/snapper/BtrfsUtils.cc
index 53bcb92a..47193ed1 100644
--- a/snapper/BtrfsUtils.cc
+++ b/snapper/BtrfsUtils.cc
@@ -284,21 +284,25 @@
struct btrfs_ioctl_quota_rescan_args args;
memset(&args, 0, sizeof(args));
- if (ioctl(fd, BTRFS_IOC_QUOTA_RESCAN, &args) < 0)
- throw runtime_error_with_errno("ioctl(BTRFS_IOC_QUOTA_RESCAN) failed", errno);
-
- while (true)
+ for (int i = 0;; ++i)
{
- sleep(1);
-
- memset(&args, 0, sizeof(args));
+ if (ioctl(fd, BTRFS_IOC_QUOTA_RESCAN, &args) == 0)
+ break;
- if (ioctl(fd, BTRFS_IOC_QUOTA_RESCAN_STATUS, &args) < 0)
- throw runtime_error_with_errno("ioctl(BTRFS_IOC_QUOTA_RESCAN_STATUS) failed", errno);
+ if (errno == EINPROGRESS)
+ {
+ if (i == 0)
+ y2war("waiting for old quota rescan to finish");
+
+ sleep(1);
+ continue;
+ }
- if (!args.flags)
- break;
+ throw runtime_error_with_errno("ioctl(BTRFS_IOC_QUOTA_RESCAN) failed", errno);
}
+
+ if (ioctl(fd, BTRFS_IOC_QUOTA_RESCAN_WAIT, &args) < 0)
+ throw runtime_error_with_errno("ioctl(BTRFS_IOC_QUOTA_WAIT_RESCAN) failed", errno);
}

29
pr805.patch Normal file
View file

@ -0,0 +1,29 @@
diff --git a/snapper/Btrfs.cc b/snapper/Btrfs.cc
index 80f45d0f..cc01daf0 100644
--- a/snapper/Btrfs.cc
+++ b/snapper/Btrfs.cc
@@ -1,6 +1,6 @@
/*
* Copyright (c) [2011-2015] Novell, Inc.
- * Copyright (c) [2016-2020] SUSE LLC
+ * Copyright (c) [2016-2023] SUSE LLC
*
* All Rights Reserved.
*
@@ -420,13 +420,13 @@ namespace snapper
try
{
- SDir subvolume_dir = openSubvolumeDir();
- qgroup_destroy(subvolume_dir.fd(), calc_qgroup(0, subvolid));
+ SDir general_dir = openGeneralDir();
+ qgroup_destroy(general_dir.fd(), calc_qgroup(0, subvolid));
}
catch (const runtime_error& e)
{
// Ignore that the qgroup could not be destroyed. Should not
- // cause problems except of having unused qgroups.
+ // cause problems except of having stale qgroups.
}
#endif

34
pr821.patch Normal file
View file

@ -0,0 +1,34 @@
diff --git a/server/Client.cc b/server/Client.cc
index 622766c..b71c1cb 100644
--- a/server/Client.cc
+++ b/server/Client.cc
@@ -1184,8 +1184,14 @@
Snapper* snapper = it->getSnapper();
+ RefHolder ref_holder(*it);
+
+ lock.unlock();
+
snapper->calculateUsedSpace();
+ lock.lock();
+
DBus::MessageMethodReturn reply(msg);
conn.send(reply);
@@ -1513,8 +1519,14 @@
Snapper* snapper = it->getSnapper();
+ RefHolder ref_holder(*it);
+
+ lock.unlock();
+
QuotaData quota_data = snapper->queryQuotaData();
+ lock.lock();
+
DBus::MessageMethodReturn reply(msg);
DBus::Hoho hoho(reply);

535
snapper.changes Normal file
View file

@ -0,0 +1,535 @@
* Fri Jun 16 2023 aschnell@suse.com
- improved responsiveness of snapperd when a btrfs quota rescan
is running (see bsc#1211459)
* added pr821.patch
* Thu Apr 13 2023 aschnell@suse.com
- avoid stale btrfs qgroups on transactional systems (bsc#1210151)
* added pr805.patch
- wait for existing btrfs quota rescans to finish (bsc#1210150)
* added pr790.patch
* Fri Mar 19 2021 aschnell@suse.com
- fixed creating root config (root prefix handling)
(gh#openSUSE/snapper#627)
* Wed Mar 10 2021 aschnell@suse.com
- updated translations (bsc#1149754)
* Mon Jan 25 2021 aschnell@suse.com
- fixed testsuite for equal-date (gh#openSUSE/snapper#526)
* Thu Dec 17 2020 aschnell@suse.com
- added option to abbreviate columns in table (see
gh#openSUSE/snapper#268)
- version 0.8.15
* Fri Dec 4 2020 aschnell@suse.com
- in systemd-helper continue with other configs if one config is
broken (gh#openSUSE/snapper#495)
* Thu Dec 3 2020 aschnell@suse.com
- fixed compilation with --disable-btrfs (gh#openSUSE/snapper#505)
* Tue Nov 24 2020 aschnell@suse.com
- do not override passwd after getpwuid_r et.al. calls
(gh#openSUSE/snapper#589)
* Thu Nov 19 2020 aschnell@suse.com
- state in man-pages that ext4 support is discontinued
(gh#openSUSE/snapper#331)
* Wed Nov 18 2020 aschnell@suse.com
- use C++11 regexes instead of own regcomp/regexec wrapper class
(see gh#openSUSE/snapper#583)
* Tue Sep 22 2020 aschnell@suse.com
- added option to cleanup to make requested free space available
(jsc#SLE-15765)
- version 0.8.14
* Fri Sep 4 2020 aschnell@suse.com
- package new snapperd.service file on Debian based distributions
(gh#openSUSE/snapper#557)
* Tue Sep 1 2020 lnussel@suse.com
- activate snapperd using systemd service
* Mon Aug 31 2020 aschnell@suse.com
- fix LVM setup for volume groups and logical volumes with one
character long names (gh#openSUSE/snapper#465)
* Fri Aug 28 2020 aschnell@suse.com
- improved error messages for wrong command line options and
arguments (bsc#1150156)
* Thu Aug 27 2020 aschnell@suse.com
- call fsync after writing snapshot info file (bsc#1078336)
- version 0.8.13
* Thu Jul 23 2020 aschnell@suse.com
- fixed error when using mksubvolume to create /tmp (bsc#1174401)
- version 0.8.12
* Mon Jul 13 2020 aschnell@suse.com
- added error handing for failed ambit detection (bsc#1174038)
- version 0.8.11
* Tue Jun 16 2020 aschnell@suse.com
- special rollback for transactional server (bsc#1172273)
- version 0.8.10
* Mon Apr 6 2020 aschnell@suse.com
- updated translations (bsc#1149754)
- generate dsc file for Ubuntu 19.10
* Thu Jan 16 2020 mvidner@suse.com
- Fix "Snapper is not creating the post snapshot" (bsc#1160938)
- Fix `make clean; make check` failing in zypp-plugin (bsc#1160891)
- version 0.8.9
* Wed Jan 8 2020 mvidner@suse.com
- Add a "writeble copy" description to the 2nd snapshot
of a rollback (Hrotkó Gábor).
- Fix the previous version to build on Debian, Ubuntu, and old GCC
(bsc#1160306).
- version 0.8.8
* Fri Dec 6 2019 mvidner@suse.com
- snapper-zypp-plugin subpackage rewritten from Python to C++
(jsc#SLE-10500)
- added integration tests in snapper-testsuite subpackage
- version 0.8.7
* Wed Oct 23 2019 jlopez@suse.com
- add --machine-readable option for CSV and JSON outputs.
- add --columns option for selecting columns in the commands list,
list-configs and get-config.
- bsc#1149322
- version 0.8.6
* Tue Oct 15 2019 mvidner@suse.com
- allow trailing comments in configuration files (bsc#1005342)
- version 0.8.5
* Tue Oct 15 2019 aschnell@suse.com
- allow to make snapshot from other snapshot that the current one
(jsc#SLE-7333)
- version 0.8.4
* Fri Aug 30 2019 iforster@suse.com
- reusing existing subvolumes on mksubvolume run
(bsc#1138725, bsc#1126900, gh#openSUSE/snapper#236)
* Tue Mar 26 2019 aschnell@suse.com
- fixed seg.fault during rollback if the previous default subvolume
is missing in the snapshot list (bsc#1130273)
- version 0.8.3
* Tue Jan 22 2019 aschnell@suse.com
- adapted to libbtrfs changes to resurrect special btrfs directory
comparison (bsc#1111414)
- version 0.8.2
* Fri Jan 18 2019 aschnell@suse.com
- avoid deadlock for special btrfs directory comparison
(bsc#1049574)
* Wed Nov 21 2018 gergo@borus.hu
- validate snapshot id corresponding to the default subvolume
before using it for the current config (gh#openSUSE/snapper#449)
- version 0.8.1
* Mon Oct 29 2018 aschnell@suse.com
- extended space aware cleanup algorithm to ensure minimal
free space for btrfs (within known ranges) (fate#325774)
- version 0.8.0
* Mon Oct 22 2018 aschnell@suse.com
- fixed querying default and active snapshot if compiled without
rollback support (gh#openSUSE/snapper#442)
- version 0.7.2
* Tue Oct 16 2018 aschnell@suse.com
- disallow to delete special (for btrfs currently mounted and next
to be mounted) snapshots (fate#326479)
- version 0.7.1
* Thu Oct 11 2018 aschnell@suse.com
- mark active and default btrfs subvolume in list output
(fate#326479)
- reorder columns in snapper list output (fate#326479)
- version 0.7.0
* Fri Oct 5 2018 aschnell@suse.com
- right align used space in table output
- version 0.6.1
* Tue Oct 2 2018 aschnell@suse.com
- show used space (exclusive space of btrfs qgroup) for each
snapshot (fate#323843)
- version 0.6.0
* Fri Sep 14 2018 aschnell@suse.com
- avoid setenv after fork (bsc#1107587)
* Mon Jul 23 2018 aschnell@suse.com
- fixed logging during shutdown of snapperd to avoid core dumps
(bsc#1096401 and others)
- version 0.5.6
* Mon May 28 2018 aschnell@suse.com
- merged (gh#openSUSE/snapper#409) to build with boost 1.67.0
(bsc#1096208)
- version 0.5.5
* Thu May 10 2018 jsrain@suse.cz
- move warning in case of non-UTF8 locale to man page (bsc#1092103)
* Fri Apr 20 2018 aschnell@suse.com
- soften error handling if setting locale fails due to broken
system setup (bsc#1085832)
* Mon Jan 29 2018 aschnell@suse.com
- create subvolume instead of snapshot for initial system
(bsc#1077240)
- version 0.5.4
* Fri Jan 26 2018 aschnell@suse.com
- improved error handling for systemd services
(gh#openSUSE/snapper#382)
* Wed Jan 10 2018 aschnell@suse.com
- use python3 instead of python2 (bsc#1070324)
* Wed Dec 6 2017 kukuk@suse.de
- Switched from cron to systemd timers (spec file based
distributions) (fate#324529)
- version 0.5.3
* Thu Nov 23 2017 rbrown@suse.com
- Replace references to /var/adm/fillup-templates with new
%%_fillupdir macro (boo#1069468)
* Wed Sep 6 2017 aschnell@suse.com
- fix compilation with boost 1.65.0 (gh#openSUSE/snapper#354)
(bsc#1061262)
- version 0.5.2
* Thu Aug 3 2017 lslezak@suse.com
- fixed table formatting for non-ACSII characters (bsc#1051901)
(::mbrtowc behavior has been changed in glibc-2.22)
- version 0.5.1
* Tue May 9 2017 aschnell@suse.com
- set cleanup algorithm for rollback snapshots (fate#321773)
- version 0.5.0
* Thu Apr 20 2017 aschnell@suse.com
- generate build file for Ubuntu 17.04
- version 0.4.5
* Wed Mar 22 2017 aschnell@suse.com
- remove read-only mount option for new fstab entry in mksubvolume
(bsc#1030257)
- version 0.4.4
* Thu Feb 2 2017 aschnell@suse.com
- deal with CaaSP btrfs setup where certain subvolumes are
read-only (bsc#1018302 and bsc#1018095)
- version 0.4.3
* Thu Feb 2 2017 aschnell@suse.com
- build SLE12 versions with quota support again (bsc#1021370)
- version 0.4.2
* Wed Dec 21 2016 aschnell@suse.com
- fixed --root option (bsc#1016633)
- version 0.4.1
* Thu Dec 15 2016 aschnell@suse.com
- support option --no-dbus for all snapper commands (fate#319404,
fate#321049)
- version 0.4.0
* Fri Nov 4 2016 aschnell@suse.com
- catch exception if setting default subvolume fails (bsc#1008544)
* Wed Nov 2 2016 aschnell@suse.com
- fixed use of getpwuid_r, getpwnam_r and getgrnam_r
* Tue Aug 9 2016 aschnell@suse.com
- merged patch to fix order of object destruction on shutdown
(gh#openSUSE/snapper#258)
* Mon Aug 8 2016 aschnell@suse.com
- better messages for some btrfs quota errors
(gh#openSUSE/snapper#257)
* Tue Aug 2 2016 aschnell@suse.com
- merged SELinux support from Red Hat (disabled at compile-time
per default) (gh#openSUSE/snapper#239)
- version 0.3.3
* Mon Apr 18 2016 aschnell@suse.com
- reverted some changes done accidentally to default-config (see
fate#312751)
- version 0.3.2
* Mon Apr 11 2016 shundhammer@suse.de
- make sure 'component' string is not destroyed prematurely
(bsc#940154)
- version 0.3.1
* Wed Apr 6 2016 aschnell@suse.com
- implemented space aware cleanup algorithms (fate#312751)
- version 0.3.0
* Thu Mar 31 2016 aschnell@suse.com
- allow to setup quota (for fate#312751)
* Fri Dec 18 2015 aschnell@suse.com
- improved error message (see bsc#956606)
* Mon Dec 14 2015 lslezak@suse.cz
- Allow rollback only for the root file system (bsc#954445)
- version 0.2.10
* Wed Oct 14 2015 aschnell@suse.com
- added conditional compilation of installation-helper
(gh#openSUSE/snapper#202)
* Tue Sep 22 2015 aschnell@suse.com
- updated translations
* Tue Sep 22 2015 shundhammer@suse.de
- Call script /usr/lib/snapper/plugins/rollback if present upon
rollback (fate#319108)
- version 0.2.9
* Tue Sep 22 2015 aschnell@suse.com
- added program to create btrfs subvolume suitable for systems
supporting rollback (bsc#944120)
* Mon Aug 31 2015 aschnell@suse.com
- improved error reporting (bsc#940046)
* Wed Aug 26 2015 aschnell@suse.de
- allow to disable zypp plugin via environment variable (see
fate#319316)
- version 0.2.8
* Tue Jul 7 2015 aschnell@suse.de
- extended snapper-configs man-page
* Mon Jun 29 2015 aschnell@suse.de
- allow to set cleanup algorithm for snapshots created by helper
programs
* Tue Jun 2 2015 aschnell@suse.de
- added error message for invalid locale setting (see bsc#933241)
* Mon May 25 2015 jreidinger@suse.com
- allow list-configs command to work on different root
(for fate#317900)
* Fri May 22 2015 igonzalezsosa@suse.com
- Version 0.2.7
* Mon May 18 2015 igonzalezsosa@suse.com
- added a helper to create snapshots without D-Bus
during system installation/upgrade (fate#317973)
* Tue May 5 2015 aschnell@suse.de
- added option --sync to delete command (fate#317066)
* Tue Apr 14 2015 aschnell@suse.de
- added option --input to diff command
- sort files according to locale
* Tue Mar 3 2015 aschnell@suse.de
- allow to set userdata for snapshots created by helper programs
* Mon Mar 2 2015 aschnell@suse.de
- install systemd unit files and helper (see
gh#openSUSE/snapper#154)
* Tue Feb 24 2015 aschnell@suse.de
- drop -mt decoration from boost libraries (see
http://www.boost.org/users/history/version_1_40_0.html)
* Fri Feb 20 2015 aschnell@suse.de
- added comments in helper program
* Mon Feb 16 2015 aschnell@suse.de
- added helper to support installation into subvolume (fate#318392)
- added root-prefix parameter for config functions
- pass single struct instead of many values to create and modify
snapshot functions
- removed deprecated functions
- version 0.2.6
* Tue Jan 27 2015 aschnell@suse.de
- use C++11 chrono::steady_clock
* Mon Jan 19 2015 aschnell@suse.de
- stricter dbus string escaping (see bsc#913238)
- implemented dbus string escaping in pam_snapper
- version 0.2.5
* Mon Jan 12 2015 aschnell@suse.de
- fixed compilation with clang
* Mon Dec 15 2014 aschnell@suse.de
- ignore everything in .snapshots not matching a number
* Fri Dec 12 2014 aschnell@suse.de
- improved error messages (bsc#889928 and bsc#903834)
* Thu Dec 11 2014 aschnell@suse.de
- support weekly snapshots in cleanup algorithm (see
gh#openSUSE/snapper#135)
* Thu Oct 23 2014 aschnell@suse.de
- use boost unit test framework and automake check feature
* Fri Oct 10 2014 aschnell@suse.de
- improved fadvise usage
* Fri Oct 3 2014 dsterba@suse.cz
- add option --all-configs to snapper client, list snapshots from
all accessible configs
* Thu Oct 2 2014 aschnell@suse.de
- allow to specify command for comparing file
* Mon Sep 29 2014 aschnell@suse.de
- updated translations
* Wed Sep 24 2014 aschnell@suse.de
- resolved some code issues found by code analysis
* Wed Aug 27 2014 dsterba@suse.cz
- conditional check for libbtrfs API version
- version 0.2.4
* Thu Aug 14 2014 aschnell@suse.de
- cleanup after failed create-config (bnc#863578)
* Thu Jul 31 2014 aschnell@suse.de
- also handle primary group of user when checking permissions
(see gh#openSUSE/snapper#100)
- show id of user if username cannot be detected
* Fri Jul 25 2014 aschnell@suse.de
- updated translations
* Tue Jul 22 2014 aschnell@suse.de
- disable support for qgroup (see bug#887046)
* Fri Jul 4 2014 aschnell@suse.de
- updated translations
* Thu Jul 3 2014 aschnell@suse.de
- fixed pam_snapper_pamconfig.sh script (bnc#885604)
* Mon Jun 30 2014 aschnell@suse.de
- make rollback command print verbose messages
* Mon Jun 30 2014 aschnell@suse.de
- allow to add snapshots to qgroup (prototype for fate#312751)
* Mon Jun 23 2014 aschnell@suse.de
- fixed DBus introspection data
- version 0.2.3
* Mon Jun 2 2014 aschnell@suse.de
- added aliases for some snapper commands
* Tue May 27 2014 aschnell@suse.de
- allow to display dates and times in UTC and ISO format
* Tue May 20 2014 aschnell@suse.de
- extended documentation about "number" cleanup algorithm
(bnc#878009)
* Mon May 5 2014 aschnell@suse.de
- updated translations
* Thu Apr 17 2014 aschnell@suse.de
- fixed parent of snapshot generated by rollback
* Thu Apr 10 2014 aschnell@suse.de
- added rollback support (fate#317062)
- version 0.2.2
* Thu Apr 3 2014 aschnell@suse.de
- fixed execution of grub plugin (bnc#871880)
* Tue Apr 1 2014 aschnell@suse.de
- allow to add snapshots subvolume to fstab (for fate#317062)
* Mon Mar 3 2014 aschnell@suse.de
- fixed empty-pre-post cleanup algorithm
* Fri Feb 28 2014 aschnell@suse.de
- fixed setting setuid bit during undochange (bnc#862964)
* Thu Feb 20 2014 aschnell@suse.de
- fixed segmentation fault with DBus (bnc#860119)
* Thu Feb 20 2014 aschnell@suse.de
- updated zypp-plugin.conf (bnc#864841)
* Tue Feb 11 2014 aschnell@suse.de
- sync ACL at startup (bnc#863073)
* Wed Feb 5 2014 aschnell@suse.de
- fixed execution of grub scripts
- version 0.2.1
* Wed Jan 29 2014 aschnell@suse.de
- allow to sync ALLOW_USERS and ALLOW_GROUPS to ACL of .snapshots
directory (see bnc#860116)
- version 0.2.0
* Fri Jan 24 2014 aschnell@suse.de
- removed grub-snapper-plugin subpackage (fate#316232)
* Fri Dec 13 2013 aschnell@suse.de
- tag subpackages containing only Python plugins as noarch
* Mon Nov 25 2013 aschnell@suse.de
- allow to configure snapshotting from zypp-plugin depending on
package list (fate#316203)
- version 0.1.8
* Mon Oct 21 2013 aschnell@suse.de
- fixed inconsistency with default value for BACKGROUND_COMPARISON
* Thu Oct 17 2013 aschnell@suse.de
- extended number cleanup algorithm to privilege important
snapshots (fate#316233)
* Tue Oct 15 2013 aschnell@suse.de
- added grub-snapper-plugin subpackage for writing extra snapshot
metadata for grub2 (fate#316232)
* Tue Oct 1 2013 aschnell@suse.de
- restrict permissions on .snapshots subvolume (bnc#843219)
- version 0.1.7
* Mon Sep 30 2013 aschnell@suse.de
- merged support for handling inactive LVM LVs from oniko
* Fri Sep 6 2013 aschnell@suse.de
- added option --no-dbus to snapper tool
- version 0.1.6
* Thu Jul 25 2013 aschnell@suse.de
- allow to change config via DBus and with command line tool
* Tue Jul 9 2013 aschnell@suse.de
- added manpage describing snapper configs
- optimize timeline cleanup algorithm for only sporadic running
systems
- version 0.1.5
* Mon Jul 8 2013 aschnell@suse.de
- document filters and use fnmatch with FNM_LEADING_DIR
* Tue Jun 25 2013 aschnell@suse.de
- also call initgroups in pam_snapper (bnc#815383)
* Fri Jun 21 2013 aschnell@suse.de
- allow whitespace in ALLOW_USERS and ALLOW_GROUPS
* Fri May 31 2013 aschnell@suse.de
- fixed xattrs reading for certain block/character devices
* Thu May 2 2013 aschnell@suse.de
- added PAM module from mge
- version 0.1.4
* Tue Apr 16 2013 aschnell@suse.de
- merged xattr support from oniko
- version 0.1.3
* Thu Feb 28 2013 aschnell@suse.de
- added filters for lvm
* Mon Feb 25 2013 aschnell@suse.de
- updated translations
* Fri Feb 22 2013 aschnell@suse.de
- use sendfile system-call instead of read/write loop
* Thu Feb 21 2013 aschnell@suse.de
- removed obsolete calls to renice and ionice in cron scripts
(bnc#804355)
* Thu Feb 7 2013 aschnell@suse.de
- zypp-plugin requires dbus-1-python
* Wed Feb 6 2013 aschnell@suse.de
- fixed compatibility issue with boost 1.52
* Mon Feb 4 2013 aschnell@suse.de
- use btrfs send ioctl for snapshot comparison (fate #311399)
- version 0.1.2
* Thu Jan 24 2013 aschnell@suse.de
- fixed type of time_t in DBus protocol
* Mon Nov 26 2012 aschnell@suse.de
- implemented use-counter for mounts of snapshots
- updated translations
* Wed Nov 21 2012 aschnell@suse.de
- handle userdata in zypp plugin (fate #312521)
* Mon Nov 12 2012 aschnell@suse.de
- reject create-config on non-thin LVM volumes
- version 0.1.1
* Thu Oct 18 2012 aschnell@suse.de
- .snapshots is not required to have group root if it is not
group-writable
* Mon Oct 15 2012 aschnell@suse.de
- merged dbus branch (fate #313010 and fate #313042)
- allows non-root user to use snapper
- record user id during snapshot creation
- run background comparisons sequential
- use ioctl instead of btrfs program
- disable ext4 support
- removed Python bindings
- version 0.1.0
* Wed Aug 22 2012 aschnell@suse.de
- fixed segmentation fault for unknown fstype
- version 0.0.14
* Tue Aug 14 2012 aschnell@suse.de
- fixed logging during program termination
* Wed Jul 25 2012 aschnell@suse.de
- take mount options from original filesystem when mounting
snapshots
- version 0.0.13
* Tue Jul 24 2012 aschnell@suse.de
- added experimental support for LVM thin-provisioned snapshots
- version 0.0.12
* Tue Jun 12 2012 aschnell@suse.de
- removed blocxx (fate #313242)
- version 0.0.11
* Thu Mar 15 2012 aschnell@suse.de
- added missing includes for gcc 4.7
* Tue Mar 6 2012 aschnell@suse.de
- allow to disable background comparison (bnc#726122)
- version 0.0.10
* Fri Mar 2 2012 aschnell@suse.de
- added option --command to snapper create
- version 0.0.9
* Fri Feb 24 2012 aschnell@suse.de
- allow to compile without blocxx
* Fri Dec 23 2011 aschnell@suse.de
- allow to delete a configuration
* Thu Nov 24 2011 aschnell@suse.de
- package Python bindings
- version 0.0.8
* Sat Nov 19 2011 coolo@suse.com
- add libtool as buildrequire to avoid implicit dependency
* Fri Nov 11 2011 aschnell@suse.de
- moved supplements btrfsprogs from libsnapper to snapper
(bnc#729859)
* Fri Oct 21 2011 aschnell@suse.de
- create read-only btrfs snapshots
* Wed Oct 12 2011 aschnell@suse.de
- updated translations
* Fri Oct 7 2011 aschnell@suse.de
- check iterator in findPre
* Thu Sep 22 2011 aschnell@suse.de
- do not log output of diff command
* Tue Sep 20 2011 aschnell@suse.de
- improved error handling (bnc#718914)
* Thu Sep 15 2011 aschnell@suse.de
- added userdata to snapshots
* Fri Sep 2 2011 aschnell@suse.de
- updated translations
* Wed Aug 31 2011 aschnell@suse.de
- renamed snapper command diff to status and contentdiff to diff
* Mon Aug 29 2011 aschnell@suse.de
- improved manpage (bnc #710858)
* Thu Aug 11 2011 aschnell@suse.de
- improvements to command-line interface
* Thu Aug 4 2011 aschnell@suse.de
- added experimental ext4 support
* Mon Aug 1 2011 aschnell@suse.de
- preparations for supporting multiple filesystem types
- version 0.0.7
* Mon Aug 1 2011 aschnell@suse.de
- updated translations
* Sat Jul 30 2011 aschnell@suse.de
- added missing shell quoting
* Tue Jun 28 2011 aschnell@suse.de
- added snapper-zypp-plugin subpackage (fate #308626)
* Fri Jun 17 2011 aschnell@suse.de
- updated translations
* Thu Jun 9 2011 aschnell@suse.de
- added man-page
* Mon Jun 6 2011 aschnell@suse.de
- place snapshots in .snapshots directory
- version 0.0.6
* Wed Apr 6 2011 aschnell@suse.de
- simplified setup
- version 0.0.5
* Mon Apr 4 2011 aschnell@suse.de
- allow to ignore files during snapshot comparison
* Mon Jan 10 2011 aschnell@suse.de
- started development (fate #303699)
- version 0.0.1

313
snapper.spec Normal file
View file

@ -0,0 +1,313 @@
#
# spec file for package snapper
#
# Copyright (c) 2022-2023 ZhuningOS
#
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
# optionally build with test coverage reporting
%bcond_with coverage
Name: snapper
Version: 0.8.16
Release: 150300.3.6.1
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: snapper-%{version}.tar.bz2
# see https://github.com/openSUSE/snapper/pull/790
Patch1: pr790.patch
# see https://github.com/openSUSE/snapper/pull/805
Patch2: pr805.patch
# see https://github.com/openSUSE/snapper/pull/821
Patch3: pr821.patch
%if 0%{?suse_version} > 1325
BuildRequires: libboost_system-devel
BuildRequires: libboost_test-devel
BuildRequires: libboost_thread-devel
%else
BuildRequires: boost-devel
%endif
BuildRequires: e2fsprogs-devel
BuildRequires: gcc-c++
BuildRequires: libacl-devel
BuildRequires: libtool
BuildRequires: libxml2-devel
BuildRequires: ncurses-devel
%if 0%{?suse_version} > 1230
BuildRequires: libbtrfs-devel
%endif
%if 0%{?suse_version} > 1310
BuildRequires: libmount-devel >= 2.24
%endif
%if 0%{?fedora_version} >= 23
BuildRequires: pkgconfig
BuildRequires: systemd
%else
BuildRequires: pkg-config
%endif
%if 0%{?fedora_version} >= 24 || 0%{?centos_version} >= 800
BuildRequires: glibc-langpack-de
BuildRequires: glibc-langpack-en
%endif
%if ! 0%{?mandriva_version}
%if 0%{?fedora_version} >= 23
BuildRequires: dbus-devel
BuildRequires: docbook-style-xsl
%else
BuildRequires: dbus-1-devel
BuildRequires: docbook-xsl-stylesheets
%endif
BuildRequires: libxslt
%else
BuildRequires: docbook-dtd45-xml
BuildRequires: docbook-xsl
BuildRequires: libdbus-1-devel
BuildRequires: xsltproc
%endif
%if (0%{?suse_version} && 0%{?suse_version} >= 1210)
BuildRequires: libzypp(plugin:commit)
%endif
BuildRequires: pam-devel
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?scientificlinux_version}
BuildRequires: json-c-devel
%else
BuildRequires: libjson-c-devel
%endif
%if %{with coverage}
BuildRequires: lcov
%endif
Requires: diffutils
Requires: libsnapper5 = %version
%if 0%{?suse_version}
Recommends: logrotate snapper-zypp-plugin
Supplements: btrfsprogs
%endif
Summary: Tool for filesystem snapshot management
License: GPL-2.0-only
Group: System/Packages
URL: http://snapper.io/
%description
This package contains snapper, a tool for filesystem snapshot management.
%prep
%setup
%autopatch -p1
%build
%if %{with coverage}
# optimized code may confuse the coverage measurement, turn it off
# -fPIC is mysteriously needed on Fedora.
export CFLAGS="-g3 -fPIC"
export CXXFLAGS="-g3 -fPIC"
%else
export CFLAGS="%{optflags} -DNDEBUG"
export CXXFLAGS="%{optflags} -DNDEBUG"
%endif
autoreconf -fvi
%configure \
--docdir="%{_defaultdocdir}/snapper" \
%if %{with coverage}
--enable-coverage \
%endif
%if 0%{?suse_version} <= 1310
--disable-rollback \
%endif
%if 0%{?suse_version} <= 1310
--disable-btrfs-quota \
%endif
--disable-silent-rules --disable-ext4
make %{?_smp_mflags}
%install
%make_install
rm -f "%{buildroot}/%{_libdir}"/*.la "%{buildroot}/%{_lib}/security/pam_snapper.la"
rm -f %{buildroot}/etc/cron.hourly/suse.de-snapper
rm -f %{buildroot}/etc/cron.daily/suse.de-snapper
%if 0%{?suse_version}
install -D -m 644 data/sysconfig.snapper "%{buildroot}%{_fillupdir}/sysconfig.snapper"
%else
install -D -m 644 data/sysconfig.snapper "%{buildroot}/etc/sysconfig/snapper"
%endif
%{find_lang} snapper
%check
make %{?_smp_mflags} check VERBOSE=1
%pre
%if 0%{?suse_version}
%service_add_pre snapper-boot.service snapper-boot.timer snapper-cleanup.service snapper-cleanup.timer snapper-timeline.service snapper-timeline.timer snapperd.service
%endif
%post
%if 0%{?suse_version}
# special hack, since the macros were added much later than
# the systemd timer
if [ -f /etc/cron.hourly/suse.de-snapper ]; then
systemctl preset snapper-timeline.timer || :
systemctl is-enabled -q snapper-timeline.timer && systemctl start snapper-timeline.timer || :
fi
if [ -f /etc/cron.daily/suse.de-snapper ]; then
systemctl preset snapper-cleanup.timer || :
systemctl is-enabled -q snapper-cleanup.timer && systemctl start snapper-cleanup.timer || :
fi
%service_add_post snapper-boot.service snapper-boot.timer snapper-cleanup.service snapper-cleanup.timer snapper-timeline.service snapper-timeline.timer snapperd.service
%endif
%preun
%if 0%{?suse_version}
%service_del_preun snapper-boot.service snapper-boot.timer snapper-cleanup.service snapper-cleanup.timer snapper-timeline.service snapper-timeline.timer snapperd.service
%endif
%postun
%if 0%{?suse_version}
%service_del_postun snapper-boot.service snapper-boot.timer snapper-cleanup.service snapper-cleanup.timer snapper-timeline.service snapper-timeline.timer snapperd.service
%endif
%files -f snapper.lang
%defattr(-,root,root)
%{_bindir}/snapper
%{_sbindir}/snapperd
%if 0%{?suse_version} > 1310
%{_sbindir}/mksubvolume
%endif
%dir %{_prefix}/lib/snapper
%{_prefix}/lib/snapper/*-helper
%doc %{_mandir}/*/snapper.8*
%doc %{_mandir}/*/snapperd.8*
%doc %{_mandir}/*/snapper-configs.5*
%if 0%{?suse_version} > 1310
%doc %{_mandir}/*/mksubvolume.8*
%endif
%config(noreplace) %{_sysconfdir}/logrotate.d/snapper
%{_unitdir}/snapper*.*
%config /etc/dbus-1/system.d/org.opensuse.Snapper.conf
%{_datadir}/dbus-1/system-services/org.opensuse.Snapper.service
%package -n libsnapper5
Summary: Library for filesystem snapshot management
Group: System/Libraries
Requires: util-linux
%if 0%{?suse_version}
PreReq: %fillup_prereq
%endif
# expands to Obsoletes: libsnapper1 libsnapper2 libsnapper3...
Obsoletes: %(echo `seq -s " " -f "libsnapper%.f" $((5 - 1))`)
%description -n libsnapper5
This package contains libsnapper, a library for filesystem snapshot management.
%files -n libsnapper5
%defattr(-,root,root)
%{_libdir}/libsnapper.so.*
%dir %{_sysconfdir}/snapper
%dir %{_sysconfdir}/snapper/configs
%dir %{_sysconfdir}/snapper/config-templates
%config(noreplace) %{_sysconfdir}/snapper/config-templates/default
%dir %{_sysconfdir}/snapper/filters
%config(noreplace) %{_sysconfdir}/snapper/filters/*.txt
%doc %dir %{_defaultdocdir}/snapper
%doc %{_defaultdocdir}/snapper/AUTHORS
%doc %{_defaultdocdir}/snapper/COPYING
%if 0%{?suse_version}
%{_fillupdir}/sysconfig.snapper
%else
%config(noreplace) %{_sysconfdir}/sysconfig/snapper
%endif
%post -n libsnapper5
/sbin/ldconfig
%if 0%{?suse_version}
%{fillup_only -n snapper}
%endif
%postun -n libsnapper5 -p /sbin/ldconfig
%package -n libsnapper-devel
%if 0%{?suse_version} > 1325
Requires: libboost_headers-devel
%else
Requires: boost-devel
%endif
Requires: gcc-c++
Requires: libacl-devel
Requires: libsnapper5 = %version
Requires: libstdc++-devel
Requires: libxml2-devel
%if 0%{?suse_version} > 1230
Requires: libbtrfs-devel
%endif
%if 0%{?suse_version} > 1310
Requires: libmount-devel >= 2.24
%endif
Summary: Header files and documentation for libsnapper
Group: Development/Languages/C and C++
%description -n libsnapper-devel
This package contains header files and documentation for developing with
libsnapper.
%files -n libsnapper-devel
%defattr(-,root,root)
%{_libdir}/libsnapper.so
%{_includedir}/snapper
%package -n snapper-zypp-plugin
Requires: snapper = %version
Requires: libzypp(plugin:commit) = 1
Summary: A zypp commit plugin for calling snapper
Group: System/Packages
%description -n snapper-zypp-plugin
This package contains a plugin for zypp that makes filesystem snapshots with
snapper during commits.
%files -n snapper-zypp-plugin
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/snapper/zypp-plugin.conf
%if 0%{?suse_version} < 1210
%dir /usr/lib/zypp
%dir /usr/lib/zypp/plugins
%dir /usr/lib/zypp/plugins/commit
%endif
/usr/lib/zypp/plugins/commit/snapper-zypp-plugin
%doc %{_mandir}/*/snapper-zypp-plugin.8*
%doc %{_mandir}/*/snapper-zypp-plugin.conf.5*
%package -n pam_snapper
Requires: pam
Requires: snapper = %version
Summary: PAM module for calling snapper
Group: System/Packages
%description -n pam_snapper
A PAM module for calling snapper during user login and logout.
%files -n pam_snapper
%defattr(-,root,root)
/%{_lib}/security/pam_snapper.so
%dir /usr/lib/pam_snapper
/usr/lib/pam_snapper/*.sh
%doc %{_mandir}/*/pam_snapper.8*
%package testsuite
Summary: Integration tests for snapper
Group: System/Packages
%description testsuite
Tests to be run in a scratch machine to test that snapper operates as expected.
%files testsuite
%defattr(-,root,root)
%dir %{_libdir}/snapper
%dir %{_libdir}/snapper/testsuite
%{_libdir}/snapper/testsuite/*
%changelog