From: Stefan Pluecken Date: Sun, 5 Mar 2006 15:50:27 +0000 (+0000) Subject: adding the image upgrade wizard X-Git-Tag: 2.6.0~3877 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/323ac4a566f7c1ea9006eaf58eae915fac00071b?ds=sidebyside adding the image upgrade wizard can backup settings to hdd, cf, usb or (in the future) a given path recognizes the backup after flashing the image automatically and asks the user, if it should restore the settings guides the user through the upgrade process --- diff --git a/data/imagewizard.xml b/data/imagewizard.xml new file mode 100644 index 00000000..80943a81 --- /dev/null +++ b/data/imagewizard.xml @@ -0,0 +1,141 @@ + + + +from Screens.ImageWizard import checkConfigBackup +self.backuppath = checkConfigBackup() +self.condition = (self.backuppath is not None) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +from Components.Harddisk import harddiskmanager +self.condition = harddiskmanager.HDDCount() > 0 + + + +self.backuppath = '/media/hdd/' + + + + + +from Components.Harddisk import harddiskmanager +self.condition = harddiskmanager.HDDCount() == 0 + + + + + + + +self.backuppath = '/media/cf/' + + + + + + +self.backuppath = '/media/usb/' + + + + + + + + + +from Screens.ImageWizard import doBackup +doBackup(self.backuppath) + + + + + + +from Screens.ImageWizard import checkConfigBackup +self.backuppath = checkConfigBackup() +self.condition = (self.backuppath is not None) + + + + + + +from Screens.ImageWizard import checkConfigBackup +self.backuppath = checkConfigBackup() +self.condition = (self.backuppath is None) + + + + + + +from Screens.ImageWizard import doRestore +doRestore(self.backuppath) + + + + + + +import os +from Screens.ImageWizard import backupfile +print 'mv ' + self.backuppath + backupfile + ' ' + self.backuppath + backupfile + '.old' +os.system('mv ' + self.backuppath + backupfile + ' ' + self.backuppath + backupfile + '.old') +os.system('killall enigma2') # ugly... no better solution atm + + + + + + + + + + + + + +from enigma import quitMainloop +quitMainloop(1) + + + + + + + + diff --git a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/Makefile.am b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/Makefile.am index 7b26d5f9..9848f3df 100644 --- a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/Makefile.am @@ -3,5 +3,6 @@ installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/SoftwareUpdate install_PYTHON = \ __init__.py \ plugin.py \ - update.png + update.png + diff --git a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py index c065c815..00f8e185 100644 --- a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py @@ -8,6 +8,7 @@ from Components.MenuList import MenuList from Components.Input import Input from Screens.Console import Console from Plugins.Plugin import PluginDescriptor +from Screens.ImageWizard import ImageWizard import os @@ -25,7 +26,8 @@ class UpdatePluginMenu(Screen): list = [] if self.menu == 0: - list.append((_("Upgrade"), "upgrade")) + list.append((_("Image-Upgrade"), "image")) + list.append((_("Online-Upgrade"), "upgrade")) list.append((_("Advanced"), "advanced")) elif self.menu == 1: list.append((_("Choose source"), "source")) @@ -42,6 +44,8 @@ class UpdatePluginMenu(Screen): def go(self): if self.menu == 0: + if (self["menu"].l.getCurrentSelection()[1] == "image"): + self.session.open(ImageWizard) if (self["menu"].l.getCurrentSelection()[1] == "upgrade"): self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to update your Dreambox?\nAfter pressing OK, please wait!")) if (self["menu"].l.getCurrentSelection()[1] == "advanced"): diff --git a/lib/python/Screens/ImageWizard.py b/lib/python/Screens/ImageWizard.py new file mode 100644 index 00000000..f96ddadc --- /dev/null +++ b/lib/python/Screens/ImageWizard.py @@ -0,0 +1,50 @@ +from Wizard import Wizard, wizardManager + +from Components.config import configElementBoolean, config +from Components.Pixmap import * + +from LanguageSelection import LanguageSelection +from Tools.Directories import fileExists + +import os + +backupfile = "backupenigma2settings.tar" + +def checkConfigBackup(): + paths = ['/media/hdd/', '/media/cf/'] + for x in paths: + if fileExists(x + backupfile): + return x + return None + +if checkConfigBackup() is None: + backupAvailable = 0 +else: + backupAvailable = 1 + +class ImageWizard(Wizard): + skin = """ + + + + + """ + + def __init__(self, session): + self.xmlfile = "imagewizard.xml" + + Wizard.__init__(self, session, showSteps=False, showStepSlider=False, showList=True, showConfig=True) + + def markDone(self): + pass + +wizardManager.registerWizard(ImageWizard, backupAvailable) + +def doBackup(path): + os.system('tar cvpf ' + path + backupfile + ' /etc/enigma2') + +def doRestore(path): + os.system('cd / && tar xvpf ' + path + backupfile + ' etc/enigma2') + + + \ No newline at end of file diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am index d917eb39..7a30e88a 100644 --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -9,4 +9,4 @@ install_PYTHON = \ AudioSelection.py InfoBarGenerics.py HelpMenu.py Wizard.py __init__.py \ Dish.py SubserviceSelection.py LanguageSelection.py StartWizard.py \ TutorialWizard.py PluginBrowser.py MinuteInput.py Scart.py PVRState.py \ - Console.py InputBox.py ChoiceBox.py SimpleSummary.py + Console.py InputBox.py ChoiceBox.py SimpleSummary.py ImageWizard.py diff --git a/mytest.py b/mytest.py index 77e925b6..680f198d 100644 --- a/mytest.py +++ b/mytest.py @@ -39,6 +39,7 @@ except ImportError: from Components.PluginComponent import plugins from Screens.Wizard import wizardManager +from Screens.ImageWizard import * from Screens.StartWizard import * from Screens.TutorialWizard import * from Tools.BoundFunction import boundFunction