update mod eclass

git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/vmware@1752 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
geos_one 2009-12-26 08:30:35 +00:00
parent c3ae0c032b
commit f19201955f
3 changed files with 221 additions and 148 deletions

View File

@ -21,6 +21,7 @@ EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_setup src_prepare src_install src_
vmware-1_determine_product() {
# Set the product category, and the category options
shortname=$(echo ${PN} | cut -d- -f2-)
einfo "${shortname}"
case "${shortname}" in
workstation|server|player)
product="vmware"

View File

@ -2,19 +2,77 @@
# Distributed under the terms of the GNU General Public License v2
# $Header: $
# This eclass is for all vmware-2-* ebuilds in the tree and should contain all
# By default this eclasses wants eapi 2 which might be redefinable to newer
# versions.
case ${EAPI:-0} in
2) : ;;
*) die "No way! EAPI other than 2 is not supported for now." ;;
esac
# This eclass is for all vmware-1-* ebuilds in the tree and should contain all
# of the common components across the multiple packages.
# Only one package per "product" is allowed to be installed at any given time.
inherit pax-utils eutils
EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_setup src_install src_unpack pkg_postrm
EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_setup src_prepare src_install src_unpack pkg_postrm pkg_nofetch
vmware-2_determine_product() {
# Set the product category, and the category options
shortname=$(echo ${PN} | cut -d- -f2-)
einfo "${shortname}"
case "${shortname}" in
workstation|player|server)
product="vmware"
config_program="vmware-config.pl"
;;
server-console)
product="vmware-console"
config_program="vmware-config-console.pl"
;;
*)
product="unknown"
;;
esac
config_dir="/etc/${product}"
# Set per package options
case "${shortname}" in
workstation)
FULL_NAME="Workstation"
SRC_URI_ROOT="mirror://vmware/software/wkst/"
HOMEPAGE="http://www.vmware.com/download/ws/"
RESTRICT="fetch strip"
;;
player)
FULL_NAME="Player"
SRC_URI_ROOT="mirror://vmware/software/vmplayer/"
HOMEPAGE="http://www.vmware.com/download/player/"
;;
server)
FULL_NAME="Server"
SRC_URI_ROOT="mirror://vmware/software/vmserver/"
HOMEPAGE="http://www.vmware.com/download/server/"
;;
server-console)
FULL_NAME="Server Console"
SRC_URI_ROOT="mirror://vmware/software/vmserver/"
HOMEPAGE="http://www.vmware.com/download/server/"
config_program="vmware-config-server-console.pl"
config_dir="/etc/${PN}"
;;
esac
}
DESCRIPTION="VMware ${FULL_NAME} for Linux"
LICENSE="vmware"
RESTRICT="strip mirror"
SLOT="0"
DEPEND="x11-misc/shared-mime-info"
export ANY_ANY="vmware-any-any-update115"
#export TOOLS_ANY="vmware-tools-any-update1"
vmware-2_determine_product
export VMWARE_GROUP=${VMWARE_GROUP:-vmware}
export VMWARE_INSTALL_DIR=/opt/${PN//-//}
@ -27,7 +85,6 @@ vmware-2_create_initd() {
}
vmware-2_run_questions() {
vmware-2_determine_product
# Questions:
einfo "Adding answers to ${config_dir}/locations"
locations="${D}${config_dir}/locations"
@ -35,7 +92,7 @@ vmware-2_run_questions() {
echo "answer LIBDIR ${VMWARE_INSTALL_DIR}/lib" >> ${locations}
echo "answer MANDIR ${VMWARE_INSTALL_DIR}/man" >> ${locations}
echo "answer DOCDIR ${VMWARE_INSTALL_DIR}/doc" >> ${locations}
if [ "${product}" == "vmware" -o "${product}" == "vmware-tools" ]
if [ "${product}" == "vmware" ]
then
echo "answer SBINDIR ${VMWARE_INSTALL_DIR}/sbin" >> ${locations}
echo "answer RUN_CONFIGURATOR no" >> ${locations}
@ -44,138 +101,60 @@ vmware-2_run_questions() {
fi
}
vmware-2_determine_product() {
# Set the product category, and the category options
shortname=$(echo ${PN} | cut -d- -f2-)
case "${shortname}" in
workstation|server|player)
product="vmware"
config_program="vmware-config.pl"
;;
server-console|esx-console|gsx-console)
product="vmware-console"
config_program="vmware-config-console.pl"
;;
vm-tools)
product="vmware-tools"
config_program="vmware-config-tools.pl"
;;
*)
product="unknown"
;;
esac
config_dir="/etc/${product}"
# Set per package options
case "${shortname}" in
workstation)
FULL_NAME="Workstation"
;;
player)
FULL_NAME="Player"
;;
converter)
FULL_NAME="Converter"
config_dir="/etc/${PN}"
;;
server)
FULL_NAME="Server"
;;
server-console)
FULL_NAME="Server Console"
config_program="vmware-config-server-console.pl"
config_dir="/etc/${PN}"
;;
esx-console)
FULL_NAME="ESX Console"
;;
esac
}
vmware-2_pkg_setup() {
vmware-2_determine_product
[ -z "${product}" ] && vmware-2_determine_product
}
vmware-2_src_unpack() {
vmware-2_determine_product
case "${product}" in
vmware-tools)
# We grab our tarball from "CD"
einfo "You will need ${TARBALL} from the VMware installation."
einfo "Select VM->Install VMware Tools from VMware's menu."
cdrom_get_cds ${TARBALL}
;;
esac
# If there is anything to unpack, at all, then we should be using MY_P.
if [[ -n "${MY_P}" ]]
if [[ -n ${VM_SRC} ]]
then
if [[ -e "${CDROM_ROOT}"/${MY_P}.tar.gz ]]
then
tar xzf "${CDROM_ROOT}"/${MY_P}.tar.gz
else
unpack "${MY_P}".tar.gz
fi
if [[ -n "${ANY_ANY}" ]]
then
unpack "${ANY_ANY}".tar.gz
# Move the relevant ANY_ANY files now, so that they can be patched later...
mv -f "${ANY_ANY}"/services.sh "${S}"/installer/services.sh
# We should be able to get rid of this eventually,
# since we'll be using vmware-modules in future...
[[ "${product}" == "vmware" ]] && \
mv -f "${ANY_ANY}"/*.tar "${S}"/lib/modules/source
[[ -e lib/bin/vmware ]] && \
chmod 755 lib/bin/vmware
[[ -e bin/vmnet-bridge ]] && \
chmod 755 bin/vmnet-bridge
[[ -e lib/bin/vmware-vmx ]] && \
chmod 755 lib/bin/vmware-vmx
[[ -e lib/bin-debug/vmware-vmx ]] && \
chmod 755 lib/bin-debug/vmware-vmx
if [[ "${RUN_UPDATE}" == "yes" ]]
then
cd "${S}"/"${ANY_ANY}"
./update vmware ../lib/bin/vmware || die
./update bridge ../bin/vmnet-bridge || die
./update vmx ../lib/bin/vmware-vmx || die
./update vmxdebug ../lib/bin-debug/vmware-vmx || die
fi
fi
# Remove PAX MPROTECT flag from all applicable files in /bin, /sbin for
# the vmware package only (since modules, tools and console should not
# need to generate code on the fly in memory).
[[ "${product}" == "vmware" ]] && pax-mark -m \
$(list-paxables ${S}/{bin{,-debug},sbin}/{vmware-serverd,vmware-vmx})
# Run through any patches that might need to be applied
cd "${S}"
if [[ -d "${FILESDIR}/${PV}" ]]
then
EPATCH_SUFFIX="patch"
epatch "${FILESDIR}"/${PV}
fi
if [[ -n "${PATCHES}" ]]
then
for patch in ${PATCHES}
do
epatch "${FILESDIR}"/${patch}
done
fi
# Unpack our new libs
for a in ${A}
unpack ${VM_SRC}
fi
if [[ -n ${VM_SRC64} ]]
then
unpack ${VM_SRC64}
fi
if [ -n "${VM_SRC_EXTRA}" ]
then
for a in ${VM_SRC_EXTRA}
do
case ${a} in
vmware-libssl.so.0.9.7l.tar.bz2)
unpack vmware-libssl.so.0.9.7l.tar.bz2
;;
vmware-libcrypto.so.0.9.7l.tar.bz2)
unpack vmware-libcrypto.so.0.9.7l.tar.bz2
;;
esac
unpack ${P/_p/-}-${a}.tar.bz2
done
fi
if [ -n "${VM_SRC_EXTRA64}" ]
then
for a in ${VM_SRC_EXTRA64}
do
unpack ${P/_p/-}-${a}.tar.bz2
done
fi
}
vmware-2_src_prepare() {
[[ -e lib/bin/vmware ]] && \
chmod 755 lib/bin/vmware
[[ -e bin/vmnet-bridge ]] && \
chmod 755 bin/vmnet-bridge
[[ -e lib/bin/vmware-vmx ]] && \
chmod 755 lib/bin/vmware-vmx
[[ -e lib/bin-debug/vmware-vmx ]] && \
chmod 755 lib/bin-debug/vmware-vmx
# Remove PAX MPROTECT flag from all applicable files in /bin, /sbin for
# the vmware package only (since modules, tools and console should not
# need to generate code on the fly in memory).
[[ "${product}" == "vmware" ]] && pax-mark -m \
$(list-paxables ${S}/{bin{,-debug},sbin}/{vmware-serverd,vmware-vmx})
# Run through any patches that might need to be applied
cd "${S}"
if [[ -d "${WORKDIR}/patches" ]]
then
EPATCH_FORCE="yes"
EPATCH_SUFFIX="patch"
epatch "${WORKDIR}"/patches
fi
}
vmware-2_src_install() {
@ -213,21 +192,6 @@ vmware-2_src_install() {
fi
cd "${S}"
# We remove the shipped libssl for bug #148682
if [ -d "${S}"/libssl.so.0.9.7 ]
then
rm -rf "${S}"/lib/lib/libssl.so.0.9.7
# Now, we move in our own
cp -pPR "${S}"/libssl.so.0.9.7 "${S}"/lib/lib
fi
# We remove the shipped libcrypto for bug #148682
if [ -d "${S}"/libcrypto.so.0.9.7 ]
then
rm -rf "${S}"/lib/lib/libcrypto.so.0.9.7
# Now, we move in our own
cp -pPR "${S}"/libcrypto.so.0.9.7 "${S}"/lib/lib
fi
# We loop through our directories and copy everything to our system.
for x in bin lib sbin
do
@ -300,7 +264,7 @@ vmware-2_src_install() {
# Everything after this point will hopefully go away once we can rid
# ourselves of the evil perl configuration scripts.
if [ "${product}" == "vmware" -o "${product}" == "vmware-tools" ]
if [ "${product}" == "vmware" ]
then
# We have to create a bunch of rc directories for the init script
@ -382,7 +346,7 @@ vmware-2_pkg_postinst() {
elog "After configuring, run ${PN} to launch"
fi
echo
if [ "${product}" == "vmware" -o "${product}" == "vmware-tools" ]
if [ "${product}" == "vmware" ]
then
elog "Also note that when you reboot you should run:"
elog " /etc/init.d/${product} start"
@ -414,3 +378,106 @@ vmware-2_pkg_postrm() {
echo
fi
}
vmware-2_pkg_nofetch() {
einfo "This files require you to register at www.vmware.com"
einfo "Please download following files:"
if [ -n "${VM_SRC64}" ]
then
einfo " - ${VM_SRC64} from ${HOMEPAGE}"
else
einfo " - ${VM_SRC} from ${HOMEPAGE}"
fi
if [ -n "${VM_SRC_EXTRA}" ]
then
for a in ${VM_SRC_EXTRA}
do
einfo " - http://ftp.mars.arge.at/vmware/${P/_p/-}-${a}.tar.bz2"
done
fi
if [ -n "${VM_SRC_EXTRA64}" ]
then
for a in ${VM_SRC_EXTRA64}
do
einfo " - http://ftp.mars.arge.at/vmware/${P/_p/-}-${a}.tar.bz2"
done
fi
einfo "and place them in ${DISTDIR}"
}
vmware-2_unbundler_set_offsets() {
# This won't work with non-GNU stat.
FILE_SIZE=`stat -L --format "%s" "$1"`
local offset=$(($FILE_SIZE - 4))
MAGIC_OFFSET=$offset
offset=$(($offset - 4))
CHECKSUM_OFFSET=$offset
offset=$(($offset - 4))
VERSION_OFFSET=$offset
offset=$(($offset - 4))
PREPAYLOAD_OFFSET=$offset
offset=$(($offset - 4))
PREPAYLOAD_SIZE_OFFSET=$offset
offset=$(($offset - 4))
LAUNCHER_SIZE_OFFSET=$offset
offset=$(($offset - 4))
PAYLOAD_OFFSET=$offset
offset=$(($offset - 4))
PAYLOAD_SIZE_OFFSET=$offset
offset=$(($offset - 4))
}
vmware-2_unbundler_set_lengths() {
local file="$1"
if [ ! -s "$file" ]; then
echo "$file does not exist"
exit 1
fi
# XXX: put extraction in its own function
MAGIC_NUMBER=`od -An -t u4 -N 4 -j $MAGIC_OFFSET "$file" | tr -d ' '`
if [ "$MAGIC_NUMBER" != "907380241" ]; then
echo "magic number does not match"
exit 1
fi
LAUNCHER_SIZE=`od -An -t u4 -N 4 -j $LAUNCHER_SIZE_OFFSET "$file" | tr -d ' '`
PAYLOAD_SIZE=`od -An -t u4 -N 4 -j $PAYLOAD_SIZE_OFFSET "$file" | tr -d ' '`
PREPAYLOAD_SIZE=`od -An -t u4 -N 4 -j $PREPAYLOAD_SIZE_OFFSET "$file" | tr -d ' '`
SKIP_BYTES=$(($PREPAYLOAD_SIZE + $LAUNCHER_SIZE))
return 0
}
vmware-2_unbundler() {
unbundler_set_offsets ${ORIGFILE}
unbundler_set_lengths ${ORIGFILE}
echo "Unbundling" ${ORIGFILE}
PREPAYLOAD="prepayload"
PAYLOAD="payload"
# Unpack the pre-payload file
mkdir ${PREPAYLOAD}
cd ${PREPAYLOAD}
dd if="${ORIGFILE}" ibs=$LAUNCHER_SIZE obs=1024 skip=1 | tar -xzf - 2> /dev/null
cd ..
# Unpack the main file
mkdir ${PAYLOAD}
cd ${PAYLOAD}
dd if="${ORIGFILE}" ibs=$SKIP_BYTES obs=1024 skip=1 | tar -xzf - 2> /dev/null
cd ..
}

View File

@ -34,9 +34,14 @@ case ${PN} in
open-vm-modules)
# the split into SRC and S is required for compile
# the sources of the modules are spread across the package
VM_SRC_URI="mirror://sourceforge/open-vm-tools/open-vm-tools-${PV/_p/-}.tar.gz"
MY_DATE="$(get_version_component_range 3)"
MY_BUILD="$(get_version_component_range 4)"
MY_PN="${PN/modules/tools}"
MY_PV="${MY_DATE:0:4}.${MY_DATE:4:2}.${MY_DATE:6:2}-${MY_BUILD}"
MY_P="${MY_PN}-${MY_PV}"
VM_SRC_URI="mirror://sourceforge/open-vm-tools/${MY_P}.tar.gz"
HOMEPAGE="http://open-vm-tools.sourceforge.net/"
SRC="${WORKDIR}"/open-vm-tools-${PV/_p/-}
SRC="${WORKDIR}"/${MY_P}
S="${SRC}/modules/linux"
;;
*)