def startElement(self, name, attrs):
print name, ":", attrs.items()
self.elements.append(name)
- if name in ["hardware", "bcastsystem", "satellite"]:
+ if name in ["hardware", "bcastsystem", "satellite", "tag"]:
if not attrs.has_key("type"):
self.printError(str(name) + " tag with no type attribute")
if self.elements[-3] == "default":
STATUS_ERROR = 2
STATUS_INIT = 4
- def __init__(self, statusCallback):
+ def __init__(self, statusCallback, blocking = False, neededTag = None):
self.directory = "/"
+ self.neededTag = neededTag
+
+ # caution: blocking should only be used, if further execution in enigma2 depends on the outcome of
+ # the installer!
+ self.blocking = blocking
+
+ self.currentlyInstallingMetaIndex = None
+
self.console = eConsoleAppContainer()
self.console.appClosed.get().append(self.installNext)
self.setStatus(self.STATUS_INIT)
self.packageslist = []
-
+
def readInfo(self, directory, file):
print "Reading .info file", file
handler = InfoHandler(self.prerequisiteMet, directory)
# TODO: we need to implement a hardware detection here...
print "prerequisites:", prerequisites
met = True
+ if self.neededTag is None:
+ if prerequisites.has_key("tag"):
+ return False
+ else:
+ if prerequisites.has_key("tag"):
+ if self.neededTag in prerequisites["tag"]:
+ return True
+ return False
if prerequisites.has_key("bcastsystem"):
for bcastsystem in prerequisites["bcastsystem"]:
if nimmanager.hasNimType(bcastsystem):
# TODO: hardware detection
met = True
return True
-
+
+ def installPackages(self, indexes):
+ print "installing packages", indexes
+ if len(indexes) == 0:
+ self.setStatus(self.STATUS_DONE)
+ return
+ self.installIndexes = indexes
+ print "+++++++++++++++++++++++bla"
+ self.currentlyInstallingMetaIndex = 0
+ self.installPackage(self.installIndexes[self.currentlyInstallingMetaIndex])
+
def installPackage(self, index):
print "installing package with index", index, "and name", self.packageslist[index][0]["attributes"]["name"]
def installNext(self, *args, **kwargs):
self.currentIndex += 1
attributes = self.installingAttributes
+ #print "attributes:", attributes
- if self.currentAttributeIndex >= len(self.attributeNames): # end reached
- self.setStatus(self.STATUS_DONE)
- return
+ if self.currentAttributeIndex >= len(self.attributeNames): # end of package reached
+ if self.currentlyInstallingMetaIndex is None or self.currentlyInstallingMetaIndex >= len(self.installIndexes) - 1:
+ self.setStatus(self.STATUS_DONE)
+ return
+ else:
+ self.currentlyInstallingMetaIndex += 1
+ self.installPackage(self.installIndexes[self.currentlyInstallingMetaIndex])
self.setStatus(self.STATUS_WORKING)
self.installNext()
return
else: # nothing to install here
+ self.currentIndex = -1
self.currentAttributeIndex += 1
self.installNext()
return
self.installNext()
def installIPK(self, directory, name):
- self.ipkg = IpkgComponent()
- self.ipkg.addCallback(self.ipkgCallback)
- self.ipkg.startCmd(IpkgComponent.CMD_INSTALL, {'package': directory + name})
+ if self.blocking:
+ os.system("ipkg install " + directory + name)
+ self.installNext()
+ else:
+ self.ipkg = IpkgComponent()
+ self.ipkg.addCallback(self.ipkgCallback)
+ self.ipkg.startCmd(IpkgComponent.CMD_INSTALL, {'package': directory + name})
def ipkgCallback(self, event, param):
print "ipkgCallback"
def installSkin(self, directory, name):
print "installing skin:", directory, " - ", name
print "cp -a %s %s" % (directory, resolveFilename(SCOPE_SKIN))
- if self.console.execute("cp -a %s %s" % (directory, resolveFilename(SCOPE_SKIN))):
- print "execute failed"
+ if self.blocking:
+ os.system("cp -a %s %s" % (directory, resolveFilename(SCOPE_SKIN)))
self.installNext()
+ else:
+ if self.console.execute("cp -a %s %s" % (directory, resolveFilename(SCOPE_SKIN))):
+ print "execute failed"
+ self.installNext()
def mergeServices(self, directory, name, merge = False):
print "merging services:", directory, " - ", name
-
- db = eDVBDB.getInstance()
- db.reloadServicelist()
- db.loadServicelist(directory + name)
- db.saveServicelist()
+ if os.path.isfile(directory + name):
+ db = eDVBDB.getInstance()
+ db.reloadServicelist()
+ db.loadServicelist(directory + name)
+ db.saveServicelist()
self.installNext()
def installFavourites(self, directory, name):
print "installing favourites:", directory, " - ", name
- if self.console.execute("cp %s %s" % ((directory + name), resolveFilename(SCOPE_CONFIG))):
- print "execute failed"
+ if self.blocking:
+ os.system("cp %s %s" % ((directory + name), resolveFilename(SCOPE_CONFIG)))
self.installNext()
+ else:
+ if self.console.execute("cp %s %s" % ((directory + name), resolveFilename(SCOPE_CONFIG))):
+ print "execute failed"
+ self.installNext()