From aa86565e52b5e5c6b7f3e3b8f7af1baafa4be430 Mon Sep 17 00:00:00 2001 From: gutosie Date: Wed, 29 Dec 2021 09:10:51 +0200 Subject: [PATCH] Update tools.py --- NeoBoot/files/tools.py | 83 +++++++++++++++++++++++++++++++----------- 1 file changed, 61 insertions(+), 22 deletions(-) diff --git a/NeoBoot/files/tools.py b/NeoBoot/files/tools.py index 657dad8..6b74673 100644 --- a/NeoBoot/files/tools.py +++ b/NeoBoot/files/tools.py @@ -1738,7 +1738,34 @@ class ATVcamfeed(Screen): def myClose(self, message): self.session.open(MessageBox, message, MessageBox.TYPE_INFO) self.close() + + +class TunerInfo(Screen): + __module__ = __name__ + skin = """ + + + + """ + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = Label(_('List of supported stb.')) + self['key_red'] = Label(_('Start - Red')) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, + 'red': self.iNFO}) + + def iNFO(self): + try: + cmd = ' cat ' +LinkNeoBoot+ '/stbinfo.cfg' + cmd1 = '' + self.session.openWithCallback(self.close, Console, _('NeoBoot....'), [cmd, + cmd1]) + self.close() + + except: + False + class CreateSwap(Screen): __module__ = __name__ @@ -1817,28 +1844,40 @@ class CreateSwap(Screen): system('/sbin/swapoff -a; sleep 2; rm -rf /media/usb/swapfile; sleep 2') if os.path.exists('/swapfile'): system('/sbin/swapoff -a; sleep 2; rm -rf /swapfile; sleep 2') - with open('/etc/fstab', 'r') as f: - lines = f.read() - f.close() - fail = '/etc/fstab' - f = open(fail, 'r') - content = f.read() - f.close() - localfile2 = '/etc/fstab' - temp_file2 = open(localfile2, 'w') - if lines.find('/media/hdd/swapfile swap swap defaults 0 0') != -1: - temp_file2.write(content.replace("/media/hdd/swapfile swap swap defaults 0 0","")) - elif lines.find('/media/hdd//swapfile swap swap defaults 0 0') != -1: - temp_file2.write(content.replace("/media/hdd//swapfile swap swap defaults 0 0","")) - elif lines.find('/media/usb/swapfile swap swap defaults 0 0') != -1: - temp_file2.write(content.replace("/media/usb/swapfile swap swap defaults 0 0","")) - elif lines.find('/media/usb//swapfile swap swap defaults 0 0') != -1: - temp_file2.write(content.replace("/media/usb//swapfile swap swap defaults 0 0","")) - elif lines.find('//swapfile swap swap defaults 0 0') != -1: - temp_file2.write(content.replace("/swapfile swap swap defaults 0 0","")) - elif lines.find('/swapfile swap swap defaults 0 0') != -1: - temp_file2.write(content.replace("/swapfile swap swap defaults 0 0","")) - temp_file2.close() + + swapfileinstall = ' ' + if os.path.exists('/etc/fstab'): + with open('/etc/fstab', 'r') as f: + lines = f.read() + f.close() + if lines.find('swapfile') != -1: + swapfileinstall = 'swapfileyes' + + if swapfileinstall == 'swapfileyes': + with open('/etc/fstab', 'r') as f: + lines = f.read() + f.close() + fail = '/etc/fstab' + f = open(fail, 'r') + content = f.read() + f.close() + localfile2 = '/etc/fstab' + temp_file2 = open(localfile2, 'w') + + if lines.find('/media/hdd/swapfile swap swap defaults 0 0') != -1: + temp_file2.write(content.replace("/media/hdd/swapfile swap swap defaults 0 0","")) + elif lines.find('/media/hdd//swapfile swap swap defaults 0 0') != -1: + temp_file2.write(content.replace("/media/hdd//swapfile swap swap defaults 0 0","")) + elif lines.find('/media/usb/swapfile swap swap defaults 0 0') != -1: + temp_file2.write(content.replace("/media/usb/swapfile swap swap defaults 0 0","")) + elif lines.find('/media/usb//swapfile swap swap defaults 0 0') != -1: + temp_file2.write(content.replace("/media/usb//swapfile swap swap defaults 0 0","")) + elif lines.find('//swapfile swap swap defaults 0 0') != -1: + temp_file2.write(content.replace("/swapfile swap swap defaults 0 0","")) + elif lines.find('/swapfile swap swap defaults 0 0') != -1: + temp_file2.write(content.replace("/swapfile swap swap defaults 0 0","")) + temp_file2.close() + cmd1 = "echo -e '\n\n%s '" % _('Swap file has been deleted.') self.session.open(Console, _('NeoBoot....'), [cmd0, cmd1])