Esempio n. 1
0
 def add_nonfree_repository(self):
     sources_list = open('/etc/apt/sources.list', 'r')
     for line in sources_list:
         line = line.strip()
         if not line or line.startswith('#') or line.startswith('deb-src') \
            or line.startswith('deb http://volatile'):
             continue
         splitted = line.split()
         dist = splitted[2].split('/')[0]
         url = splitted[1]
         if 'non-free' in ' '.join(splitted[3:]):
             sources_list.close()
             break
     else:
         sources_list.close()
         sources_list = open('/etc/apt/sources.list', 'a')
         print2('Adding non-free to sources.list ... ')
         sources_list.write('\ndeb %s %s non-free\n' % (url, dist))
         sources_list.close()
         print('OK')
         print2('Update APT base ... ')
         if sh('aptitude update'):
             print('OK')
             return True
         else:
             return False
Esempio n. 2
0
 def add_nonfree_repository(self):
     sources_list = open('/etc/apt/sources.list', 'r')
     for line in sources_list:
         line = line.strip()
         if not line or line.startswith('#') or line.startswith('deb-src') \
            or line.startswith('deb http://volatile'):
             continue
         splitted = line.split()
         dist = splitted[2].split('/')[0]
         url = splitted[1]
         if 'non-free' in ' '.join(splitted[3:]):
             sources_list.close()
             break
     else:
         sources_list.close()
         sources_list = open('/etc/apt/sources.list', 'a')
         print2('Adding non-free to sources.list ... ')
         sources_list.write('\ndeb %s %s non-free\n' % (url, dist))
         sources_list.close()
         print('OK')
         print2('Update APT base ... ')
         if sh('aptitude update'):
             print('OK')
             return True
         else:
             return False
Esempio n. 3
0
 def install_binary_32(self):
     'Install with the binary 32bit (without RPM)'
     url = 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=39485'
     filename = '/tmp/jre-6u20-linux-i586.bin'
     filename_on_system = ask_or_download(url, filename)
     if not filename_on_system:
         return False
     print2('Installing JRE ... ')
     sh_io('chmod +x %s' % filename_on_system)
     java_install = sh(filename_on_system, finalize=False)
     ask_agree = 'Do you agree to the above license terms? [yes or no]\n'
     while java_install.stdout.readline() != ask_agree:
         pass #Read the Java License carefully: line by line
     java_install.stdin.write('yes\n') #As I've read I can accept
     out, err = java_install.communicate()
     java_install.wait()
     #TODO: now it is unpacked on ./jre1.6.0_20/. What should I do?
     # Move to /opt and create symlinks on /usr/bin?
     if java_install.returncode == 0:
         print('OK')
         return True
     else:
         print('FAILED')
         return False
Esempio n. 4
0
 def install_binary_32(self):
     'Install with the binary 32bit (without RPM)'
     url = 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=39485'
     filename = '/tmp/jre-6u20-linux-i586.bin'
     filename_on_system = ask_or_download(url, filename)
     if not filename_on_system:
         return False
     print2('Installing JRE ... ')
     sh_io('chmod +x %s' % filename_on_system)
     java_install = sh(filename_on_system, finalize=False)
     ask_agree = 'Do you agree to the above license terms? [yes or no]\n'
     while java_install.stdout.readline() != ask_agree:
         pass  #Read the Java License carefully: line by line
     java_install.stdin.write('yes\n')  #As I've read I can accept
     out, err = java_install.communicate()
     java_install.wait()
     #TODO: now it is unpacked on ./jre1.6.0_20/. What should I do?
     # Move to /opt and create symlinks on /usr/bin?
     if java_install.returncode == 0:
         print('OK')
         return True
     else:
         print('FAILED')
         return False
Esempio n. 5
0
 def is_installed(self):
     try:
         assert sh('java').returncode == 0
     except OSError:
         assert False
Esempio n. 6
0
 def is_installed(self):
     try:
         assert sh('java').returncode == 0
     except OSError:
         assert False