Configure GRUB in dpkg
This commit is contained in:
parent
b9bc3a6382
commit
b7d70892bf
@ -1 +0,0 @@
|
|||||||
GRUB_DISABLE_OS_PROBER=false
|
|
@ -83,6 +83,14 @@ def callList(*args,**kwargs):
|
|||||||
def getDisks():
|
def getDisks():
|
||||||
return callList(["lsblk","-ndo","PATH"])
|
return callList(["lsblk","-ndo","PATH"])
|
||||||
|
|
||||||
|
def getDiskId(diskPath):
|
||||||
|
for root,dirs,files in os.walk("/dev/disk/by-id"):
|
||||||
|
for file in files:
|
||||||
|
if os.path.realpath("/dev/disk/by-id/" +file) == diskPath:
|
||||||
|
return "/dev/disk/by-id/" +file
|
||||||
|
break
|
||||||
|
return diskPath
|
||||||
|
|
||||||
def getPartitions():
|
def getPartitions():
|
||||||
disks = getDisks()
|
disks = getDisks()
|
||||||
partitions = callList(["lsblk","-no","PATH"])
|
partitions = callList(["lsblk","-no","PATH"])
|
||||||
@ -196,6 +204,14 @@ def randhex(length):
|
|||||||
cLength += 1
|
cLength += 1
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
def debconfSetSelections(root,options):
|
||||||
|
proc = subprocess.Popen(["chroot",root,"debconf-set-selections"],stdin=subprocess.PIPE)
|
||||||
|
proc.stdin.write((options + "\n").encode("utf-8"))
|
||||||
|
proc.stdin.flush()
|
||||||
|
proc.stdin.close()
|
||||||
|
rtn = proc.wait()
|
||||||
|
if rtn != 0: raise Exception("Process returned error: " +str(rtn))
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
while choiceYn("Partition disk?"):
|
while choiceYn("Partition disk?"):
|
||||||
try:
|
try:
|
||||||
@ -388,6 +404,11 @@ def main():
|
|||||||
|
|
||||||
if installGRUB:
|
if installGRUB:
|
||||||
print("> Installing GRUB")
|
print("> Installing GRUB")
|
||||||
|
debconfSetSelections(ipth(),"grub-pc grub-pc/install_devices multiselect " +getDiskId(grubDisk))
|
||||||
|
debconfSetSelections(ipth(),"grub-pc grub2/enable_os_prober boolean true")
|
||||||
|
os.environ["DEBIAN_FRONTEND"] = "noninteractive"
|
||||||
|
chroot(ipth(),["dpkg-reconfigure","grub-pc"])
|
||||||
|
del os.environ["DEBIAN_FRONTEND"]
|
||||||
|
|
||||||
if gptInfo["isGPT"]:
|
if gptInfo["isGPT"]:
|
||||||
if gptInfo["espPart"] != None:
|
if gptInfo["espPart"] != None:
|
||||||
|
Loading…
Reference in New Issue
Block a user