Skip to content

Commit

Permalink
[FlashImage] search for settings before flash
Browse files Browse the repository at this point in the history
  • Loading branch information
koivo committed Apr 19, 2024
1 parent a736c3b commit 755db8b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
42 changes: 41 additions & 1 deletion lib/python/Screens/FlashImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ def checkIfDevice(path, diskstats):
if not os.path.isdir(destination):
os.mkdir(destination)
if not self.onlyDownload:
self.flashPostAction()
#self.flashPostAction()
self.flashPostActionFirst()
else:
self.session.openWithCallback(self.startDownload, MessageBox, _("Starting download of image file?\nPress OK to start or Exit to abort."), type=MessageBox.TYPE_INFO, timeout=0)
except:
Expand Down Expand Up @@ -517,6 +518,13 @@ def cleanUp(self):
Console().ePopen('umount %s' % self.tmp_dir)
Console().ePopen('rm /tmp/chroot.sh /tmp/groups.txt /tmp/groups.txt /tmp/installed-list.txt self.tmp_dir')

def flashPostActionFirst(self):
backupfilename = "%s/%s" % (getBackupPath(), getBackupFilename())
if fileExists(backupfilename):
self.flashPostAction()
else:
self.flashPostAction2()

def flashPostAction(self, retVal=True):
if retVal:
self.recordCheck = False
Expand Down Expand Up @@ -552,6 +560,38 @@ def flashPostAction(self, retVal=True):
else:
self.abort()

def flashPostAction2(self, retVal=True):
if retVal:
self.recordCheck = False
text = _("What should be restored?\nNo saved settings found!")
if getImageDistro() in self.imagename:
if os.path.exists("/media/hdd/images/config/myrestore.sh"):
text = "%s\n%s" % (text, _("(The file '/media/hdd/images/config/myrestore.sh' exists and will be run after the image is flashed.)"))
choices = [
(_("Nothing"), "wizard"),
(_("Do not flash image"), "abort")
]
default = self.selectPrevPostFlashAction()
if "backup" in self.imagename:
text = _("Flash Backupimage")
text = "%s\n%s?" % (text, self.imagename)
choices = [
(_("Yes"), "nothing"),
(_("Do not flash image"), "abort")
]
default = 0
else:
text = _("Flash Image")
text = "%s\n%s?" % (text, self.imagename)
choices = [
(_("Yes"), "wizard"),
(_("Do not flash image"), "abort")
]
default = 0
self.session.openWithCallback(self.postFlashActionCallback, MessageBox, text, list=choices, default=default, simple=True)
else:
self.abort()

def selectPrevPostFlashAction(self):
index = 1
if os.path.exists("/media/hdd/images/config/settings"):
Expand Down
9 changes: 8 additions & 1 deletion po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgstr ""
"Project-Id-Version: tuxbox-enigma 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-24 13:42+0100\n"
"PO-Revision-Date: 2024-03-29 12:58+0100\n"
"PO-Revision-Date: 2024-04-19 17:10+0200\n"
"Last-Translator: Koivo <[email protected]>\n"
"Language-Team: openHDF\n"
"Language: de\n"
Expand Down Expand Up @@ -15708,6 +15708,13 @@ msgstr "Was durchsuchen?"
msgid "What should be restored?\n"
msgstr "Was soll wiederhergestellt werden?\n"

msgid ""
"What should be restored?\n"
"No saved settings found!"
msgstr ""
"Was soll wiederhergestellt werden?\n"
"Keine gespeicherten Einstellungen gefunden!"

msgid "When enabled the PiP can be closed by the exit button."
msgstr "Wenn aktiviert kann PiP mit der Exit Taste geschlossen werden."

Expand Down

0 comments on commit 755db8b

Please sign in to comment.