All pastes #184358 Raw Edit

Mine

public text v1 · immutable
#184358 ·published 2006-09-27 20:44 UTC
rendered paste body
#
# Copyright (c) 2006 rPath, Inc.
# This file is distributed under the terms of the MIT License.
# A copy is available at http://www.rpath.com/permanent/mit-license.html
#

#loadSuperClass('kernelmodulepackage=drivers.rpath.org@rpl:devel')
class VMwareTools(CPackageRecipe):
    buildRequires = ['perl:lib', 'perl:runtime', 'make:runtime', 'gcc:runtime',
                     'chkconfig:runtime', 'findutils:runtime']

    name = 'VMwareTools'
    version = '5.5.2'

    def setup(r):
        r.macros.kver = os.uname()[2]
        r.macros.buildrel = "29772"

        r.addArchive('%(name)s-%(version)s-%(buildrel)s.tar.gz')
        r.addPatch('rootperm.patch', level = 2)
        r.addSource('chkconfig.patch')
        r.Replace("'/etc/vmware-tools'",
                  "'%(destdir)s/%(sysconfdir)s/vmware-tools'",
                  'bin/vmware-uninstall-tools.pl')

        r.MakeDirs('/etc/vmware-tools', mode = 0755)

        # vmware-tools requires a real looking init structure
        r.MakeDirs('/etc/rc.d', mode = 0755)
        for i in ['init.d', 'rc.local', 'rc.sysinit'] + \
                ['rc%d.d' % x for x in range(7)]:
            r.MakeDirs('/etc/' + i, mode = 0755)
            r.Symlink('/etc/' + i, '/etc/rc.d/' + i)

        #r.Create("%(sysconfdir)s/vmware-tools/locations", mode=0644,
        #         contents = ''
        #         'answer BINDIR %(bindir)s\n'
        #         'answer INITDIR %(sysconfdir)s\n'
        #         'answer INITSCRIPTSDIR %(initdir)s\n'
        #         'answer SBINDIR %(sbindir)s\n'
        #         'answer LIBDIR %(libdir)s/vmware\n'
        #         'answer DOCDIR %(docdir)s/vmware\n'
        #         'answer RUN_CONFIGURATOR yes\n'
        #         'answer HEADER_DIR /lib/modules/%(kver)s/build/include\n'
        #         'answer EULA_AGREED yes\n'
        #         'answer ISC_COPYRIGHT_SEEN yes\n')
        answers = '\n'.join(('%(destdir)s/%(bindir)s', 'yes', # /usr/bin
                             '%(destdir)s/%(sysconfdir)s', # /etc
                             '', # /etc/init.d
                             '', 'yes', # /usr/sbin
                             '', 'yes', # /usr/lib/vmware-tools
                             '%(destdir)s/%(docdir)s/vmware-tools', 'yes',
                             'no')) # and don't compile the kernel modules
        r.Run('echo -e "%s" | %%(builddir)s/vmware-install.pl' % answers)


    def install(r):
        CPackageRecipe.install(r)
        for i in ['rc.d', 'rc.local', 'rc.sysinit'] + \
                ['rc%d.d' % x for x in range(7)]:
            r.Remove('/etc/' + i, recursive = True)

        r.Run('cat %(builddir)s/chkconfig.patch | patch %(destdir)s/%(sysconfdir)s/init.d/vmware-tools')

        if Arch.x86_64:
            r.MakeDirs('/usr/lib64', mode = 0755)
            r.MakeDirs('/usr/lib64/vmware-tools', mode = 0755)
        else:
            r.Run('find %(destdir)s/%(libdir)s -name "*64" -print | xargs /bin/rm -rf')
        r.Run('rm -rf %(destdir)s/usr/share')
        r.Run('rm -rf %(destdir)s/%(libdir)s/debug')