| 1 |
# Copyright 1999-2010 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-emulation/vmware-server/vmware-server-2.0.1.156745-r2.ebuild,v 1.2 2009/07/08 20:17:28 vadimk Exp $ |
| 4 |
|
| 5 |
# Unlike many other binary packages the user doesn't need to agree to a licence |
| 6 |
# to download VMWare. The agreeing to a licence is part of the configure step |
| 7 |
# which the user must run manually. |
| 8 |
|
| 9 |
EAPI="2" |
| 10 |
|
| 11 |
inherit eutils pam pax-utils versionator |
| 12 |
|
| 13 |
MY_PV=$(replace_version_separator 3 '-' ) |
| 14 |
MY_PN="VMware-server-${MY_PV}" |
| 15 |
|
| 16 |
DESCRIPTION="VMware Server for Linux" |
| 17 |
HOMEPAGE="http://www.vmware.com/" |
| 18 |
DOWNLOAD_URL="http://downloads.vmware.com/d/info/datacenter_downloads/vmware_server/2_0" |
| 19 |
SRC_URI=" x86? ( mirror://vmware/software/vmserver/${MY_PN}.i386.tar.gz ) |
| 20 |
amd64? ( mirror://vmware/software/vmserver/${MY_PN}.x86_64.tar.gz ) " |
| 21 |
|
| 22 |
LICENSE="vmware" |
| 23 |
IUSE="" |
| 24 |
SLOT="0" |
| 25 |
KEYWORDS="-* ~x86 ~amd64" |
| 26 |
RESTRICT="fetch strip" |
| 27 |
|
| 28 |
CDEPEND=" |
| 29 |
>=dev-lang/perl-5 |
| 30 |
>=sys-libs/glibc-2.3.5 |
| 31 |
sys-apps/pciutils" |
| 32 |
DEPEND="${CDEPEND} |
| 33 |
sys-apps/findutils |
| 34 |
x11-misc/shared-mime-info |
| 35 |
virtual/os-headers" |
| 36 |
# vmware-server should not use virtual/libc as this is a |
| 37 |
# precompiled binary package thats linked to glibc. |
| 38 |
RDEPEND="${CDEPEND} |
| 39 |
~app-emulation/vmware-modules-1.0.0.24 |
| 40 |
dev-libs/expat |
| 41 |
dev-libs/glib |
| 42 |
dev-libs/libxml2 |
| 43 |
sys-apps/hal |
| 44 |
sys-fs/fuse |
| 45 |
sys-libs/zlib |
| 46 |
virtual/pam |
| 47 |
x11-libs/libICE |
| 48 |
x11-libs/libSM |
| 49 |
x11-libs/libX11 |
| 50 |
x11-libs/libXau |
| 51 |
x11-libs/libXdmcp |
| 52 |
x11-libs/libXext |
| 53 |
x11-libs/libXft |
| 54 |
x11-libs/libXt |
| 55 |
x11-libs/libXtst |
| 56 |
x11-misc/xdg-utils |
| 57 |
!<sys-apps/dbus-0.62 |
| 58 |
!app-emulation/vmware-player |
| 59 |
!app-emulation/vmware-workstation |
| 60 |
" |
| 61 |
|
| 62 |
PDEPEND="app-emulation/vmware-vix" |
| 63 |
|
| 64 |
S=${WORKDIR}/vmware-server-distrib |
| 65 |
|
| 66 |
pkg_setup() { |
| 67 |
if use x86; then |
| 68 |
MY_P="${MY_PN}.i386" |
| 69 |
elif use amd64; then |
| 70 |
MY_P="${MY_PN}.x86_64" |
| 71 |
fi |
| 72 |
} |
| 73 |
|
| 74 |
pkg_nofetch() { |
| 75 |
if use x86; then |
| 76 |
MY_P="${MY_PN}.i386" |
| 77 |
elif use amd64; then |
| 78 |
MY_P="${MY_PN}.x86_64" |
| 79 |
fi |
| 80 |
|
| 81 |
einfo "Please download the ${MY_P}.bundle from" |
| 82 |
einfo "${DOWNLOAD_URL}" |
| 83 |
einfo "and place it in ${DISTDIR}" |
| 84 |
} |
| 85 |
|
| 86 |
src_prepare() { |
| 87 |
VMWARE_GROUP=${VMWARE_GROUP:-vmware} |
| 88 |
VMWARE_INSTALL_DIR=/opt/${PN//-//} |
| 89 |
|
| 90 |
shortname="wgs" |
| 91 |
product="vmware" |
| 92 |
config_program="vmware-config.pl" |
| 93 |
config_dir="/etc/vmware" |
| 94 |
product_name="VMware Server 2" |
| 95 |
|
| 96 |
enewgroup ${VMWARE_GROUP} |
| 97 |
|
| 98 |
# Remove PAX MPROTECT flag from all applicable files in /bin, /sbin for |
| 99 |
# the vmware package only (since modules, tools and console should not |
| 100 |
# need to generate code on the fly in memory). |
| 101 |
pax-mark -m $(list-paxables "${S}"/{bin{,-debug},sbin}/{vmware-serverd,vmware-vmx}) |
| 102 |
|
| 103 |
EPATCH_SOURCE="${FILESDIR}"/${PV} EPATCH_SUFFIX="patch" epatch |
| 104 |
|
| 105 |
# Proper lsmod |
| 106 |
sed -i -e "s:/sbin/lsmod:/bin/lsmod:" "${S}"/installer/services.sh || die "sed" |
| 107 |
sed -i -e "s:/sbin/lsmod:/bin/lsmod:" "${S}"/lib/net-services.sh || die "sed" |
| 108 |
|
| 109 |
# Set the name |
| 110 |
sed -i -e "s:%LONGNAME%:${product_name}:" "${S}"/installer/services.sh || die "sed" |
| 111 |
sed -i -e "s:%SHORTNAME%:${shortname}:" "${S}"/installer/services.sh || die "sed" |
| 112 |
|
| 113 |
# We won't want any perl scripts from VMware once we've finally got all |
| 114 |
# of the configuration done, but for now, they're necessary. |
| 115 |
#rm -f *.pl bin/*.pl |
| 116 |
rm -f *.pl |
| 117 |
rm -f etc/installer.sh |
| 118 |
|
| 119 |
# Since with Gentoo we compile everthing it doesn't make sense to keep |
| 120 |
# the precompiled modules arround. Saves about 4 megs of disk space too. |
| 121 |
rm -rf "${S}"/lib/modules/binary |
| 122 |
# We also don't need to keep the icons around, or do we? |
| 123 |
#rm -rf ${S}/lib/share/icons |
| 124 |
|
| 125 |
rm -rf "${S}"/etc/pam.d/ |
| 126 |
sed -i -e "s:configure_wgs_pam_d():#&:" "${S}"/bin/vmware-config.pl || die "sed pam_d" |
| 127 |
} |
| 128 |
|
| 129 |
src_install() { |
| 130 |
# We loop through our directories and copy everything to our system. |
| 131 |
for x in bin lib sbin |
| 132 |
do |
| 133 |
if [[ -e "${S}/${x}" ]] |
| 134 |
then |
| 135 |
dodir "${VMWARE_INSTALL_DIR}"/${x} |
| 136 |
cp -pPR "${S}"/${x}/* "${D}""${VMWARE_INSTALL_DIR}"/${x} \ |
| 137 |
|| die "copying ${x}" |
| 138 |
fi |
| 139 |
done |
| 140 |
|
| 141 |
# Bug 282213 |
| 142 |
mv "${D}"/"${VMWARE_INSTALL_DIR}"/lib/lib/libpng12.so.0/libpng12.so.0 \ |
| 143 |
"${D}"/"${VMWARE_INSTALL_DIR}"/lib/lib/libpng12.so.0/libpng12.so.0.old |
| 144 |
dosym /usr/lib/libpng12.so.0 "${VMWARE_INSTALL_DIR}"/lib/lib/libpng12.so.0/libpng12.so.0 |
| 145 |
|
| 146 |
# Bug 292771 |
| 147 |
mv "${D}"/"${VMWARE_INSTALL_DIR}"/lib/lib/libexpat.so.0/libexpat.so.0 \ |
| 148 |
"${D}"/"${VMWARE_INSTALL_DIR}"/lib/lib/libexpat.so.0/libexpat.so.0.old |
| 149 |
dosym /usr/lib/libexpat.so.1 "${VMWARE_INSTALL_DIR}"/lib/lib/libexpat.so.0/libexpat.so.0 |
| 150 |
mv "${D}"/"${VMWARE_INSTALL_DIR}"/lib/lib/libxml2.so.2/libxml2.so.2 \ |
| 151 |
"${D}"/"${VMWARE_INSTALL_DIR}"/lib/lib/libxml2.so.2/libxml2.so.2.old |
| 152 |
dosym /usr/lib/libxml2.so.2 "${VMWARE_INSTALL_DIR}"/lib/lib/libxml2.so.2/libxml2.so.2 |
| 153 |
|
| 154 |
# If we have an /etc directory, we copy it. |
| 155 |
if [[ -e "${S}/etc" ]] |
| 156 |
then |
| 157 |
dodir "${config_dir}" |
| 158 |
cp -pPR "${S}"/etc/* "${D}""${config_dir}" |
| 159 |
fowners root:${VMWARE_GROUP} "${config_dir}" |
| 160 |
fperms 770 "${config_dir}" |
| 161 |
fi |
| 162 |
|
| 163 |
# If we have any helper files, we install them. First, we check for an |
| 164 |
# init script. |
| 165 |
if [[ -e "${FILESDIR}/${PN}.rc" ]] |
| 166 |
then |
| 167 |
newinitd "${FILESDIR}"/${PN}.rc ${product} || die "newinitd" |
| 168 |
fi |
| 169 |
# Then we check for an environment file. |
| 170 |
if [[ -e "${FILESDIR}/90${PN}" ]] |
| 171 |
then |
| 172 |
doenvd "${FILESDIR}"/90${PN} || die "doenvd" |
| 173 |
fi |
| 174 |
# Last, we check for any mime files. |
| 175 |
if [[ -e "${FILESDIR}/${PN}.xml" ]] |
| 176 |
then |
| 177 |
insinto /usr/share/mime/packages |
| 178 |
doins "${FILESDIR}"/${PN}.xml || die "mimetypes" |
| 179 |
fi |
| 180 |
|
| 181 |
# Blame bug #91191 for this one. |
| 182 |
if [[ -e doc/EULA ]] |
| 183 |
then |
| 184 |
insinto "${VMWARE_INSTALL_DIR}"/doc |
| 185 |
doins doc/EULA || die "copying EULA" |
| 186 |
fi |
| 187 |
|
| 188 |
# Do we have vmware-ping/vmware-vmx? If so, make them setuid. |
| 189 |
for p in /bin/vmware-ping /lib/bin/vmware-vmx /lib/bin-debug/vmware-vmx /lib/bin/vmware-vmx-debug /sbin/vmware-authd; |
| 190 |
do |
| 191 |
if [ -x "${D}${VMWARE_INSTALL_DIR}${p}" ] |
| 192 |
then |
| 193 |
fowners root:${VMWARE_GROUP} "${VMWARE_INSTALL_DIR}"${p} |
| 194 |
fperms 4750 "${VMWARE_INSTALL_DIR}"${p} |
| 195 |
fi |
| 196 |
done |
| 197 |
|
| 198 |
# This removed the user/group warnings |
| 199 |
# But also broke vmware-server with FEATURES="userpriv" since it removes |
| 200 |
# the set-UID bit |
| 201 |
#chown -R root:${VMWARE_GROUP} ${D} || die |
| 202 |
|
| 203 |
# We like desktop icons. |
| 204 |
# TODO: Fix up the icon creation, across the board. |
| 205 |
#make_desktop_entry ${PN} "${product_name}" ${PN}.png |
| 206 |
|
| 207 |
# Now, we copy in our services.sh file |
| 208 |
exeinto "${config_dir}"/init.d |
| 209 |
newexe installer/services.sh ${product} || die "services.sh" |
| 210 |
|
| 211 |
newinitd "${FILESDIR}/vmware-server-2.rc" vmware |
| 212 |
|
| 213 |
# startup symlinks |
| 214 |
dosym ${config_dir}/init.d/${product} ${config_dir}/init.d/vmware-autostart |
| 215 |
dosym ${config_dir}/init.d/${product} ${config_dir}/init.d/vmware-core |
| 216 |
dosym ${config_dir}/init.d/${product} ${config_dir}/init.d/vmware-mgmt |
| 217 |
|
| 218 |
# pam |
| 219 |
pamd_mimic_system vmware-authd auth account |
| 220 |
|
| 221 |
# Man pages and docs |
| 222 |
dodoc doc/* |
| 223 |
doman man/man1/* |
| 224 |
|
| 225 |
# VMware authorization service |
| 226 |
insinto ${config_dir}/hostd |
| 227 |
doins "${FILESDIR}/authorization.xml" |
| 228 |
|
| 229 |
# Finally, we run the "Questions" |
| 230 |
einfo "Adding answers to ${config_dir}/locations" |
| 231 |
locations="${D}${config_dir}/locations" |
| 232 |
echo "answer BINDIR ${VMWARE_INSTALL_DIR}/bin" >> ${locations} |
| 233 |
echo "answer LIBDIR ${VMWARE_INSTALL_DIR}/lib" >> ${locations} |
| 234 |
echo "answer MANDIR ${VMWARE_INSTALL_DIR}/man" >> ${locations} |
| 235 |
echo "answer DOCDIR ${VMWARE_INSTALL_DIR}/doc" >> ${locations} |
| 236 |
echo "answer SBINDIR ${VMWARE_INSTALL_DIR}/sbin" >> ${locations} |
| 237 |
echo "answer RUN_CONFIGURATOR no" >> ${locations} |
| 238 |
echo "answer INITDIR ${config_dir}/init.d" >> ${locations} |
| 239 |
echo "answer INITSCRIPTSDIR ${config_dir}/init.d" >> ${locations} |
| 240 |
echo "answer VMCI_CONFED yes" >> ${locations} |
| 241 |
echo "answer VSOCK_CONFED yes" >> ${locations} |
| 242 |
} |
| 243 |
|
| 244 |
pkg_config() { |
| 245 |
einfo "Running ${VMWARE_INSTALL_DIR}/bin/vmware-config.pl" |
| 246 |
"${VMWARE_INSTALL_DIR}/bin/vmware-config.pl" |
| 247 |
} |
| 248 |
|
| 249 |
pkg_preinst() { |
| 250 |
# This must be done after the install to get the mtimes on each file |
| 251 |
# right. |
| 252 |
|
| 253 |
#Note: it's a bit weird to use ${D} in a preinst script but it should work |
| 254 |
#(drobbins, 1 Feb 2002) |
| 255 |
|
| 256 |
einfo "Generating ${config_dir}/locations file." |
| 257 |
d=`echo ${D} | wc -c` |
| 258 |
for x in `find ${D}${VMWARE_INSTALL_DIR} ${D}${config_dir}` ; do |
| 259 |
x="`echo ${x} | cut -c ${d}-`" |
| 260 |
if [ -d "${D}/${x}" ] ; then |
| 261 |
echo "directory ${x}" >> "${D}${config_dir}"/locations |
| 262 |
else |
| 263 |
echo -n "file ${x}" >> "${D}${config_dir}"/locations |
| 264 |
if [ "${x}" == "${config_dir}/locations" ] ; then |
| 265 |
echo "" >> "${D}${config_dir}"/locations |
| 266 |
elif [ "${x}" == "${config_dir}/not_configured" ] ; then |
| 267 |
echo "" >> "${D}${config_dir}"/locations |
| 268 |
else |
| 269 |
echo -n " " >> "${D}${config_dir}"/locations |
| 270 |
find "${D}${x}" -printf %T@ >> "${D}${config_dir}"/locations |
| 271 |
echo "" >> "${D}${config_dir}"/locations |
| 272 |
fi |
| 273 |
fi |
| 274 |
done |
| 275 |
} |
| 276 |
|
| 277 |
pkg_postinst() { |
| 278 |
update-mime-database /usr/share/mime |
| 279 |
[[ -d "${config_dir}" ]] && chown -R root:${VMWARE_GROUP} ${config_dir} |
| 280 |
|
| 281 |
# This is to fix the problem where the not_configured file doesn't get |
| 282 |
# removed when the configuration is run. This doesn't remove the file |
| 283 |
# It just tells the vmware-config.pl script it can delete it. |
| 284 |
einfo "Updating ${config_dir}/locations" |
| 285 |
for x in "${config_dir}"/._cfg????_locations ; do |
| 286 |
if [ -f $x ] ; then |
| 287 |
cat $x >> "${config_dir}"/locations |
| 288 |
rm $x |
| 289 |
fi |
| 290 |
done |
| 291 |
|
| 292 |
ewarn "Use " |
| 293 |
ewarn " emerge vmware-server --config" |
| 294 |
ewarn "to configure your installation of ${product_name}." |
| 295 |
|
| 296 |
ewarn "In order to run ${product_name}, you have to" |
| 297 |
ewarn "be in the '${VMWARE_GROUP}' group." |
| 298 |
|
| 299 |
#ewarn "By default xinetd only allows connections from localhost" |
| 300 |
#ewarn "To allow external users access to vmware-server you must edit" |
| 301 |
#ewarn " /etc/xinetd.d/vmware-authd" |
| 302 |
#ewarn "and specify a new 'only_from' line" |
| 303 |
|
| 304 |
ewarn "VMWare Server also has issues when running on a JFS filesystem. For more" |
| 305 |
ewarn "information see http://bugs.gentoo.org/show_bug.cgi?id=122500#c94" |
| 306 |
} |
| 307 |
|
| 308 |
pkg_prerm() { |
| 309 |
einfo "Stopping ${product_name} for safe unmerge" |
| 310 |
/etc/init.d/vmware stop |
| 311 |
} |
| 312 |
|
| 313 |
pkg_postrm() { |
| 314 |
if ! has_version app-emulation/${PN}; then |
| 315 |
elog "To remove all traces of ${product} you will need to remove the files" |
| 316 |
elog "in ${config_dir} and /etc/init.d/${product}." |
| 317 |
elog "If the vmware-modules package is installed, you may no longer need it." |
| 318 |
fi |
| 319 |
} |