blob: ecf53c859eee49f7687a5ac96fe7256a2eb3d978 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# Copyright 2023-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit systemd optfeature
DESCRIPTION="Policy-driven snapshot management and replication tools for OpenZFS."
HOMEPAGE="https://github.com/jimsalterjrs/sanoid"
if [[ "${PV}" = *9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/jimsalterjrs/${PN^}.git"
else
SRC_URI="https://github.com/jimsalterjrs/${PN^}/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz"
KEYWORDS="~amd64"
fi
LICENSE="GPL-3"
SLOT="0"
IUSE="cron"
BDEPEND="
dev-lang/perl
sys-apps/groff
"
RDEPEND="
dev-lang/perl
app-arch/gzip
app-arch/lz4
cron? ( virtual/cron )
dev-perl/Capture-Tiny
dev-perl/Config-IniFiles
sys-apps/pv
sys-block/mbuffer
sys-fs/zfs
virtual/perl-Data-Dumper
virtual/perl-Getopt-Long
virtual/ssh
"
DEPEND="${RDEPEND}"
src_compile() {
perldoc -onroff -dsanoid.1 sanoid || die "Failed to compile sanoid.1"
perldoc -onroff -dsyncoid.1 syncoid || die "Failed to compile syncoid.1"
}
DOCS="CHANGELIST LICENSE README.md"
src_prepare() {
default
sed -i 's|/usr/sbin|/usr/bin|g' \
"packages/debian/sanoid.timer" \
"packages/debian/sanoid.service" \
"packages/debian/sanoid.sanoid-prune.service" || die
}
src_install() {
dobin sanoid
dobin syncoid
doman sanoid.1 syncoid.1
# Documents
einstalldocs
# Configs
insinto /etc/sanoid
doins sanoid.defaults.conf
doins sanoid.conf
# Binaries
dobin sanoid syncoid findoid sleepymutex
# Cron?
if use cron; then
insinto /etc/cron.d
echo "#* * * * * root TZ=UTC /usr/bin/sanoid --cron" > "${PN}.cron" || die
newins "${PN}.cron" "${PN}"
fi
# Systemd units
systemd_dounit "packages/debian/sanoid.service"
systemd_dounit "packages/debian/sanoid.timer"
systemd_dounit "packages/debian/sanoid.sanoid-prune.service"
}
pkg_postinst() {
optfeature "lzop compression support" app-arch/lzop
optfeature "pigz compression support" app-arch/pigz
optfeature "zstd compression support" app-arch/zstd
if [[ -z ${REPLACING_VERSIONS} ]]; then
elog "You will need to set up your ${EROOT}/etc/sanoid/sanoid.conf file before"
elog "running sanoid for the first time. For details, please consult the"
elog "documentation on https://github.com/jimsalterjrs/sanoid."
if systemd_is_booted; then
elog ""
elog "To enable sanoid via systemd timer, run:"
elog " systemctl enable --now sanoid.timer"
if use cron; then
elog ""
elog "or"
elog ""
fi
fi
if use cron; then
elog "To enable sanoid via cron, uncomment the cron job in /etc/cron.d/sanoid."
fi
else
elog "Removing old cache files (if any)"
[[ -f /var/cache/sanoidsnapshots.txt ]] && rm -v /var/cache/sanoidsnapshots.txt
[[ -f /var/cache/sanoid/snapshots.txt ]] && rm -v /var/cache/sanoid/snapshots.txt
[[ -f /var/cache/sanoid/datasets.txt ]] && rm -v /var/cache/sanoid/datasets.txt
fi
}
|