[grubcfg] Drop default_dir
- the default_dir was only stored in modify_grub_default() to create the directory if needed; move that functionality to the get_grub_config_paths() function (and drop the "s", since it now returns just one).
This commit is contained in:
parent
aa50dfb8a1
commit
064fff0c12
@ -37,18 +37,21 @@ def pretty_name():
|
|||||||
return _("Configure GRUB.")
|
return _("Configure GRUB.")
|
||||||
|
|
||||||
|
|
||||||
def get_grub_config_paths(root_mount_point):
|
def get_grub_config_path(root_mount_point):
|
||||||
"""
|
"""
|
||||||
Figures out where to put the grub config files. Returns
|
Figures out where to put the grub config files. Returns
|
||||||
a directory path and the full path of a file inside that
|
a the full path of a file inside that
|
||||||
directory, as "the grub-directory" and "the config file".
|
directory, as "the config file".
|
||||||
|
|
||||||
Returns a path into @p root_mount_point.
|
Returns a path into @p root_mount_point.
|
||||||
"""
|
"""
|
||||||
default_dir = os.path.join(root_mount_point, "etc/default")
|
default_dir = os.path.join(root_mount_point, "etc/default")
|
||||||
default_grub = os.path.join(default_dir, "grub")
|
default_grub = os.path.join(default_dir, "grub")
|
||||||
|
|
||||||
return (default_dir, default_grub)
|
if not os.path.exists(default_dir):
|
||||||
|
os.mkdir(default_dir)
|
||||||
|
|
||||||
|
return default_grub
|
||||||
|
|
||||||
def modify_grub_default(partitions, root_mount_point, distributor):
|
def modify_grub_default(partitions, root_mount_point, distributor):
|
||||||
"""
|
"""
|
||||||
@ -67,7 +70,7 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
|||||||
is always updated to set this value.
|
is always updated to set this value.
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
default_dir, default_grub = get_grub_config_paths(root_mount_point)
|
default_grub = get_grub_config_path(root_mount_point)
|
||||||
distributor_replace = distributor.replace("'", "'\\''")
|
distributor_replace = distributor.replace("'", "'\\''")
|
||||||
dracut_bin = libcalamares.utils.target_env_call(
|
dracut_bin = libcalamares.utils.target_env_call(
|
||||||
["sh", "-c", "which dracut"]
|
["sh", "-c", "which dracut"]
|
||||||
@ -154,9 +157,6 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
|||||||
|
|
||||||
distributor_line = "GRUB_DISTRIBUTOR='{!s}'".format(distributor_replace)
|
distributor_line = "GRUB_DISTRIBUTOR='{!s}'".format(distributor_replace)
|
||||||
|
|
||||||
if not os.path.exists(default_dir):
|
|
||||||
os.mkdir(default_dir)
|
|
||||||
|
|
||||||
have_kernel_cmd = False
|
have_kernel_cmd = False
|
||||||
have_distributor_line = False
|
have_distributor_line = False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user