示例#1
0
def install_virtualbox(distribution, force_setup=False):
    """ install virtualbox """

    if 'ubuntu' in distribution:
        with hide('running', 'stdout'):
            sudo('DEBIAN_FRONTEND=noninteractive apt-get update')
            sudo("sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o "
                 "Dpkg::Options::='--force-confdef' "
                 "-o Dpkg::Options::='--force-confold' upgrade --force-yes")
            install_ubuntu_development_tools()
            apt_install(
                packages=['dkms', 'linux-headers-generic', 'build-essential'])
            sudo('wget -q '
                 'https://www.virtualbox.org/download/oracle_vbox.asc -O- |'
                 'sudo apt-key add -')

            os = lsb_release()
            apt_string = ' '.join([
                'deb', 'http://download.virtualbox.org/virtualbox/debian',
                '%s contrib' % os['DISTRIB_CODENAME']
            ])

            apt_add_repository_from_apt_string(apt_string, 'vbox.list')

            apt_install(packages=['virtualbox-5.0'])

            loaded_modules = sudo('lsmod')

            if 'vboxdrv' not in loaded_modules or force_setup:

                if 'Vivid Vervet' in run('cat /etc/os-release'):
                    sudo('systemctl start vboxdrv')
                else:
                    sudo('/etc/init.d/vboxdrv start')

            sudo(
                'wget -c '
                'http://download.virtualbox.org/virtualbox/5.0.4/'
                'Oracle_VM_VirtualBox_Extension_Pack-5.0.4-102546.vbox-extpack'
            )  # noqa

            sudo(
                'VBoxManage extpack install --replace '
                'Oracle_VM_VirtualBox_Extension_Pack-5.0.4-102546.vbox-extpack'
            )  # noqa
示例#2
0
def install_oracle_java(distribution, java_version):
    """ installs oracle java """
    if 'ubuntu' in distribution:
        accept_oracle_license = ('echo '
                                 'oracle-java' + java_version + 'installer '
                                 'shared/accepted-oracle-license-v1-1 '
                                 'select true | '
                                 '/usr/bin/debconf-set-selections')
        with settings(hide('running', 'stdout')):
            sudo(accept_oracle_license)

        with settings(hide('running', 'stdout'),
                      prompts={"Press [ENTER] to continue or ctrl-c to cancel adding it": "yes"}): # noqa
            sudo("yes | add-apt-repository ppa:webupd8team/java")

        with settings(hide('running', 'stdout')):
            install_os_updates(distribution)
            apt_install(packages=['oracle-java8-installer',
                                  'oracle-java8-set-default'])
示例#3
0
def install_virtualbox(distribution, force_setup=False):
    """ install virtualbox """

    if 'ubuntu' in distribution:
        with hide('running', 'stdout'):
            sudo('DEBIAN_FRONTEND=noninteractive apt-get update')
            sudo("sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o "
                    "Dpkg::Options::='--force-confdef' "
                    "-o Dpkg::Options::='--force-confold' upgrade --force-yes")
            install_ubuntu_development_tools()
            apt_install(packages=['dkms',
                                  'linux-headers-generic',
                                  'build-essential'])
            sudo('wget -q '
                 'https://www.virtualbox.org/download/oracle_vbox.asc -O- |'
                 'sudo apt-key add -')

            os = lsb_release()
            apt_string = ' '.join(
                ['deb',
                 'http://download.virtualbox.org/virtualbox/debian',
                 '%s contrib' % os['DISTRIB_CODENAME']])

            apt_add_repository_from_apt_string(apt_string, 'vbox.list')

            apt_install(packages=['virtualbox-5.0'])

            loaded_modules = sudo('lsmod')

            if 'vboxdrv' not in loaded_modules or force_setup:

                if 'Vivid Vervet' in run('cat /etc/os-release'):
                    sudo('systemctl start vboxdrv')
                else:
                    sudo('/etc/init.d/vboxdrv start')

            sudo('wget -c '
                 'http://download.virtualbox.org/virtualbox/5.0.4/'
                 'Oracle_VM_VirtualBox_Extension_Pack-5.0.4-102546.vbox-extpack') # noqa

            sudo('VBoxManage extpack install --replace '
                 'Oracle_VM_VirtualBox_Extension_Pack-5.0.4-102546.vbox-extpack') # noqa
