# $Header: /magellan-cvs/smage/vmware-workstation/vmware-workstation-6.0.0.45731-r2.smage2,v 1.1 2007-06-30 19:47:47 niro Exp $ PNAME="vmware-server" PVER="1.0.3.44356" PBUILD="r1" PCATEGORIE="app-emulation" STATE="unstable" DESCRIPTION="" HOMEPAGE="http://www.vmware.com" DEPEND=">= virtual/glibc >= virtual/x11 >= dev-lang/perl-5 >= virtual/kernel-sources >= sys-apps/pciutils-2.1.11" # fetch it at http://download3.vmware.com/software/vmserver SRCFILE="VMware-server-${PVER:0:5}-${PVER##*.}.tar.gz" SRCDIR="${BUILDDIR}/vmware-server-distrib" # fetch'em at http://ftp.cvut.cz/vmware/ DRIVERS_VER=109 DRIVERS_DIR="vmware-any-any-update${DRIVERS_VER}" DRIVERS_TAR="${DRIVERS_DIR}.tar.gz" sminclude mtools SRC_URI=( http://download3.vmware.com/software/vmserver/${SRCFILE} http://ftp.cvut.cz/vmware/${DRIVERS_TAR} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/${DRIVERS_TAR} mirror://${PNAME}/vmware.rc6 mirror://${PNAME}/vmware.envd ) src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # install updated kernel modules munpack ${DRIVERS_TAR} ${SRCDIR} || die mv -f ${DRIVERS_DIR}/*.tar ${SRCDIR}/lib/modules/source/ || die cd ${SRCDIR}/${DRIVERS_DIR} chmod 0755 ./update || die chmod 0755 ../lib/bin/vmware || die chmod 0755 ../bin/vmnet-bridge || die chmod 0755 ../lib/bin/vmware-vmx || die chmod 0755 ../lib/bin-debug/vmware-vmx || die # vmware any93 doesn't patch anything #./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 } src_install() { cd ${SRCDIR} # needed directories minstalldir /etc/udev/rules.d || die minstalldir /usr/bin || die minstalldir /opt/vmware || die # This is to fix a problem where if someone merges vmware and then # before configuring vmware they upgrade or re-merge the vmware # package which would rmdir the /etc/vmware/init.d/rc?.d directories. mkeepdir /etc/vmware/init.d/rc0.d || die mkeepdir /etc/vmware/init.d/rc1.d || die mkeepdir /etc/vmware/init.d/rc2.d || die mkeepdir /etc/vmware/init.d/rc3.d || die mkeepdir /etc/vmware/init.d/rc4.d || die mkeepdir /etc/vmware/init.d/rc5.d || die mkeepdir /etc/vmware/init.d/rc6.d || die # install all files cp -a bin ${BINDIR}/opt/vmware/ || die cp -dr lib ${BINDIR}/opt/vmware/ || die cp -a sbin ${BINDIR}/opt/vmware/ || die # remove precompiled kernel modules (none of them matches our kernels) rm -rf ${BINDIR}/opt/vmware/lib/modules/binary || die # needed config files cp -a etc/* ${BINDIR}/etc/vmware/ || die cp -a installer/services.sh ${BINDIR}/etc/vmware/init.d/vmware || die # create a symlink to /usr/bin ln -snf /opt/vmware/bin/vmware ${BINDIR}/usr/bin/vmware || die # install docs and man pages cp -a doc ${BINDIR}/opt/vmware/ || die cp -a man ${BINDIR}/opt/vmware/ || die # install missing EULA if [[ ! -f ${BINDIR}/opt/vmware/lib/share/EULA.txt ]] then minstallfile doc/EULA /opt/vmware/lib/share/EULA.txt || die fi # vmware enviroment minstallenv vmware.envd 90vmware || die # install our initscript minstallrc vmware.rc6 vmware || die # udev rules echo 'KERNEL=="vmmon*", MODE=0660' > \ ${BINDIR}/etc/udev/rules.d/60-vmware.rules || die # fix all permissions sed -i 's/mknod -m 600/mknod -m 0660/' ${BINDIR}/etc/vmware/init.d/vmware || die chown -R root:root ${BINDIR} || die chmod u+s ${BINDIR}/opt/vmware/bin/vmware || die chmod u+s ${BINDIR}/opt/vmware/bin/vmware-ping || die chmod u+s ${BINDIR}/opt/vmware/lib/bin/vmware-vmx || die # Questions: echo "Adding answers to /etc/vmware/locations" locations="${BINDIR}/etc/vmware/locations" echo "answer BINDIR /opt/vmware/bin" >> ${locations} || die echo "answer LIBDIR /opt/vmware/lib" >> ${locations} || die echo "answer MANDIR /opt/vmware/man" >> ${locations} || die echo "answer DOCDIR /opt/vmware/doc" >> ${locations} || die echo "answer SBINDIR /opt/vmware/sbin" >> ${locations} || die echo "answer RUN_CONFIGURATOR no" >> ${locations} || die echo "answer INITDIR /etc/vmware/init.d" >> ${locations} || die echo "answer INITSCRIPTSDIR /etc/vmware/init.d" >> ${locations} || die } preinstall() { # This must be done after the install to get the mtimes on each file # right. This perl snippet gets the /etc/vmware/locations file code: # perl -e "@a = stat('bin/vmware'); print \$a[9]" # The above perl line and the find line below output the same thing. # I would think the find line is faster to execute. # find /opt/vmware/bin/vmware -printf %T@ D="${BUILDDIR}/${PKGNAME}/binfiles" echo "Generating /etc/vmware/locations file." d=`echo ${D} | wc -c` for x in `find ${D}/opt/vmware ${D}/etc/vmware` ; do x="`echo ${x} | cut -c ${d}-`" if [ -d ${D}/${x} ] ; then echo "directory ${x}" >> ${D}/etc/vmware/locations else echo -n "file ${x}" >> ${D}/etc/vmware/locations if [ "${x}" == "/etc/vmware/locations" ] ; then echo "" >> ${D}/etc/vmware/locations elif [ "${x}" == "/etc/vmware/not_configured" ] ; then echo "" >> ${D}/etc/vmware/locations else echo -n " " >> ${D}/etc/vmware/locations #perl -e "@a = stat('${D}${x}'); print \$a[9]" >> ${D}/etc/vmware/locations #find ${D}${x} -printf %T@ >> ${D}/etc/vmware/locations # we are using the .mtime from the package as reference for all files later, # so we must use it here to, to get rid of the not_configured file find ${BUILDDIR}/${PKGNAME}/.mtime -printf %T@ >> ${D}/etc/vmware/locations echo "" >> ${D}/etc/vmware/locations fi fi done } postinstall() { # This is to fix the problem where the not_configured file doesn't get # removed when the configuration is run. This doesn't remove the file # It just tells the vmware-config.pl script it can delete it. echo "Updating ${MROOT}/etc/vmware/locations" for x in ${MROOT}/etc/vmware/._cfg????_locations ; do if [ -f $x ] ; then cat $x >> ${MROOT}/etc/vmware/locations rm $x fi done echo echo "You need to run /opt/vmware/bin/vmware-config.pl to complete the install." echo echo "For VMware Add-Ons just visit" echo "http://www.vmware.com/download/downloadaddons.html" echo echo "After configuring, type 'vmware' to launch." echo }