예제 #1
0
파일: java.py 프로젝트: koder-ua/megarepo
def install_oracle_java(ver='1.6.0_27'):
    
    if ver != '1.6.0_27':
        raise RuntimeError("Only '1.6.0_27' version of java support by now")
    
    JAVAC = check_cmd('javac')
    JAVA_RT = check_cmd('java')
    
    if JAVAC and JAVA_RT:
        return
    
    JAVAH = '/usr/local/java'
    
    JDK_DIR = os.path.join(JAVAH, 'jdk1.6.0_27')
    JRE_DIR = os.path.join(JAVAH, 'jre1.6.0_27')
    
    JDK_URL = 'http://download.oracle.com/otn-pub/java/jdk/6u27-b07/jdk-6u27-linux-x64.bin'
    JRE_URL = 'http://download.oracle.com/otn-pub/java/jdk/6u27-b07/jre-6u27-linux-x64.bin'
    
    if not exists(JAVAH):
        sudo('mkdir ' + JAVAH)

    with cd(JAVAH):
        expect_cmd = 'spawn sh {0};' + \
                     ' expect "Press Enter to continue.....\\n"; send "\\n"'
        
        if not exists(os.path.join(JDK_DIR,'bin/javac')):
            
            if exists(JDK_DIR):
                sudo('rm -rf {0}/*'.format(JDK_DIR))
                
            wget(JDK_URL, use_sudo=True)    
            sudo("expect -c '{0}'".format(
                expect_cmd.format('jdk-6u27-linux-x64.bin')))
            sudo('rm ' + 'jdk-6u27-linux-x64.bin')
            
        if not exists(os.path.join(JRE_DIR,'bin/java')):
            
            if exists(JRE_DIR):
                sudo('rm -rf {0}/*'.format(JRE_DIR))
            
            wget(JRE_URL, use_sudo=True)    
            sudo("expect -c '{0}'".format(
                expect_cmd.format('jre-6u27-linux-x64.bin')))
            sudo('rm ' + 'jre-6u27-linux-x64.bin')
    ln1 = 'export JAVA_HOME=' + JRE_DIR
    ln2 = 'export PATH="$PATH:{0}/bin:{1}/bin"'.format(JRE_DIR, JDK_DIR)
    
    profile = get_rf('/etc/profile')
    put_rf('/etc/profile',
           "\n".join((profile, ln1, ln2, '')),
           use_sudo=True)
예제 #2
0
def test_pkg():
    cmd_name = 'mp3blaster'
    pkg_name = 'mp3blaster'
    
    if core.check_pkg(pkg_name):
        core.uninstall(pkg_name)
        
    ok(core.pkg()) != None
    ok(core.check_pkg(pkg_name)) == False
    ok(core.check_cmd(cmd_name)) == False
    
    core.install(pkg_name)    
    ok(core.check_pkg(pkg_name)) == True
    ok(core.check_cmd(cmd_name)) == True
    
    core.uninstall(pkg_name)
    ok(core.check_pkg(pkg_name)) == False
    ok(core.check_cmd(cmd_name)) == False
예제 #3
0
def install_deb():
    if not check_cmd('cassandra'):
        add_apt_sources(False,
            'deb http://www.apache.org/dist/cassandra/debian 08x main',
            'deb-src http://www.apache.org/dist/cassandra/debian 08x main')
        run('gpg --keyserver pgpkeys.mit.edu --recv-keys F758CE318D77295D')
        sudo('apt-key add ~/.gnupg/pubring.gpg')
        sudo('apt-get update')
        install('cassandra')
예제 #4
0
def install_supervisord():
    if not check_cmd('supervisorctl'):
        if not check_cmd('pip'):
            install('python-pip')
        
        pip('supervisor')
        sudo('echo_supervisord_conf > ' + supervisord_config)
        
        put(open(os.path.join(sensor_source, 'supervisor')),
            '/etc/init.d/supervisor',
            use_sudo=True)
        
        sudo('chmod a+x /etc/init.d/supervisor')
        
        sudo('ln -s /etc/init.d/supervisor /etc/rc2.d/S20supervisor')
        sudo('ln -s /etc/init.d/supervisor /etc/rc3.d/S20supervisor')
        sudo('ln -s /etc/init.d/supervisor /etc/rc4.d/S20supervisor')
        sudo('ln -s /etc/init.d/supervisor /etc/rc5.d/S20supervisor')
        sudo('ln -s /etc/init.d/supervisor /etc/rc6.d/K20supervisor')
        
        sudo('/etc/init.d/supervisor start')
예제 #5
0
파일: riak.py 프로젝트: koder-ua/megarepo
def install_riak():
    if not check_cmd('riak'):
        with cd('/tmp'):
            if not exists('riak_1.0.0-1_amd64.deb'):
                run('wget ' + riak_url)
            sudo('dpkg -i riak_1.0.0-1_amd64.deb')