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() { vmware-1_determine_product() {
# Set the product category, and the category options # Set the product category, and the category options
shortname=$(echo ${PN} | cut -d- -f2-) shortname=$(echo ${PN} | cut -d- -f2-)
einfo "${shortname}"
case "${shortname}" in case "${shortname}" in
workstation|server|player) workstation|server|player)
product="vmware" product="vmware"

View File

@ -2,19 +2,77 @@
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: $ # $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. # of the common components across the multiple packages.
# Only one package per "product" is allowed to be installed at any given time. # Only one package per "product" is allowed to be installed at any given time.
inherit pax-utils eutils 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" DEPEND="x11-misc/shared-mime-info"
export ANY_ANY="vmware-any-any-update115" vmware-2_determine_product
#export TOOLS_ANY="vmware-tools-any-update1"
export VMWARE_GROUP=${VMWARE_GROUP:-vmware} export VMWARE_GROUP=${VMWARE_GROUP:-vmware}
export VMWARE_INSTALL_DIR=/opt/${PN//-//} export VMWARE_INSTALL_DIR=/opt/${PN//-//}
@ -27,7 +85,6 @@ vmware-2_create_initd() {
} }
vmware-2_run_questions() { vmware-2_run_questions() {
vmware-2_determine_product
# Questions: # Questions:
einfo "Adding answers to ${config_dir}/locations" einfo "Adding answers to ${config_dir}/locations"
locations="${D}${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 LIBDIR ${VMWARE_INSTALL_DIR}/lib" >> ${locations}
echo "answer MANDIR ${VMWARE_INSTALL_DIR}/man" >> ${locations} echo "answer MANDIR ${VMWARE_INSTALL_DIR}/man" >> ${locations}
echo "answer DOCDIR ${VMWARE_INSTALL_DIR}/doc" >> ${locations} echo "answer DOCDIR ${VMWARE_INSTALL_DIR}/doc" >> ${locations}
if [ "${product}" == "vmware" -o "${product}" == "vmware-tools" ] if [ "${product}" == "vmware" ]
then then
echo "answer SBINDIR ${VMWARE_INSTALL_DIR}/sbin" >> ${locations} echo "answer SBINDIR ${VMWARE_INSTALL_DIR}/sbin" >> ${locations}
echo "answer RUN_CONFIGURATOR no" >> ${locations} echo "answer RUN_CONFIGURATOR no" >> ${locations}
@ -44,87 +101,37 @@ vmware-2_run_questions() {
fi 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_pkg_setup() {
vmware-2_determine_product [ -z "${product}" ] && vmware-2_determine_product
} }
vmware-2_src_unpack() { vmware-2_src_unpack() {
vmware-2_determine_product if [[ -n ${VM_SRC} ]]
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}" ]]
then then
if [[ -e "${CDROM_ROOT}"/${MY_P}.tar.gz ]] unpack ${VM_SRC}
then
tar xzf "${CDROM_ROOT}"/${MY_P}.tar.gz
else
unpack "${MY_P}".tar.gz
fi fi
if [[ -n ${VM_SRC64} ]]
if [[ -n "${ANY_ANY}" ]]
then then
unpack "${ANY_ANY}".tar.gz unpack ${VM_SRC64}
# Move the relevant ANY_ANY files now, so that they can be patched later... fi
mv -f "${ANY_ANY}"/services.sh "${S}"/installer/services.sh if [ -n "${VM_SRC_EXTRA}" ]
# We should be able to get rid of this eventually, then
# since we'll be using vmware-modules in future... for a in ${VM_SRC_EXTRA}
[[ "${product}" == "vmware" ]] && \ do
mv -f "${ANY_ANY}"/*.tar "${S}"/lib/modules/source 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 ]] && \ [[ -e lib/bin/vmware ]] && \
chmod 755 lib/bin/vmware chmod 755 lib/bin/vmware
[[ -e bin/vmnet-bridge ]] && \ [[ -e bin/vmnet-bridge ]] && \
@ -133,15 +140,6 @@ vmware-2_src_unpack() {
chmod 755 lib/bin/vmware-vmx chmod 755 lib/bin/vmware-vmx
[[ -e lib/bin-debug/vmware-vmx ]] && \ [[ -e lib/bin-debug/vmware-vmx ]] && \
chmod 755 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 # Remove PAX MPROTECT flag from all applicable files in /bin, /sbin for
# the vmware package only (since modules, tools and console should not # the vmware package only (since modules, tools and console should not
@ -151,30 +149,11 @@ vmware-2_src_unpack() {
# Run through any patches that might need to be applied # Run through any patches that might need to be applied
cd "${S}" cd "${S}"
if [[ -d "${FILESDIR}/${PV}" ]] if [[ -d "${WORKDIR}/patches" ]]
then then
EPATCH_FORCE="yes"
EPATCH_SUFFIX="patch" EPATCH_SUFFIX="patch"
epatch "${FILESDIR}"/${PV} epatch "${WORKDIR}"/patches
fi
if [[ -n "${PATCHES}" ]]
then
for patch in ${PATCHES}
do
epatch "${FILESDIR}"/${patch}
done
fi
# Unpack our new libs
for a in ${A}
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
done
fi fi
} }
@ -213,21 +192,6 @@ vmware-2_src_install() {
fi fi
cd "${S}" 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. # We loop through our directories and copy everything to our system.
for x in bin lib sbin for x in bin lib sbin
do do
@ -300,7 +264,7 @@ vmware-2_src_install() {
# Everything after this point will hopefully go away once we can rid # Everything after this point will hopefully go away once we can rid
# ourselves of the evil perl configuration scripts. # ourselves of the evil perl configuration scripts.
if [ "${product}" == "vmware" -o "${product}" == "vmware-tools" ] if [ "${product}" == "vmware" ]
then then
# We have to create a bunch of rc directories for the init script # 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" elog "After configuring, run ${PN} to launch"
fi fi
echo echo
if [ "${product}" == "vmware" -o "${product}" == "vmware-tools" ] if [ "${product}" == "vmware" ]
then then
elog "Also note that when you reboot you should run:" elog "Also note that when you reboot you should run:"
elog " /etc/init.d/${product} start" elog " /etc/init.d/${product} start"
@ -414,3 +378,106 @@ vmware-2_pkg_postrm() {
echo echo
fi 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) open-vm-modules)
# the split into SRC and S is required for compile # the split into SRC and S is required for compile
# the sources of the modules are spread across the package # 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/" HOMEPAGE="http://open-vm-tools.sourceforge.net/"
SRC="${WORKDIR}"/open-vm-tools-${PV/_p/-} SRC="${WORKDIR}"/${MY_P}
S="${SRC}/modules/linux" S="${SRC}/modules/linux"
;; ;;
*) *)