updating partition.py and db_partiton from gbi

This commit is contained in:
ericbsd
2019-04-17 22:09:38 -03:00
parent a2e76e5a2b
commit cf27a52874
2 changed files with 185 additions and 133 deletions
+92 -82
View File
@@ -34,34 +34,26 @@ from subprocess import Popen, PIPE, STDOUT, call
import pickle
from time import sleep
tmp = "/tmp/.gbinstall/"
tmp = "/tmp/.gbi/"
if not os.path.exists(tmp):
os.makedirs(tmp)
installer = "/usr/local/lib/gbinstall/"
pc_sysinstall = "/usr/local/sbin/pc-sysinstall"
partitiondb = f"{tmp}partitiondb/"
diskdb = f"{partitiondb}disk"
query = f'{installer}backend-query'
query_disk = f'sh {query}/disk-list.sh'
detect_sheme = f'sh {query}/detect-sheme.sh'
query_partition = f'sh {query}/disk-part.sh'
query_label = f'sh {query}/disk-label.sh'
disk_info = f'sh {query}/disk-info.sh'
# query_disk = f'{pc_sysinstall} disk-list'
# detect_sheme = f'{pc_sysinstall} detect-sheme'
# query_partition = f'{pc_sysinstall} disk-part'
# query_label = f'{pc_sysinstall} disk-label'
# disk_info = f'{pc_sysinstall} disk-info'
installer = "/usr/local/lib/gbi/"
sysinstall = "/usr/local/sbin/pc-sysinstall"
partitiondb = "%spartitiondb/" % tmp
query = "sh /usr/local/lib/gbi/backend-query/"
query_disk = '%sdisk-list.sh' % query
detect_sheme = '%sdetect-sheme.sh' % query
diskdb = "%sdisk" % partitiondb
query_partition = '%sdisk-part.sh' % query
query_label = '%sdisk-label.sh' % query
disk_info = '%sdisk-info.sh' % query
nl = "\n"
memory = 'sysctl hw.physmem'
disk_file = f'{tmp}disk'
dslice = f'{tmp}slice'
Part_label = f'{tmp}partlabel'
part_schem = f'{tmp}scheme'
boot_file = f'{tmp}boot'
disk_file = '%sdisk' % tmp
dslice = '%sslice' % tmp
Part_label = '%spartlabel' % tmp
part_schem = '%sscheme' % tmp
boot_file = '%sboot' % tmp
def disk_query():
@@ -71,13 +63,13 @@ def disk_query():
def zfs_disk_query():
disk_output = Popen(pc_sysinstall + " disk-list", shell=True, stdin=PIPE,
disk_output = Popen(sysinstall + " disk-list", shell=True, stdin=PIPE,
stdout=PIPE, universal_newlines=True, close_fds=True)
return disk_output.stdout.readlines()
def zfs_disk_size_query(disk):
disk_info_output = Popen(pc_sysinstall + " disk-info " + disk, shell=True,
disk_info_output = Popen(sysinstall + " disk-info " + disk, shell=True,
stdin=PIPE, stdout=PIPE, universal_newlines=True,
close_fds=True)
return disk_info_output.stdout.readlines()[3].partition('=')[2]
@@ -87,7 +79,6 @@ def how_partition(path):
disk = disk_query()[path[0]][0]
if os.path.exists(partitiondb + disk):
part = partition_query(disk)
print(part)
return len(part)
else:
return 0
@@ -202,7 +193,7 @@ class partition_repos():
def disk_list(self):
disk_output = Popen(query_disk, shell=True, stdin=PIPE, stdout=PIPE,
universal_newlines=True, close_fds=True)
universal_newlines=True, close_fds=True)
dlist = []
for disk in disk_output.stdout:
dlist.append(disk.split())
@@ -394,12 +385,16 @@ class Delete_partition():
sl[snum] = ['freespace', free, '', '']
else:
free = int_size(sl[snum][1])
if sl[snum + 1][0] == 'freespace' and sl[snum - 1][0] == 'freespace':
free = free + int_size(sl[snum + 1][1]) + int_size(sl[snum - 1][1])
slice_after = sl[snum + 1][0]
slice_before = sl[snum - 1][0]
size_after = sl[snum + 1]
size_before = sl[snum - 1]
if slice_after == 'freespace' and slice_before == 'freespace':
free = free + int_size(size_after) + int_size(size_before)
sl[snum] = ['freespace', free, '', '']
sl.remove(sl[snum + 1])
sl.remove(sl[snum - 1])
elif sl[snum + 1][0] == 'freespace':
elif slice_after == 'freespace':
free = free + int_size(sl[snum + 1][1])
sl[snum] = ['freespace', free, '', '']
sl.remove(sl[snum + 1])
@@ -413,7 +408,7 @@ class Delete_partition():
dl = []
mdl = []
data = True
# if delete exist chek if slice is in delete.
# if delete exist check if slice is in delete.
if os.path.exists(tmp + 'delete'):
df = open(tmp + 'delete', 'rb')
mdl = pickle.load(df)
@@ -436,8 +431,8 @@ class Delete_partition():
pfile = open(Part_label, 'w')
for partlist in partition_query(drive):
if partlist[2] != '':
pfile.writelines('%s %s %s\n' % (partlist[3], partlist[1],
partlist[2]))
partition = f'{partlist[3]} {partlist[1]} {partlist[2]}\n'
pfile.writelines(partition)
pfile.close()
@@ -511,7 +506,7 @@ class autoDiskPartition():
slice_file.writelines('%s\n' % number)
slice_file.close()
ram = Popen(memory, shell=True, stdin=PIPE, stdout=PIPE,
universal_newlines=True, close_fds=True)
universal_newlines=True, close_fds=True)
mem = ram.stdout.read()
swap = int(int(mem.partition(':')[2].strip()) / (1024 * 1024))
if bios_or_uefi() == "UEFI":
@@ -523,13 +518,8 @@ class autoDiskPartition():
plist = []
mplist = []
plf = open(partitiondb + disk, 'wb')
read = open(boot_file, 'r')
line = read.readlines()
boot = line[0].strip()
if bios_or_uefi() == "UEFI":
plist.extend(([disk + 'p1', bnum, 'none', 'UEFI']))
elif boot == "grub":
plist.extend(([disk + 'p1', bnum, 'none', 'BIOS']))
else:
plist.extend(([disk + 'p1', bnum, 'none', 'BOOT']))
mplist.append(plist)
@@ -544,8 +534,6 @@ class autoDiskPartition():
pfile = open(Part_label, 'w')
if bios_or_uefi() == "UEFI":
pfile.writelines('UEFI %s none\n' % bnum)
elif boot == "grub":
pfile.writelines('BIOS %s none\n' % bnum)
else:
pfile.writelines('BOOT %s none\n' % bnum)
pfile.writelines('UFS+SUJ %s /\n' % rnum)
@@ -623,10 +611,6 @@ class autoFreeSpace():
sfile.close()
number = int(size.partition('M')[0])
number = number - 512
slice_file = open(dslice, 'w')
slice_file.writelines('p%s\n' % sl)
slice_file.writelines('%s\n' % number)
slice_file.close()
ram = Popen(memory, shell=True, stdin=PIPE, stdout=PIPE,
universal_newlines=True, close_fds=True)
mem = ram.stdout.read()
@@ -640,29 +624,38 @@ class autoFreeSpace():
plist = []
mplist = partition_query(disk)
plf = open(partitiondb + disk, 'wb')
read = open(boot_file, 'r')
line = read.readlines()
boot = line[0].strip()
if bios_or_uefi() == "UEFI":
done = False
if bios_or_uefi() == "UEFI" and efi_exist(disk) is False:
plist.extend(([disk + 'p%s' % sl, bs, 'none', 'UEFI']))
elif boot == "grub":
plist.extend(([disk + 'p%s' % sl, bs, 'none', 'BIOS']))
rsl = int(sl + 1)
swsl = int(rsl + 1)
elif bios_or_uefi() == "UEFI" and efi_exist(disk) is True:
rsl = int(sl)
swsl = int(rsl + 1)
else:
plist.extend(([disk + 'p%s' % sl, bs, 'none', 'BOOT']))
mplist[path] = plist
rsl = int(sl + 1)
swsl = (rsl + 1)
if len(plist) != 0:
done = True
mplist[path] = plist
plist = []
plist.extend(([disk + 'p%s' % rsl, rootNum, '/', 'UFS+SUJ']))
if done is False:
mplist[path] = plist
else:
mplist.append(plist)
plist = []
plist.extend(([disk + 'p%s' % int(sl + 1), rootNum, '/', 'UFS+SUJ']))
mplist.append(plist)
plist = []
plist.extend(([disk + 'p%s' % int(sl + 2), swap, 'none', 'SWAP']))
plist.extend(([disk + 'p%s' % swsl, swap, 'none', 'SWAP']))
mplist.append(plist)
pickle.dump(mplist, plf)
plf.close()
slice_file = open(dslice, 'w')
slice_file.writelines(f'p{rsl}')
slice_file.close()
pfile = open(Part_label, 'w')
if bios_or_uefi() == "UEFI":
if bios_or_uefi() == "UEFI" and efi_exist(disk) is False:
pfile.writelines('UEFI %s none\n' % bs)
elif boot == "grub":
pfile.writelines('BIOS %s none\n' % bs)
else:
pfile.writelines('BOOT %s none\n' % bs)
pfile.writelines('UFS+SUJ %s /\n' % rootNum)
@@ -670,17 +663,20 @@ class autoFreeSpace():
pfile.close()
pl = []
mpl = []
if not os.path.exists(tmp + 'create'):
pl.extend(([disk + "p%s" % sl, size]))
mpl.append(pl)
cf = open(tmp + 'create', 'wb')
pickle.dump(mpl, cf)
cf.close()
if bios_or_uefi() == "UEFI" and efi_exist(disk) is True:
pass
else:
if not os.path.exists(tmp + 'create'):
pl.extend(([disk + "p%s" % sl, size]))
mpl.append(pl)
cf = open(tmp + 'create', 'wb')
pickle.dump(mpl, cf)
cf.close()
class createLabel():
def __init__(self, path, lnumb, cnumb, lb, fs, data):
def __init__(self, path, lnumb, cnumb, label, fs, data):
disk = disk_query()[path[0]][0]
if not os.path.exists(disk_file):
file_disk = open(disk_file, 'w')
@@ -702,7 +698,7 @@ class createLabel():
plf = open(partitiondb + disk + 's%s' % sl, 'wb')
if lnumb == 0:
cnumb -= 1
llist.extend(([disk + 's%s' % sl + letter, cnumb, lb, fs]))
llist.extend(([disk + 's%s' % sl + letter, cnumb, label, fs]))
mllist[lv] = llist
llist = []
if lnumb > 0:
@@ -722,7 +718,7 @@ class createLabel():
class modifyLabel():
def __init__(self, path, lnumb, cnumb, lb, fs, data):
def __init__(self, path, lnumb, cnumb, label, fs, data):
disk = disk_query()[path[0]][0]
if not os.path.exists(disk_file):
file_disk = open(disk_file, 'w')
@@ -744,7 +740,7 @@ class modifyLabel():
plf = open(partitiondb + disk + 's%s' % sl, 'wb')
if lnumb == 0:
cnumb -= 1
llist.extend(([disk + 's%s' % sl + letter, cnumb, lb, fs]))
llist.extend(([disk + 's%s' % sl + letter, cnumb, label, fs]))
mllist[lv] = llist
llist = []
if lnumb > 0:
@@ -813,7 +809,7 @@ class createSlice():
class createPartition():
def __init__(self, path, lnumb, inumb, cnumb, lb, fs, data):
def __init__(self, path, lnumb, inumb, cnumb, label, fs, create):
disk = disk_query()[path[0]][0]
if not os.path.exists(disk_file):
file_disk = open(disk_file, 'w')
@@ -829,7 +825,7 @@ class createPartition():
sfile = open(part_schem, 'w')
sfile.writelines('partscheme=GPT')
sfile.close()
if not os.path.exists(dslice):
if label == '/':
slice_file = open(dslice, 'w')
slice_file.writelines('p%s\n' % pl)
# slice_file.writelines('%s\n' % number)
@@ -840,7 +836,7 @@ class createPartition():
if lnumb == 0 and cnumb > 1:
cnumb -= 1
pf = open(partitiondb + disk, 'wb')
plist.extend(([disk + 'p%s' % pl, cnumb, lb, fs]))
plist.extend(([disk + 'p%s' % pl, cnumb, label, fs]))
mplist[lv] = plist
plist = []
if lnumb > 0:
@@ -854,7 +850,7 @@ class createPartition():
pfile.writelines('%s %s %s\n' % (partlist[3], partlist[1],
partlist[2]))
pfile.close()
if data is True:
if create is True:
plst = []
mplst = []
if not os.path.exists(tmp + 'create'):
@@ -867,7 +863,7 @@ class createPartition():
class modifyPartition():
def __init__(self, path, lnumb, inumb, cnumb, lb, fs, data):
def __init__(self, path, lnumb, inumb, cnumb, label, fs, data):
disk = disk_query()[path[0]][0]
if not os.path.exists(disk_file):
file_disk = open(disk_file, 'w')
@@ -883,10 +879,9 @@ class modifyPartition():
sfile = open(part_schem, 'w')
sfile.writelines('partscheme=GPT')
sfile.close()
if not os.path.exists(dslice):
if label == '/':
slice_file = open(dslice, 'w')
slice_file.writelines('p%s\n' % pl)
# slice_file.writelines('%s\n' % number)
slice_file.close()
plist = []
pslice = '%sp%s' % (disk, pl)
@@ -894,7 +889,7 @@ class modifyPartition():
if lnumb == 0:
cnumb -= 1
pf = open(partitiondb + disk, 'wb')
plist.extend(([disk + 'p%s' % pl, cnumb, lb, fs]))
plist.extend(([disk + 'p%s' % pl, cnumb, label, fs]))
mplist[lv] = plist
plist = []
if lnumb > 0:
@@ -976,7 +971,19 @@ def bios_or_uefi():
return "BIOS"
def efi_exist(disk):
cmd = f"gpart show {disk} | grep efi"
process = Popen(cmd, shell=True, stdout=PIPE,
universal_newlines=True, close_fds=True)
output = process.stdout.readlines()
if len(output) == 0:
return False
else:
return True
class makingParttion():
def __init__(self):
if os.path.exists(tmp + 'create'):
pf = open(tmp + 'create', 'rb')
@@ -997,13 +1004,16 @@ class makingParttion():
call(cmd2, shell=True)
else:
if boot == "grub":
cmd = 'gpart add -a 4k -s 1M -t bios-boot -i %s %s' % (sl, drive)
cmd = 'gpart add -a 4k -s 1M -t bios-boot -i' \
f' {sl} {drive}'
else:
cmd = 'gpart add -a 4k -s 512 -t freebsd-boot -i %s %s' % (sl, drive)
cmd = 'gpart add -a 4k -s 512 -t freebsd-boot -i' \
f' {sl} {drive}'
call(cmd, shell=True)
elif slicePartition(part) == 's':
size = int(line[1])
block = int(size * 2048)
cmd = 'gpart add -a 4k -s %s -t freebsd -i %s %s' % (block, sl, drive)
cmd = f'gpart add -a 4k -s {block} -t freebsd -i {sl} ' \
f'{drive}'
call(cmd, shell=True)
sleep(2)
+93 -51
View File
@@ -41,6 +41,8 @@ from db_partition import partition_query, label_query, bios_or_uefi
from db_partition import autoDiskPartition, autoFreeSpace, first_is_free
from db_partition import createLabel, scheme_query, how_partition
from db_partition import diskSchemeChanger, createSlice, createPartition
from partition_handler import efi_exist
# Folder use pr the installer.
tmp = "/tmp/.gbinstall/"
@@ -93,7 +95,7 @@ class Partitions():
def save_selection(self):
pass
def on_add_label(self, widget, entry, inumb, path, data):
def on_add_label(self, widget, entry, inumb, path, create):
if self.fs == '' or self.label == '':
pass
else:
@@ -101,11 +103,11 @@ class Partitions():
lb = self.label
cnumb = entry.get_value_as_int()
lnumb = inumb - cnumb
createLabel(path, lnumb, cnumb, lb, fs, data)
createLabel(path, lnumb, cnumb, lb, fs, create)
self.window.hide()
self.update()
def on_add_partition(self, widget, entry, inumb, path, data):
def on_add_partition(self, widget, entry, inumb, path, create):
if self.fs == '' or self.label == '':
pass
else:
@@ -113,14 +115,14 @@ class Partitions():
lb = self.label
cnumb = entry.get_value_as_int()
lnumb = inumb - cnumb
createPartition(path, lnumb, inumb, cnumb, lb, fs, data)
createPartition(path, lnumb, inumb, cnumb, lb, fs, create)
self.window.hide()
self.update()
def cancel(self, widget):
self.window.hide()
def labelEditor(self, path, pslice, size, data1, modify):
def labelEditor(self, path, pslice, size, scheme, modify):
numb = int(size)
self.window = Gtk.Window()
self.window.set_title("Add Partition")
@@ -146,23 +148,23 @@ class Partitions():
self.fstype.append_text('UFS+J')
self.fstype.append_text('UFS+SUJ')
self.fstype.append_text('SWAP')
if data1 == 1:
read = open(boot_file, 'r')
line = read.readlines()
boot = line[0].strip()
if scheme == 'GPT':
if bios_or_uefi() == "UEFI":
self.fstype.append_text("UEFI")
self.fs = "UEFI"
elif boot == "grub":
self.fstype.append_text("BIOS")
self.fs = "BIOS"
else:
self.fstype.append_text("BOOT")
self.fs = "BOOT"
if data1 == 1 and not os.path.exists(Part_label):
self.fstype.set_active(5)
elif data1 == 1 and len(self.partfile) == 0:
self.fstype.set_active(5)
if self.fs == "UEFI" and efi_exist(self.disk) is False:
if not os.path.exists(Part_label):
self.fstype.set_active(5)
elif len(self.prttn) == 0:
self.fstype.set_active(5)
elif self.fs == "BOOT":
if not os.path.exists(Part_label):
self.fstype.set_active(5)
elif len(self.prttn) == 0:
self.fstype.set_active(5)
elif self.lablebehind == "/":
self.fstype.set_active(4)
self.fs = "SWAP"
@@ -183,11 +185,11 @@ class Partitions():
# The space for root '/ ' is to recognise / from the file.
self.mountpoint.append_text('/')
if os.path.exists(Part_label):
if data1 == 1 and len(self.partfile) == 1:
if scheme == 'GPT' and len(self.prttn) == 1:
self.mountpoint.append_text('/boot')
elif data1 == 0 and len(self.partfile) == 0:
elif scheme == 'MBR' and len(self.prttn) == 0:
self.mountpoint.append_text('/boot')
elif data1 == 0 and not os.path.exists(Part_label):
elif scheme == 'MBR' and not os.path.exists(Part_label):
self.mountpoint.append_text('/boot')
self.mountpoint.append_text('/etc')
self.mountpoint.append_text('/root')
@@ -218,17 +220,23 @@ class Partitions():
bbox.add(button)
button = Gtk.Button(stock=Gtk.STOCK_ADD)
if modify is False:
if data1 == 0:
if scheme == 'MBR':
button.connect("clicked", self.on_add_label, self.entry,
numb, path, True)
elif data1 == 1:
elif scheme == 'GPT' and self.fs == 'BOOT':
button.connect("clicked", self.on_add_partition, self.entry,
numb, path, True)
elif scheme == 'GPT' and self.fs == 'UEFI' and efi_exist(self.disk) is False:
button.connect("clicked", self.on_add_partition, self.entry,
numb, path, True)
else:
button.connect("clicked", self.on_add_partition, self.entry,
numb, path, False)
else:
if data1 == 0:
if scheme == 'MBR':
button.connect("clicked", self.on_add_label, self.entry, numb,
path, False)
elif data1 == 1:
elif scheme == 'GPT':
button.connect("clicked", self.on_add_partition, self.entry,
numb, path, False)
bbox.add(button)
@@ -250,7 +258,7 @@ class Partitions():
if scheme_query(self.path) == "MBR" and self.path[1] < 4:
self.sliceEditor()
elif scheme_query(self.path) == "GPT":
self.labelEditor(self.path, self.slice, self.size, 1, False)
self.labelEditor(self.path, self.slice, self.size, 'GPT', False)
def autoSchemePartition(self, widget):
diskSchemeChanger(self.scheme, self.path, self.slice, self.size)
@@ -390,10 +398,10 @@ class Partitions():
def modify_partition(self, widget):
if len(self.path) == 3:
if self.slice != 'freespace':
self.labelEditor(self.path, self.slice, self.size, 0, True)
self.labelEditor(self.path, self.slice, self.size, 'MBR', True)
elif len(self.path) == 2 and self.slice != 'freespace':
if scheme_query(self.path) == "GPT":
self.labelEditor(self.path, self.slice, self.size, 1, True)
self.labelEditor(self.path, self.slice, self.size, 'GPT', True)
def autoPartition(self, widget):
if len(self.path) == 3:
@@ -433,21 +441,17 @@ class Partitions():
self.treeview.expand_all()
def create_partition(self, widget):
print(len(self.path))
print(self.path)
print(how_partition(self.path))
if len(self.path) == 2 and how_partition(self.path) == 1 and self.slice == 'freespace':
self.schemeEditor(False)
elif len(self.path) == 3:
if self.slice == 'freespace':
self.labelEditor(self.path, self.slice, self.size, 0, False)
self.labelEditor(self.path, self.slice, self.size, 'MBR', False)
elif len(self.path) == 2 and self.slice == 'freespace':
if scheme_query(self.path) == "MBR" and self.path[1] < 4:
self.sliceEditor()
elif scheme_query(self.path) == "GPT":
self.labelEditor(self.path, self.slice, self.size, 1, False)
self.labelEditor(self.path, self.slice, self.size, 'GPT', False)
else:
print('scheme')
if how_partition(self.path) == 1:
self.schemeEditor(True)
elif how_partition(self.path) == 0:
@@ -461,6 +465,7 @@ class Partitions():
self.path = model.get_path(self.iter)
tree_iter3 = model.get_iter(self.path[0])
self.scheme = model.get_value(tree_iter3, 3)
self.disk = model.get_value(tree_iter3, 0)
tree_iter = model.get_iter(self.path)
self.slice = model.get_value(tree_iter, 0)
self.size = model.get_value(tree_iter, 1)
@@ -533,7 +538,9 @@ class Partitions():
self.delete_bt.set_sensitive(False)
self.modifi_bt.set_sensitive(False)
self.auto_bt.set_sensitive(False)
if how_partition(self.path) == 1 and first_is_free(self.path) == 'freespace':
how_many_prt = how_partition(self.path)
firstisfree = first_is_free(self.path)
if how_many_prt == 1 and firstisfree == 'freespace':
self.create_bt.set_sensitive(False)
elif how_partition(self.path) == 0:
self.create_bt.set_sensitive(True)
@@ -541,41 +548,76 @@ class Partitions():
self.create_bt.set_sensitive(False)
if os.path.exists(Part_label):
rd = open(Part_label, 'r')
self.partfile = rd.readlines()
self.prttn = rd.readlines()
rtbt = False
for line in self.prttn:
if "/boot\n" in line:
rtbt = True
break
# If Find GPT scheme.
if os.path.exists(disk_schem):
rschm = open(disk_schem, 'r')
schm = rschm.readlines()[0]
efi = efi_exist(self.disk)
if 'GPT' in schm:
if len(self.partfile) >= 2:
if 'BOOT' in self.partfile[0] or 'BIOS' in self.partfile[0] or 'UEFI' in self.partfile[0]:
if "/boot\n" in self.partfile[1]:
if len(self.partfile) >= 3:
if '/\n' in self.partfile[1]:
if len(self.prttn) >= 2:
if 'BOOT' in self.prttn[0]:
if rtbt is True and "/boot\n" not in self.prttn[1]:
self.button3.set_sensitive(False)
elif "/boot\n" in self.prttn[1]:
if len(self.prttn) >= 3:
if '/\n' in self.prttn[2]:
self.button3.set_sensitive(True)
else:
self.button3.set_sensitive(False)
else:
self.button3.set_sensitive(False)
elif '/\n' in self.partfile[1]:
elif '/\n' in self.prttn[1]:
self.button3.set_sensitive(True)
else:
self.button3.set_sensitive(False)
else:
elif 'UEFI' in self.prttn[0] and efi is False:
if rtbt is True and "/boot\n" not in self.prttn[1]:
self.button3.set_sensitive(False)
elif "/boot\n" in self.prttn[1]:
if len(self.prttn) >= 3:
if '/\n' in self.prttn[2]:
self.button3.set_sensitive(True)
else:
self.button3.set_sensitive(False)
else:
self.button3.set_sensitive(False)
elif '/\n' in self.prttn[1]:
self.button3.set_sensitive(True)
else:
self.button3.set_sensitive(False)
elif rtbt is True and "/boot\n" not in self.prttn[1]:
self.button3.set_sensitive(False)
else:
self.button3.set_sensitive(False)
else:
if len(self.partfile) >= 1:
if "/boot\n" in self.partfile[0]:
if len(self.partfile) >= 2:
if '/\n' in self.partfile[1]:
elif "/boot\n" in self.prttn[0] and efi is True:
if len(self.prttn) >= 2:
if '/\n' in self.prttn[1]:
self.button3.set_sensitive(True)
else:
self.button3.set_sensitive(False)
else:
self.button3.set_sensitive(False)
elif '/\n' in self.partfile[0]:
elif '/\n' in self.prttn[0] and efi is True:
self.button3.set_sensitive(True)
else:
self.button3.set_sensitive(False)
else:
self.button3.set_sensitive(False)
else:
if len(self.prttn) >= 1:
if "/boot\n" in self.prttn[0]:
if len(self.prttn) >= 2:
if '/\n' in self.prttn[1]:
self.button3.set_sensitive(True)
else:
self.button3.set_sensitive(False)
else:
self.button3.set_sensitive(False)
elif '/\n' in self.prttn[0]:
self.button3.set_sensitive(True)
else:
self.button3.set_sensitive(False)
@@ -584,7 +626,7 @@ class Partitions():
else:
self.button3.set_sensitive(False)
else:
self.button3.set_sensitive(False)
self.button3.set_sensitive(False)
def __init__(self, button3):
self.button3 = button3
@@ -687,4 +729,4 @@ class Partitions():
def get_model(self):
self.tree_selection.select_path(0)
return self.vbox1
return self.box1