mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-28 09:55:37 -04:00
Make sure to check things exist before actually modifying them
This fixes crashes when a system does not have squashfs-tools or a grub dir does not exist.
This commit is contained in:
parent
9c10b49802
commit
eed387f7a4
2 changed files with 9 additions and 2 deletions
|
@ -29,6 +29,9 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
|||
use_splash = ""
|
||||
swap_uuid = ""
|
||||
|
||||
if not os.path.exists(default_dir):
|
||||
return ("Directory does not exist", "The directory {} does not exist on
|
||||
the target".format(default_dir))
|
||||
if os.path.exists(plymouth_bin):
|
||||
use_splash = "splash"
|
||||
|
||||
|
@ -58,10 +61,10 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
|||
with open(default_grub, 'w') as grub_file:
|
||||
grub_file.write("\n".join(lines) + "\n")
|
||||
|
||||
return None
|
||||
|
||||
def run():
|
||||
partitions = libcalamares.globalstorage.value("partitions")
|
||||
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
||||
distributor = libcalamares.job.configuration["distributor"]
|
||||
modify_grub_default(partitions, root_mount_point, distributor)
|
||||
return None
|
||||
return modify_grub_default(partitions, root_mount_point, distributor)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue