Skip to content

Commit

Permalink
Adopted option to not create a new backup when flashing online
Browse files Browse the repository at this point in the history
taken from openpli
  • Loading branch information
henrylicious committed Mar 19, 2024
1 parent 98ed14d commit 3692a2d
Show file tree
Hide file tree
Showing 42 changed files with 1,040 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,12 @@ def runFinished(self, retval):
def readPluginList(self):
installedpkgs = ShellCompatibleFunctions.listpkg(type="installed", image_dir=self.image_dir)
self.PluginList = []
with open('/tmp/installed-list.txt') as f:
for line in f:
if line.strip() not in installedpkgs:
self.PluginList.append(line.strip())
f.close()
if os_path.exists('/tmp/installed-list.txt'):
with open('/tmp/installed-list.txt') as f:
for line in f:
if line.strip() not in installedpkgs:
self.PluginList.append(line.strip())
f.close()
self.createMenuList()

def createMenuList(self):
Expand Down
23 changes: 16 additions & 7 deletions lib/python/Screens/FlashImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
from boxbranding import getImageDistro, getBoxType, getMachineBrand, getMachineName

isDevice = False
doBackup = False
multibootslot = ""


def checkimagefiles(files):
return len([x for x in files if 'kernel' in x and '.bin' in x or x in ('uImage', 'rootfs.bin', 'root_cfe_auto.bin', 'root_cfe_auto.jffs2', 'oe_rootfs.bin', 'e2jffs2.img', 'rootfs.tar.bz2', 'rootfs.ubi')]) == 2

Expand Down Expand Up @@ -294,25 +294,30 @@ def confirmation(self):
choices = []
slotdict = {k: v for k, v in BoxInfo.getItem("canMultiBoot").items() if not v['device'].startswith('/dev/sda')}
for x in range(1, len(slotdict) + 1):
choices.append(((_("slot%s - %s (current image)") if x == currentimageslot else _("slot%s - %s")) % (x, imagesList[x]['imagename']), (x, "with backup") if getImageDistro() in self.imagename else (x, "without backup")))
choices.append(((_("slot%s - %s (current image), with backup") if x == currentimageslot else _("slot%s - %s, with backup")) % (x, imagesList[x]['imagename']), (x, "with backup")))
for x in range(1, len(slotdict) + 1):
choices.append(((_("slot%s - %s (current image), without backup") if x == currentimageslot else _("slot%s - %s, without backup")) % (x, imagesList[x]['imagename']), (x, "without backup")))
if "://" in self.source:
choices.append((_("No, only download"), (1, "only download")))
choices.append((_("No, do not flash image"), False))
self.session.openWithCallback(self.checkMedia, MessageBox, self.message, list=choices, default=currentimageslot, simple=True)
else:
choices = [(_("Yes"), "with backup")]
choices = [(_("Yes, with backup"), "with backup"), (_("Yes, without backup"), "without backup")]
if "://" in self.source:
choices.append((_("No, only download"), "only download"))
choices.append((_("No, do not flash image"), False))
self.session.openWithCallback(self.checkMedia, MessageBox, self.message, list=choices, default=False, simple=True)

def checkMedia(self, retval):
if retval:
global doBackup
if BoxInfo.getItem("canMultiBoot"):
global multibootslot
multibootslot = retval[0]
doBackup = retval[1] == "with backup"
self.onlyDownload = retval[1] == "only download"
else:
doBackup = retval == "with backup"
self.onlyDownload = retval == "only download"

def findmedia(path):
Expand Down Expand Up @@ -528,6 +533,7 @@ def selectPrevPostFlashAction(self):
return index

