Exemple #1
0
 def install(self, sdcard):
   params = self.files_needed()
   files = dict.fromkeys(params.values())
   nextCommand = CommandLine.peek_next()
   download = nextCommand and nextCommand == '-d'
   if not download:
     while CommandLine.peek_next():
       key, file = CommandLine.get_next().split('=')
       files[params[key]] = file
   if None in files.values():
     if download or (self.can_download() and prompt.ask_yes_no('Do you need to download the OS files?', True)):
       files = self.download(files)
     else:
       for key, file in files.iteritems():
        files[key] = self.get_file(key)
   self.do_install(files, sdcard)
Exemple #2
0
m.items.append(MenuItem('Install a distro to Micro SD', INSTALL))
m.items.append(MenuItem('Setup the image build environment', YOCTO))
m.items.append(MenuItem('Exit', ''))
option = m.show()
if option == INSTALL:
  if not os.geteuid()==0:
		exit("You must be root to run this action, please use sudo and try again.")
  import distros
  while True:
    distro = distros.select()
    if CommandLine.peek_next():
      break
    print distro.get_description()
    print 'There is an option to download this distro' if distro.can_download() else 'You must have already downloaded an image in order to install this distro.'
    print '\n',
    if ask_yes_no('Would you like to install ' + distro.get_name() + '?', True):
      break
  distro.install(sdcard.select_card())
elif option == YOCTO:
  from tools import yocto
  SETUP = 'setup'
  DEPENDS = 'dependencies'
  y = Menu()
  y.query = 'Please choose a task'
  y.items.append(MenuItem('setup Yocto', SETUP))
  y.items.append(MenuItem('', DEPENDS))
  y.items.append(MenuItem('Exit', ''))
  option = y.show()
  if option == SETUP:
    yocto.setup(path.join(get_save_path(), 'yocto'))
  elif option == DEPENDS: