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

EAPI=8

CMAKE_WARN_UNUSED_CLI=no
CMAKE_REMOVE_MODULES_LIST=()

MY_PV=${PV/_/-}
MY_PN="bareos"
MY_P="${MY_PN}-${MY_PV}"

if [[ ${PV} == 9999 ]]; then
	inherit cmake webapp git-r3
	S=${WORKDIR}/${PF}/webui
	SRC_URI=""
	EGIT_REPO_URI="https://github.com/${MY_PN}/${MY_PN}.git"
	KEYWORDS=""
else
	inherit webapp
	S=${WORKDIR}/${MY_PN}-Release-${PV}/webui
	SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/Release/${MY_PV}.tar.gz -> ${MY_P}.tar.gz"
	KEYWORDS="~amd64 ~x86"
fi

DESCRIPTION="Featureful client/server network backup suite"
HOMEPAGE="https://www.bareos.org/"
RESTRICT="mirror"

LICENSE="AGPL-3"

IUSE="mysql +postgres"

DEPEND=""
RDEPEND="${DEPEND}
	dev-lang/php[mysql?,pdo,postgres?]
	virtual/httpd-php
"

need_httpd_cgi

pkg_setup() {
	webapp_pkg_setup
}

src_configure() {
	if [[ ${PV} == 9999 ]]; then
		pushd "${WORKDIR}/${PF}"
		CURRENT_VERSION=$(echo $(cmake -P get_version.cmake) | sed 's/[- ]//g')
		popd
		local mycmakeargs=(
			-DVERSION_STRING=${CURRENT_VERSION}
		)

		cmake_src_configure
	else
		default
	fi
}

src_install() {
	webapp_src_preinst

	dodoc README.md
	webapp_server_configfile nginx "${S}/install/nginx/bareos-webui.conf" bareos-webui.include
	webapp_server_configfile apache "${S}/install/apache/bareos-webui.conf" bareos-webui.conf
#	webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt

	insinto "${MY_HTDOCSDIR#${EPREFIX}}"
	pushd "${BUILD_DIR}" > /dev/null || die
	DESTDIR="${D}/${MY_HTDOCSDIR#${EPREFIX}}" ${CMAKE_MAKEFILE_GENERATOR} install "$@" || die "died running ${CMAKE_MAKEFILE_GENERATOR} install"
	popd > /dev/null || die

	webapp_configfile "${MY_HTDOCSDIR#${EPREFIX}}"/bareos-webui/config/application.config.php
	webapp_configfile "${MY_HTDOCSDIR#${EPREFIX}}"/bareos-webui/config/autoload/global.php

	mv "${D}/${MY_HTDOCSDIR#${EPREFIX}}"/bareos-webui/* "${D}/${MY_HTDOCSDIR#${EPREFIX}}"/
	rmdir "${D}/${MY_HTDOCSDIR#${EPREFIX}}"/bareos-webui
	find "${D}/${MY_HTDOCSDIR#${EPREFIX}}" -type f -name '*.in' -delete

	mv "${D}/${MY_HTDOCSDIR#${EPREFIX}}/etc" "${D}/etc"
	rm -rf "${D}/etc/httpd"

	webapp_src_install
}