def run(): parser = OptionParser(usage="usage: %prog [appname]", version="%prog 1.0") parser.add_option("-x", "--prefer-x11", dest="prefer_x11", action="store_true", help="Use X11 unless not compatible", default=False) (options, args) = parser.parse_args() device = None if len(args) > 0: appname = args[0] apps = system.get_apps() for app in apps: if app["name"] == appname: device = app["device"] break; if device == None: raise cli.Error("Application %s doesn't exist" % (appname)) elif os.path.exists(system.runapp_link): mode = os.stat(system.runapp_link)[stat.ST_MODE] if not stat.S_ISBLK(mode): raise cli.Error("Symlink %s is not pointing a block device" % (system.runapp_link)) device = os.path.realpath(system.runapp_link) if device == None: raise cli.Error("Appname must be specified unless %s symlink does exist." % (system.runapp_link)) with system.Mount(device) as tmpdir: metadata = system.get_metadata_from_cache(device) if metadata == None: metadata = system.get_app_metadata(device, tmpdir) run_app(tmpdir, metadata, options.prefer_x11)
def run(): parser = OptionParser(usage="usage: %prog [appname]", version="%prog 1.0") parser.add_option("-x", "--prefer-x11", dest="prefer_x11", action="store_true", help="Use X11 unless not compatible", default=False) (options, args) = parser.parse_args() device = None if len(args) > 0: appname = args[0] apps = system.get_apps() for app in apps: if app["name"] == appname: device = app["device"] break if device == None: raise cli.Error("Application %s doesn't exist" % (appname)) elif os.path.exists(system.runapp_link): mode = os.stat(system.runapp_link)[stat.ST_MODE] if not stat.S_ISBLK(mode): raise cli.Error("Symlink %s is not pointing a block device" % (system.runapp_link)) device = os.path.realpath(system.runapp_link) if device == None: raise cli.Error( "Appname must be specified unless %s symlink does exist." % (system.runapp_link)) with system.Mount(device) as tmpdir: metadata = system.get_metadata_from_cache(device) if metadata == None: metadata = system.get_app_metadata(device, tmpdir) run_app(tmpdir, metadata, options.prefer_x11)
def get_va_metadata_from_cache(name): if not name.startswith("/dev/"): name = determine_device_name(name) if name == None: return None return system.get_metadata_from_cache(name)