app-backup/duplicity: amd64 stable
[gentoo.git] / app-backup / btrbk / btrbk-0.29.1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit systemd
7
8 if [[ ${PV} == "9999" ]] ; then
9         EGIT_REPO_URI="https://github.com/digint/btrbk.git"
10         inherit git-r3
11         SRC_URI=""
12 else
13         SRC_URI="https://digint.ch/download/btrbk/releases/${P}.tar.xz"
14         KEYWORDS="~amd64 ~arm ~arm64 ~x86"
15 fi
16
17 DESCRIPTION="Tool for creating snapshots and remote backups of btrfs subvolumes"
18 HOMEPAGE="https://digint.ch/btrbk/"
19 LICENSE="GPL-3+"
20 SLOT="0"
21 IUSE="+mbuffer +doc"
22
23 DEPEND="doc? ( >=dev-ruby/asciidoctor-1.5.7 )"
24
25 RDEPEND="dev-lang/perl
26         net-misc/openssh
27         mbuffer? ( >=sys-block/mbuffer-20180505 )
28         >=sys-fs/btrfs-progs-4.12"
29
30 src_compile() {
31         emake clean
32         use doc && emake -C doc
33 }
34 src_install() {
35         local targets="install-bin install-etc install-share install-systemd"
36         use doc && targets="${targets} install-man install-doc"
37         emake \
38                 DESTDIR="${D}" \
39                 DOCDIR="/usr/share/doc/${PF}" \
40                 SYSTEMDDIR="$(systemd_get_systemunitdir)" \
41                 ${targets}
42 }
43 pkg_preinst() {
44         if has_version "<${CATEGORY}/${PN}-0.26.0" ; then
45                 upgrade_0_26_0_warning="1"
46         fi
47         if has_version "<${CATEGORY}/${PN}-0.27.0" ; then
48                 upgrade_0_27_0_warning="1"
49         fi
50 }
51 pkg_postinst() {
52         if [[ "${upgrade_0_26_0_warning}" == "1" ]]; then
53                 ewarn "If you are using raw targets, make sure to run the"
54                 ewarn "\"raw_suffix2sidecar\" utility in each target directory."
55         fi
56         if [[ "${upgrade_0_27_0_warning}" == "1" ]]; then
57                 ewarn 'Due to a bugfix in the scheduler [1] [2], previously preserved'
58                 ewarn 'monthly/yearly backups could get deleted when upgrading to'
59                 ewarn 'btrbk-0.27.0.'
60                 ewarn ''
61                 ewarn 'Before upgrading to btrbk-0.27.0, make sure to stop all cron jobs'
62                 ewarn 'or systemd timers calling btrbk.'
63                 ewarn ''
64                 ewarn 'After upgrading, run "btrbk prune --dry-run --print-schedule" and'
65                 ewarn 'check if any snapshots/backups would get deleted. If you want to'
66                 ewarn 'forcibly preserve a snapshot/backup forever, rename it:'
67                 ewarn ''
68                 ewarn '    mv mysubvol.YYYYMMDD mysubvol.YYYYMMDD.keep_forever'
69                 ewarn ''
70                 ewarn 'Note that btrbk ignores subvolumes with unknown naming scheme, e.g.'
71                 ewarn '(".keep_forever" suffix in the example above).'
72                 ewarn ''
73                 ewarn '  [1] https://github.com/digint/btrbk/issues/217'
74                 ewarn '  [2] https://github.com/digint/btrbk/commit/719fb5f'
75         fi
76 }