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

EAPI="7"

inherit pax-utils

# Upstream is still using strange version numbers
MY_PV="007.1017.0000.0000"

DESCRIPTION="MegaRAID StorCLI (successor of the MegaCLI)"
HOMEPAGE="https://www.broadcom.com/support/download-search?dk=storcli"
SRC_URI="https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/MR_SAS_Unified_StorCLI_${MY_PV}.zip -> ${P}.zip"

LICENSE="Avago LSI BSD"
SLOT="0/7.10"
KEYWORDS="-* ~amd64 ~x86"
IUSE=""

RDEPEND=""
DEPEND="app-arch/unzip"

MY_STORCLI_BASEDIR="/opt/lsi/storcli"

QA_PRESTRIPPED="${MY_STORCLI_BASEDIR:1}/storcli
	${MY_STORCLI_BASEDIR:1}/storcli32"
QA_PREBUILT=${QA_PRESTRIPPED}

src_unpack() {
	mkdir srcfiles || die
	pushd srcfiles &>/dev/null || die
	default
	mv Ubuntu/storcli_*.deb "${WORKDIR}" || die "Failed to move storcli_*.deb"
	popd &>/dev/null || die

	rm -rf srcfiles || die

	# Unpack Ubuntu package which will be our $S content
	unpack "${WORKDIR}"/storcli_*.deb
	rm -f storcli_*.deb || die "Failed to cleanup storcli_*.deb package"
	unpack "${WORKDIR}"/data.tar.gz

	mkdir "${S}" || die "Failed to create '${S}'"
}

src_prepare() {
	default

	# Create clean $S
	mv "${WORKDIR}"/opt/Mega*/storcli/* "${S}" || die "Failed to move storcli_.deb content to '${S}'"
	rm -rf "${WORKDIR}"/{opt,control.tar.gz,data.tar.gz,debian-binary} || die "Failed to cleanup no longer needed files"
}

src_install() {
	exeinto "${MY_STORCLI_BASEDIR}"

	if use x86; then
		doexe storcli
	elif use amd64; then
		# 32-bit version is less crashy than the 64bit (bug #656494)
		newexe storcli storcli32
		newexe storcli64 storcli
	fi

	dosym "${MY_STORCLI_BASEDIR}"/storcli /usr/sbin/storcli

	pax-mark m "${D%/}${MY_STORCLI_BASEDIR}"/storcli
}