summaryrefslogtreecommitdiff
blob: 70303d1899481a26b55cb205b5798b8fe3a01a35 (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit autotools systemd

DESCRIPTION="Network backup and restore client and server for Unix and Windows"
HOMEPAGE="https://burp.grke.org/"
SRC_URI="https://github.com/grke/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="AGPL-3"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE="acl ipv6 test xattr"

RESTRICT="!test? ( test )"

CDEPEND="acct-group/burp
	acct-user/burp
	dev-libs/uthash
	dev-libs/openssl:0=
	net-libs/librsync:=
	sys-libs/ncurses:0=
	sys-libs/zlib
	virtual/libcrypt:=
	acl? ( sys-apps/acl )
	xattr? ( sys-apps/attr )"
DEPEND="${CDEPEND}
	test? ( dev-libs/check )"
BDEPEND=">=sys-devel/autoconf-2.71
	virtual/pkgconfig"
RDEPEND="${CDEPEND}
	virtual/logger"

PATCHES=(
	"${FILESDIR}"/${PN}-2.1.20-no_mkdir_run.patch
	"${FILESDIR}"/${PN}-2.1.20-protocol1_by_default.patch
	"${FILESDIR}"/${PN}-2.0.54-server_user.patch
)

src_prepare() {
	default

	eautoreconf
}

src_configure() {
	local myeconfargs=(
		--localstatedir=/var
		--sysconfdir=/etc/burp
		--enable-largefile
		--runstatedir=/run
		$(use_enable acl)
		$(use_enable ipv6)
		$(use_enable xattr)
	)
	econf "${myeconfargs[@]}"
}

src_test() {
	# See https://github.com/grke/burp/issues/869
	local -x CK_DEFAULT_TIMEOUT=10
	default
}

src_install() {
	default
	keepdir /var/spool/burp
	fowners -R root:${PN} /var/spool/burp
	fperms 0770 /var/spool/burp

	emake DESTDIR="${D}" install-configs
	fowners -R root:${PN} /etc/burp
	fperms 0750 /etc/burp
	fperms 0640 /etc/burp/burp-server.conf
	fperms 0750 /etc/burp/clientconfdir

	newinitd "${FILESDIR}"/${PN}.initd ${PN}
	systemd_dounit "${FILESDIR}"/${PN}.service
}

pkg_postinst() {
	elog "Burp ebuilds now support the autoupgrade mechanism in both"
	elog "client and server mode. In both cases it is disabled by"
	elog "default. You almost certainly do NOT want to enable it in"
	elog "client mode because upgrades obtained this way will not be"
	elog "managed by Portage."

	if [[ ! -e ${EROOT}/etc/burp/CA/index.txt ]]; then
		elog ""
		elog "At first run burp server will generate DH parameters and SSL"
		elog "certificates.  You should adjust configuration before."
		elog "Server configuration is located at"
		elog ""
		elog "  ${EROOT}/etc/burp/burp-server.conf"
		elog ""
	fi

	# According to PMS this can be a space-separated list of version
	# numbers, even though in practice it is typically just one.
	local oldver
	for oldver in ${REPLACING_VERSIONS}; do
		if [[ $(ver_cut 1 ${oldver}) -lt 2 ]]; then
			ewarn "Starting with version 2.0.54 we no longer patch bedup to use"
			ewarn "the server config file by default. If you use bedup, please"
			ewarn "update your scripts to invoke it as"
			ewarn ""
			ewarn "  bedup -c ${EROOT}/etc/burp/burp-server.conf"
			ewarn ""
			ewarn "Otherwise deduplication will not work!"
			break
		fi
	done
}