示例#4
0
def install_virtualbox(distribution, force_setup=False):
    """ install virtualbox """

    if "ubuntu" in distribution:
        with hide("running", "stdout"):
            sudo("apt-get update")
            sudo("apt-get -y upgrade")
            install_ubuntu_development_tools()
            apt_install(packages=["dkms", "linux-headers-generic", "build-essential"])
            sudo("wget -q " "https://www.virtualbox.org/download/oracle_vbox.asc -O- |" "sudo apt-key add -")

            os = lsb_release()
            apt_string = " ".join(
                ["deb", "http://download.virtualbox.org/virtualbox/debian", "%s contrib" % os["DISTRIB_CODENAME"]]
            )

            apt_add_repository_from_apt_string(apt_string, "vbox.list")

            apt_install(packages=["virtualbox-5.0"])

            loaded_modules = sudo("lsmod")

            if "vboxdrv" not in loaded_modules or force_setup:

                if "Vivid Vervet" in run("cat /etc/os-release"):
                    sudo("systemctl start vboxdrv")
                else:
                    sudo("/etc/init.d/vboxdrv start")

            sudo(
                "wget -c "
                "http://download.virtualbox.org/virtualbox/5.0.4/"
                "Oracle_VM_VirtualBox_Extension_Pack-5.0.4-102546.vbox-extpack"
            )  # noqa

            sudo(
                "VBoxManage extpack install --replace " "Oracle_VM_VirtualBox_Extension_Pack-5.0.4-102546.vbox-extpack"
            )  # noqa
示例#5
0
def install_oracle_java(distribution, java_version):
    """ installs oracle java """
    if 'ubuntu' in distribution:
        accept_oracle_license = ('echo '
                                 'oracle-java' + java_version + 'installer '
                                 'shared/accepted-oracle-license-v1-1 '
                                 'select true | '
                                 '/usr/bin/debconf-set-selections')
        with settings(hide('running', 'stdout')):
            sudo(accept_oracle_license)

        with settings(
                hide('running', 'stdout'),
                prompts={
                    "Press [ENTER] to continue or ctrl-c to cancel adding it":
                    "yes"
                }):  # noqa
            sudo("yes | add-apt-repository ppa:webupd8team/java")

        with settings(hide('running', 'stdout')):
            install_os_updates(distribution)
            apt_install(packages=[
                'oracle-java8-installer', 'oracle-java8-set-default'
            ])
示例#6
0
 def test_apt_install_raises_exception_on_failure(self, *args, **kwargs):
     sudo('echo > /etc/resolv.conf')
     with self.assertRaises(SystemExit) as cm:
         pkg.apt_install(packages=['fish'])
     self.assertEqual(cm.exception.code, 1)
示例#7
0
 def test_apt_install_returns_true_on_success(self, *args, **kwargs):
     self.assertTrue(
         pkg.apt_install(packages=['fish']))
示例#8
0
 def test_apt_install_installs_package(self, *args, **kwargs):
     pkg.apt_install(packages=['fish'])
     self.assertTrue(sudo('dpkg-query -l fish '
                          '| grep -q ^.i').return_code == 0)
示例#9
0
 def test_apt_install_raises_exception_on_failure(self, *args, **kwargs):
     sudo('echo > /etc/resolv.conf')
     with self.assertRaises(SystemExit) as cm:
         pkg.apt_install(packages=['fish'])
     self.assertEqual(cm.exception.code, 1)
示例#10
0
 def test_apt_install_returns_true_on_success(self, *args, **kwargs):
     self.assertTrue(pkg.apt_install(packages=['fish']))
示例#11
0
 def test_apt_install_installs_package(self, *args, **kwargs):
     pkg.apt_install(packages=['fish'])
     self.assertTrue(
         sudo('dpkg-query -l fish '
              '| grep -q ^.i').return_code == 0)