d96942c7205d8280c77a7a15ad3fe6953d2383ae
[gentoo.git] / sys-block / storcli / storcli-7.1211.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="7"
5
6 inherit pax-utils
7
8 # Upstream is still using strange version numbers
9 MY_PV="007.1211.0000.0000"
10
11 DESCRIPTION="MegaRAID StorCLI (successor of the MegaCLI)"
12 HOMEPAGE="https://www.broadcom.com/support/download-search?dk=storcli"
13 SRC_URI="https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/${MY_PV}_Unified_StorCLI.zip -> ${P}.zip"
14
15 LICENSE="Avago LSI BSD"
16 SLOT="0/7.12"
17 KEYWORDS="-* ~amd64 ~x86"
18 IUSE=""
19
20 RDEPEND=""
21 DEPEND="app-arch/unzip"
22
23 MY_STORCLI_BASEDIR="/opt/lsi/storcli"
24
25 QA_PRESTRIPPED="${MY_STORCLI_BASEDIR:1}/storcli
26         ${MY_STORCLI_BASEDIR:1}/storcli32"
27 QA_PREBUILT=${QA_PRESTRIPPED}
28
29 src_unpack() {
30         mkdir srcfiles || die
31         pushd srcfiles &>/dev/null || die
32         default
33         mv Unified_storcli_all_os/Ubuntu/storcli_*.deb "${WORKDIR}" || die "Failed to move storcli_*.deb"
34         popd &>/dev/null || die
35
36         rm -rf srcfiles || die
37
38         # Unpack Ubuntu package which will be our $S content
39         unpack "${WORKDIR}"/storcli_*.deb
40         rm -f storcli_*.deb || die "Failed to cleanup storcli_*.deb package"
41         unpack "${WORKDIR}"/data.tar.xz
42
43         mkdir "${S}" || die "Failed to create '${S}'"
44 }
45
46 src_prepare() {
47         default
48
49         # Create clean $S
50         mv "${WORKDIR}"/opt/Mega*/storcli/* "${S}" || die "Failed to move storcli_.deb content to '${S}'"
51         rm -rf "${WORKDIR}"/{opt,control.tar.gz,data.tar.gz,debian-binary} || die "Failed to cleanup no longer needed files"
52 }
53
54 src_install() {
55         exeinto "${MY_STORCLI_BASEDIR}"
56
57         if use x86; then
58                 doexe storcli
59         elif use amd64; then
60                 # 32-bit version is less crashy than the 64bit (bug #656494)
61                 newexe storcli storcli32
62                 newexe storcli64 storcli
63         fi
64
65         dosym "${MY_STORCLI_BASEDIR}"/storcli /usr/sbin/storcli
66
67         pax-mark m "${D}${MY_STORCLI_BASEDIR}"/storcli
68 }