def postFlashActionCallback(self, choice):
global doBackup
if choice:
rootFolder = "/media/hdd/images/config"
if choice != "abort" and not self.recordCheck:
Expand All @@ -541,7 +547,7 @@ def postFlashActionCallback(self, choice):
restoreSettings = ("restoresettings" in choice)
restoreSettingsnoPlugin = (choice == "restoresettingsnoplugin")
restoreAllPlugins = (choice == "restoresettingsandallplugins")
if restoreSettings:
if restoreSettings and doBackup:
self.saveEPG()
if choice != "abort":
filesToCreate = []
Expand All @@ -567,10 +573,13 @@ def postFlashActionCallback(self, choice):
if os.path.exists(path):
os.unlink(path)
global isDevice
if isDevice:
self.startBackupsettings(True)
if doBackup:
if isDevice:
self.startBackupsettings(True)
else:
self.session.openWithCallback(self.startBackupsettings, MessageBox, _("Can only find a network drive to store the backup this means after the flash the autorestore will not work. Alternativaly you can mount the network drive after the flash and perform a manufacurer reset to autorestore"), simple=True)
else:
self.session.openWithCallback(self.startBackupsettings, MessageBox, _("Can only find a network drive to store the backup this means after the flash the autorestore will not work. Alternativaly you can mount the network drive after the flash and perform a manufacurer reset to autorestore"), simple=True)
self.startDownload()
else:
self.abort()
else:
Expand Down
26 changes: 25 additions & 1 deletion po/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: enigma2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-19 10:53+0100\n"
"POT-Creation-Date: 2024-03-19 12:47+0100\n"
"PO-Revision-Date: 2019-08-27 05:19+0200\n"
"Last-Translator: Andy Blackburn <[email protected]>\n"
"Language-Team: Arabic <[email protected]>\n"
Expand Down Expand Up @@ -17649,6 +17649,14 @@ msgstr "نعم، العوده الى قائمة الافلام"
msgid "Yes, shut down now."
msgstr "نعم أغلق الان."

#, fuzzy
msgid "Yes, with backup"
msgstr "إستعادة النسخه الإحتياطيه "

#, fuzzy
msgid "Yes, without backup"
msgstr "إستعادة النسخه الإحتياطيه "

msgid "Yesterday"
msgstr ""

Expand Down Expand Up @@ -19465,6 +19473,14 @@ msgstr ""
msgid "slot%s - %s (current image)"
msgstr "القيمه الحاليه:"

#, fuzzy, python-format
msgid "slot%s - %s (current image), with backup"
msgstr "القيمه الحاليه:"

#, fuzzy, python-format
msgid "slot%s - %s (current image), without backup"
msgstr "القيمه الحاليه:"

#, python-format
msgid "slot%s - %s mode 1"
msgstr ""
Expand All @@ -19481,6 +19497,14 @@ msgstr ""
msgid "slot%s - %s mode 12 (current image)"
msgstr "القيمه الحاليه:"

#, python-format
msgid "slot%s - %s, with backup"
msgstr ""

#, python-format
msgid "slot%s - %s, without backup"
msgstr ""

msgid "slow"
msgstr ""

Expand Down
24 changes: 23 additions & 1 deletion po/bg.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tuxbox-enigma 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-19 10:53+0100\n"
"POT-Creation-Date: 2024-03-19 12:47+0100\n"
"PO-Revision-Date: 2019-08-27 05:19+0200\n"
"Last-Translator: Andy Blackburn <[email protected]>\n"
"Language-Team: Bulgarian\n"
Expand Down Expand Up @@ -16690,6 +16690,12 @@ msgstr "Да, върни към списъка с филми"
msgid "Yes, shut down now."
msgstr "Да, изключи сега."

msgid "Yes, with backup"
msgstr ""

msgid "Yes, without backup"
msgstr ""

msgid "Yesterday"
msgstr ""

Expand Down Expand Up @@ -18428,6 +18434,14 @@ msgstr ""
msgid "slot%s - %s (current image)"
msgstr ""

#, python-format
msgid "slot%s - %s (current image), with backup"
msgstr ""

#, python-format
msgid "slot%s - %s (current image), without backup"
msgstr ""

#, python-format
msgid "slot%s - %s mode 1"
msgstr ""
Expand All @@ -18444,6 +18458,14 @@ msgstr ""
msgid "slot%s - %s mode 12 (current image)"
msgstr ""

#, python-format
msgid "slot%s - %s, with backup"
msgstr ""

#, python-format
msgid "slot%s - %s, without backup"
msgstr ""

msgid "slow"
msgstr ""

Expand Down
24 changes: 23 additions & 1 deletion po/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: enigma2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-19 10:53+0100\n"
"POT-Creation-Date: 2024-03-19 12:47+0100\n"
"PO-Revision-Date: 2019-08-27 05:20+0200\n"
"Last-Translator: Andy Blackburn <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -18144,6 +18144,12 @@ msgstr ""
msgid "Yes, shut down now."
msgstr "Si, apaga ara."

