summaryrefslogtreecommitdiff
blob: df0f3344c051f9c26bd59bb0dce2a2724add861e (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

# Unlike many other binary packages the user doesn't need to agree to a licence
# to download VMWare. The agreeing to a licence is part of the configure step
# which the user must run manually.

EAPI=5

inherit eutils perl-module versionator

MY_PV=$(replace_version_separator 3 '-' )
MY_PN="VMware-vSphere-CLI-${MY_PV}"

DESCRIPTION="VMware vSphere Command-Line Interface"
HOMEPAGE="http://www.vmware.com/"
SRC_URI=" x86? ( mirror://vmware/software/vmserver/${MY_PN}.i386.tar.gz )
		amd64? ( mirror://vmware/software/vmserver/${MY_PN}.x86_64.tar.gz ) "

LICENSE="vmware"
IUSE=""
SLOT="0"
KEYWORDS="-* ~x86 ~amd64"
RESTRICT="strip"

DEPEND="
	>=dev-lang/perl-5
	dev-libs/expat
	dev-libs/glib:2
	dev-libs/libxml2
	dev-libs/openssl:0.9.8
	dev-perl/Archive-Zip
	dev-perl/Class-MethodMaker
	dev-perl/Crypt-SSLeay
	dev-perl/Data-Dump
	dev-perl/Data-Dumper-Concise
	dev-perl/HTML-Parser
	dev-perl/SOAP-Lite
	dev-perl/URI
	dev-perl/Data-UUID
	dev-perl/XML-LibXML
	dev-perl/XML-NamespaceSupport
	dev-perl/XML-SAX
	dev-perl/libwww-perl
	dev-perl/libxml-perl
	virtual/perl-Compress-Raw-Zlib
	virtual/perl-IO-Compress
	virtual/perl-version
	sys-fs/e2fsprogs
	sys-libs/zlib"
#	!app-emulation/vmware-server
#	!app-emulation/vmware-vix
#	!app-emulation/vmware-workstation"
RDEPEND="${DEPEND}"

S=${WORKDIR}/${PN}-distrib

pkg_setup() {
	if use x86; then
		MY_P="${MY_PN}.i386"
	elif use amd64; then
		MY_P="${MY_PN}.x86_64"
	fi
}

src_prepare() {
	VMWARE_GROUP=${VMWARE_GROUP:-vmware}
	VMWARE_INSTALL_DIR=/opt/${PN//-//}

	shortname="vcli"
	product="vmware-vcli"
	config_dir="/etc/vmware-vcli"
	product_name="vSphere CLI"

	enewgroup ${VMWARE_GROUP}

	sed -i.bak -e "s:/sbin/lsmod:/bin/lsmod:" "${S}"/installer/services.sh || die "sed of services"

	# We won't want any perl scripts from VMware
	rm -f *.pl bin/*.pl
	rm -f etc/installer.sh

	epatch "${FILESDIR}"/makefile.patch

	perl-module_src_prepare
}

src_install() {
	# We loop through our directories and copy everything to our system.
	for x in apps bin
	do
		if [[ -e "${S}"/${x} ]]
		then
			dodir "${VMWARE_INSTALL_DIR}"/${x}
			cp -pPR "${S}"/${x}/* "${D}""${VMWARE_INSTALL_DIR}"/${x} || die "copying ${x}"
		fi
	done

	perl-module_src_install

	# init script
	if [[ -e "${FILESDIR}/${PN}.rc" ]]
	then
		newinitd "${FILESDIR}"/${PN}.rc ${product}
	fi

	# create the environment
	local envd="${T}/90vmware-cli"
	cat > "${envd}" <<-EOF
		PATH='${VMWARE_INSTALL_DIR}/bin'
		ROOTPATH='${VMWARE_INSTALL_DIR}/bin'
	EOF
	doenvd "${envd}"

	# Last, we check for any mime files.
	if [[ -e "${FILESDIR}/${PN}.xml" ]]
	then
		insinto /usr/share/mime/packages
		doins "${FILESDIR}"/${PN}.xml
	fi

	if [[ -e doc/EULA ]]
	then
		insinto "${VMWARE_INSTALL_DIR}"/doc
		doins doc/EULA
	fi

	doman man/*

	# create the configuration
	#dodir "${config_dir}"

}

pkg_postinst() {
	[[ -d "${config_dir}" ]] && chown -R root:${VMWARE_GROUP} ${config_dir}

	ewarn "In order to run ${product_name}, you have to"
	ewarn "be in the '${VMWARE_GROUP}' group."
}