Update devices.py

This commit is contained in:
gutosie
2022-01-22 22:26:20 +02:00
committed by GitHub
parent ad25e25042
commit 80e2ee4fb1

View File

@@ -29,7 +29,7 @@ import os
from Screens.VirtualKeyBoard import VirtualKeyBoard from Screens.VirtualKeyBoard import VirtualKeyBoard
import gettext import gettext
import os import os
from Plugins.Extensions.NeoBoot.files.stbbranding import getTunerModel, getCheckExt, getBoxHostName from Plugins.Extensions.NeoBoot.files.stbbranding import getTunerModel, getCheckExt, getBoxHostName, getMyUUID
if not fileExists('/usr/lib/python2.7'): if not fileExists('/usr/lib/python2.7'):
getoutput = "os.system" getoutput = "os.system"
else: else:
@@ -482,8 +482,12 @@ class DevicesConf(Screen, ConfigListScreen):
if result: if result:
self.device = extra_args[0] self.device = extra_args[0]
self.mountp = extra_args[1] self.mountp = extra_args[1]
self.device_uuid = 'UUID=' + result.split('UUID=')[1].split(' ')[0].replace('"', '') if fileExists('/usr/lib/python2.7'):
self.device_uuid = ('UUID=' + result.split('UUID=')[1].split(' ')[0].readline().strip().replace('"', ''))
self.device_type = result.split('TYPE=')[1].split(' ')[0].replace('"', '') self.device_type = result.split('TYPE=')[1].split(' ')[0].replace('"', '')
else:
self.device_uuid = 'UUID=' + getMyUUID()
self.device_type = getCheckExt()
if self.device_type.startswith('ext'): if self.device_type.startswith('ext'):
self.device_type = 'auto' self.device_type = 'auto'
elif self.device_type.startswith('ntfs') and result.find('ntfs-3g') != -1: elif self.device_type.startswith('ntfs') and result.find('ntfs-3g') != -1:
@@ -497,11 +501,17 @@ class DevicesConf(Screen, ConfigListScreen):
open('/etc/fstab.tmp', 'w').writelines([l for l in open('/etc/fstab').readlines() if self.device_uuid not in l]) open('/etc/fstab.tmp', 'w').writelines([l for l in open('/etc/fstab').readlines() if self.device_uuid not in l])
rename('/etc/fstab.tmp', '/etc/fstab') rename('/etc/fstab.tmp', '/etc/fstab')
out = open('/etc/fstab', 'a') out = open('/etc/fstab', 'a')
if fileExists('/usr/lib/python2.7'):
line = self.device_uuid + '\t' + self.mountp + '\t' + self.device_type + '\tdefaults\t0 0\n' line = self.device_uuid + '\t' + self.mountp + '\t' + self.device_type + '\tdefaults\t0 0\n'
else:
line = 'UUID=' + getMyUUID() + '\t' + self.mountp + '\t' + self.device_type + '\tdefaults\t0 0\n'
out.write(line) out.write(line)
out.close() out.close()
if fileExists('/usr/lib/python2.7'):
self.device_uuid2 = result.split('UUID=')[1].split(' ')[0].replace('"', '') self.device_uuid2 = result.split('UUID=')[1].split(' ')[0].replace('"', '')
else:
self.device_uuid = getMyUUID()
# if fileExists('/usr/lib/enigma2/python/Plugins/SystemPlugins/DeviceManager2'): # if fileExists('/usr/lib/enigma2/python/Plugins/SystemPlugins/DeviceManager2'):
# out1 = open('/etc/devicemanager.cfg', 'a') # out1 = open('/etc/devicemanager.cfg', 'a')
# line1 = '"' + self.device_uuid2 + '"' + ':' + self.mountp + '\n' # line1 = '"' + self.device_uuid2 + '"' + ':' + self.mountp + '\n'