msgid "Yes, with backup"
msgstr ""

msgid "Yes, without backup"
msgstr ""

msgid "Yesterday"
msgstr ""

Expand Down Expand Up @@ -20072,6 +20078,14 @@ msgstr ""
msgid "slot%s - %s (current image)"
msgstr ""

#, python-format
msgid "slot%s - %s (current image), with backup"
msgstr ""

#, python-format
msgid "slot%s - %s (current image), without backup"
msgstr ""

#, python-format
msgid "slot%s - %s mode 1"
msgstr ""
Expand All @@ -20088,6 +20102,14 @@ msgstr ""
msgid "slot%s - %s mode 12 (current image)"
msgstr ""

#, python-format
msgid "slot%s - %s, with backup"
msgstr ""

#, python-format
msgid "slot%s - %s, without backup"
msgstr ""

msgid "slow"
msgstr ""

Expand Down
26 changes: 25 additions & 1 deletion po/cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Enigma2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-19 10:53+0100\n"
"POT-Creation-Date: 2024-03-19 12:47+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Koivo <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -16850,6 +16850,14 @@ msgstr "Ano, vrátit se na seznam filmů"
msgid "Yes, shut down now."
msgstr "Ano, vypnout systém"

#, fuzzy
msgid "Yes, with backup"
msgstr "Obnovit ze zálohy"

#, fuzzy
msgid "Yes, without backup"
msgstr "Obnovit ze zálohy"

msgid "Yesterday"
msgstr "Včera"

Expand Down Expand Up @@ -18652,6 +18660,14 @@ msgstr ""
msgid "slot%s - %s (current image)"
msgstr "Akt. čas"

#, fuzzy, python-format
msgid "slot%s - %s (current image), with backup"
msgstr "Akt. čas"

#, fuzzy, python-format
msgid "slot%s - %s (current image), without backup"
msgstr "Akt. čas"

#, python-format
msgid "slot%s - %s mode 1"
msgstr ""
Expand All @@ -18668,6 +18684,14 @@ msgstr ""
msgid "slot%s - %s mode 12 (current image)"
msgstr "Akt. čas"

#, python-format
msgid "slot%s - %s, with backup"
msgstr ""

#, python-format
msgid "slot%s - %s, without backup"
msgstr ""

msgid "slow"
msgstr "Pomalu"

Expand Down
28 changes: 27 additions & 1 deletion po/da.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: enigma2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-19 10:53+0100\n"
"POT-Creation-Date: 2024-03-19 12:47+0100\n"
"PO-Revision-Date: 2019-08-27 05:20+0200\n"
"Last-Translator: Andy Blackburn <[email protected]>\n"
"Language-Team: None <[email protected]>\n"
Expand Down Expand Up @@ -18795,6 +18795,16 @@ msgstr "Ja, gå til filmliste"
msgid "Yes, shut down now."
msgstr "Ja, start afbrydelse nu."

#
#, fuzzy
msgid "Yes, with backup"
msgstr "Gendan backup"

#
#, fuzzy
msgid "Yes, without backup"
msgstr "Gendan backup"

msgid "Yesterday"
msgstr "I går"

Expand Down Expand Up @@ -20784,6 +20794,14 @@ msgstr ""
msgid "slot%s - %s (current image)"
msgstr "Installeret Image"

#, fuzzy, python-format
msgid "slot%s - %s (current image), with backup"
msgstr "Installeret Image"

#, fuzzy, python-format
msgid "slot%s - %s (current image), without backup"
msgstr "Installeret Image"

#, python-format
msgid "slot%s - %s mode 1"
msgstr ""
Expand All @@ -20800,6 +20818,14 @@ msgstr ""
msgid "slot%s - %s mode 12 (current image)"
msgstr "Installeret Image"

#, python-format
msgid "slot%s - %s, with backup"
msgstr ""

#, python-format
msgid "slot%s - %s, without backup"
msgstr ""

msgid "slow"
msgstr ""

Expand Down
Loading

0 comments on commit 3692a2d

Please sign in to comment.